lightly refactored js, smoother animation
ignore ai