Rearranges pages, Refactors code