moved page loops into inc file