Added a better controller for generating pages