Revamps the animation code