add comments and small fix