Modified fetchData to support async fetch using threads