Commented, style changes

renamed variables, added comments to improve readability.