Gallery refactor