gallery feature refactoring