update scrolling function