update comments and minor syntax