clean up message parser a bit