Refactor animation