add comments and fix analyzer memory leak problem