Gallery refactoring