Fixed bug: End of pagination no results looping now. Did some refactoring.