added exception catch fixed ping, made client global. a few other changes.