Changed a variable name to make more sense and added some comments.