First stage of cleanup; started on some collection-oriented tests. Next up: more tests, cleanup and documentation.