Implemented Logout and updated login logic