Made the Input class thread safe (at least I think). Now the thread exits properly before the program shuts down