Fixes bugs in collections. Adds methods.

Also updates tests, and repairs some broken ones.