Segregate input polling over thread, helper cleanups for debug and threaded libs.