added some variables and comments