changed variable names to be more informative; added comments