Added a pages controller
Added integration tests for pages and refactored