add/update comments + minor code improvement