using cursor and pages