Simplified scroll function as it was being buggy in Safari.