refactored scrolling code to cleaner jquery