Adding function to fetch from API