Clean up comments, fix up some confusing code logic.