renamed some variables and re-worded some comments