Added login function.