updated paginate, exceptions, unit tests and example