added Ctrl+C processing into main long loops so the program will now not require to hit Ctrl+C multiple times to exit