added login method to login code