updated code on master branch with jgrevich's pagination