Client exit codes and print to stderr

Surgery to turn command handler inside out. Implemented a basic message passing system to support writing to stdout and support exit codes and the client. I expect many tests to fail, merge may take some time...