Changed some of the variable names to make more readable, added comments