MessageHandler refactoring