begin refactoring for js and animations