adding variables to function dataLoaded before creating for loop