simplifying gallery imagecontainer code