Added iterateMaybeM