General improvements and tests for collections.