update comments and some minor code adjustments