added logic to log in