re-working iterate and iterateInner to work with various input orders and durations