implemented nearly all collapse_*, disambiguate_* and sort_* tests