changed get_group to run in O(n*log(n)) instead of O(n^2) by using _groups_cache_hash
TODO: check if cache needs to be invalidated in more places