refactor pages to routes