Added code to handle onscroll