Added apiLoaded var