partial rewrite of the messaging system and the HAL plugin