refactored animate