Code review!

@happy4crazy and I are doing some pair code review. We'll keep adding commits to this pull request, so don't merge it in. We're also going to make some inline comments on the commits themselves, but feel free to ask any questions you may have.