refactored scrollTo script