Adding logic to ensure app is properly loaded