changed variable names and added some comments