Massive overhaul

Some of my changes may be controversial, so I'm opening this PR rather than pushing directly to the repo.

If you're ok with all of these, feel free to just go ahead and merge. Otherwise, all feedback is welcome.