seperate page rendering function