Refactor pages.show