update comments & prettify code