gallery.js cleanup