Added/expanded some comments and modified some variable names to make more sense.