added function to get data from the collection in the template