Added loops incase of error