changed logic to display loading screen