Significant refactor to use more (smaller) modules and communicate via pubsub. Not quite complete yet. Fixes issue #7 (again), plus a handful of other benefits.