Added a username availability check and unique client-id assignment.