Improved gallery loading