Finished pagination. TODO: fix minor issue with advancedSearch