Adding pages and cleaning up code