add tests, update collate