Big rewrite to make internal client handling better

But they are now out of order