Put page view into own function