Big refactoring to use pagetypes in between controllers and pages