mostly working client impl