Added the logic of the collection view