reorganized and fixed smooth scrolling