WIP code for input detection. Untested.