added comments and proper structure to route handlers