update gallery code