Animation caching to improve performance
Fixed possible memory leak