refactored anim.js