Code review!

I've tried to explain every change in commit messages, and I recommend just going through them chronologically. Let me know if there's anything I can explain more fully!