Fixed pagination bug

* Cleaned up handlebars helpers.
* Moved pagination behaviour to search command.