Fixed some broken tests and added a few more comments.