added the image cache
added docstring, removed unused import