Update the route.js file with better if statments