moved routing logic to routes.js