added parameter to fetchData to customize queries