update some code and add comment