added support for galleries, though not for nested galleries