Client refactor and improvements.