reverted gallery code back
gallery code cleanup
gallery cleaup
gallery refactoring continue