Refactor the paging code a bit
Write the `map_pages' function