modified login logic