Nearly working scrolling calculations