Code refactoring
GroupBy query with jointure(s) bug fixed
Added some unit tests