Changes to login logic and started session handlin