Updated based on the comments from Vad
Simplified the collection code and updated the tests