modifying iterate and iterateInner to allow for iterations of things like 20 minutes and 2 hours (durations that are not 1 period long)