Add comment and fix some bugs.