refactoring of scroll crawling