Added MessageHandler class and appropriate exceptions