added a separate thread to handle reading input