Updated gallery code