refactoring autoScroll