add comments and minor bug fixed