Extracted code in / route out into methods