Big input cleanup

The entire input section has been re-structured for easier reading.
I've tested a lot of games without issues, so (hopefully) everything should be working just fine.
Feel free to take a look over it before merging, it's quite a huge change.