changed some variables and added some comments