Factor out getting the message text