refactored collection.js with updateCollectionView function