Port over a little more logic from the old parseMessage().