Vastly improved scrolling calculation