added function for rendering pages