Second attempt at a refactor

Went ahead and discarded my pull request from December. I made all the changes I had intended (this time not smashed together in one big commit), and a few more I had been thinking about. Also wrote some coherent docs to help new users get started.