update comments to English and simplify the codes
 code