add some comments and minor changes