Made changes to variable names, added some documentation