Added logic for login