rename some variables and add some comments