slight refactor of pageView method