modified code for accessing data from the collections