Code review!

The commit messages are meant to be explanations; let me know if anything's unclear!