fixes "first line of message not read" problem, and propogates appropriate error messages down from catalyst to the client.  code tidied up a bit