better implementation for caching pittpatt galleries