change instance container to multimap,
add grouping algo