Updated source with better comments

and improved a few variable names.