Improvements to Collections, and minor refactoring.