Another major refactor.

I wanted to separate out the concerns a bit better.