update with refatcory for group and some bug fix