refactoring animation code