cleaned up the message fetch code a little