improving scroll function