Added a check for the collection file and added some comments