Improved infinite scroll code to throttle events