Switched from while(1): -> break to while not done: