[WIP] Fix pagination and sorting issues

This will address #70.