Increase grouping efficiency

Remove generics from grouping mechanisms
Make groups operate on locations
Remove group borders, rely on color instead
Remove O(n^2) operations in grouping