Added routes to separate file and simplified the code.