Added new class MsgHandler (not complete; refactor #4)