Messaging system

Added foundation of messaging system. Needs further refining.