cleanup the inputState handler code

* simpler usage
* clean code