added changes to js to handle scroll better