refactoring infinite scroll