Fixed nested logic for overlapping iterations.


Signed-off-by: Tushar Narayan