Copy basic fuctions from AA.

Issues remain:
Find best group during split
merge groups