Rewrote a bunch of code. Requests are now object-oriented, and the code
should be easier to understand.