update comments and some code