logout logic and loading bar prototype