Fixed variable names. Added some comments.