Cleaned up the code, documented it, and fixed a couple of bugs.