Extracting the collection function into a new file inside Collection

This will make the collection package self-contained