Restructure updateScroll()
Rename exported functions for clarity