fixing bugs, introducing group ids and printing all messages within a group