better scrolling calculation