improvements for gallery tag