Improvement in login logic