Updated example and make the animation method more efficient