Updated each so that it returns a value of the same type.