updates js to handle scrolling to end better