work to templates for gallery