Changed the login mechanism and removed some junk code