Everything is working except the program doesn't know when to stop.