some cleanup in the client, added some comments