Moved most client code to pbws library