unit tests added and usage of paginate simplified
unit tests are added and usage of paginator simplified