Almost implemented the login