Fixing typo, adding comments, generally cleaning up