Added handling for input text changes and exiting application