Refactor route and core into its own module file