refactored gallery to load index files