Painful past prompts Josi to secure future with long-term deal