Move the blocking codes out of the message processing code