refactor the pages