Optimize access to images, reduce sort times from ~20s to ~3s