updated gallery refactor to include minor changes from review