Merging gallery code into master