Added sub_collections and fixed tests.