Laid out the basic message handling framework