gallery code update