Fixing message handling to account for grouped messages