Removing unnecessary iterations