refactored js for the scroll nav