Implemented most of the login system