added flatten method, can now clip multidimensional groups