updated iteration indices to I rather than N