group messages on type