pagination fully working. significant refactoring complete.