Rewriting substantial parts of the app.

Cleaning up a lot of things, doing things in a more node-esque way, simplifying
code.