Done, agreed it is cleaner using group_by, also making it more extensible for the future