Added login method with. Very ugly, needs refactoring desparately.