add some comments and rename some types