paging code cleanup