added comments, changed variable names