finished implementation of image caching, like proposed in issue #16