moving all the code to the routes index, clearing up server