Completely refactored input handling. Way more flexible now. Still need to be polish but the core is there.