added detection for end of scroll