Refined JS for sticky scrolling