removed dependency on window.scroll