scrolling logic rearranged, this should be much more efficient as the on scroll listener is much slimmer now