added the mappages function