restructered to reflect differences in client and server messages