implemented up to min-max-element