Giant commit, but it works!

To use: install input filter (see inputfilter/), and install the app.