Rename a few variables, add some comments, and rewrite a TODO