added login logic