Clean up code for routes and controllers