minor changes
Added KeyboardInterrupt signal handling to exit the loop gracefully