Refactoring of animation