Omprovements in logIn function