optimization for new photogallery