switched the loop to have an escape