Update client
Refactor and tighten: moved exception code to helper functions, added assertions, use critical instead of fatal for logging