Added sign-in loading screen and error pop up and major code clean up