Cleaned up collection and iterator handling.