Use implicit element index, and remove one-image gallery assumptions