Gallery 2.5

Code refactoring