added ,mechanisms to run initApp() only if the data is loaded.