Refactor gallery.html.