copied TS Input Manager from instream (closes #48)