More unit tests, fixed search, added aray flattener helper method, allowed grouping by nonscalar