modified login method