First pass at pagination. not sure if working 100%