checkout and modified gallery.js