made it work outside of funciton (the problem wasd that using break only
breaks out of the closest loop, the for loop, and you need it to break
out of the while loop as well.)