refactor routes and layout