minor update on variable names and add some comments