Refactoring

Most notably, this introduces some app state in preparation for
exposing this state via WebSockets on the http side.
Spike at front-end dataflow