CHANGED:seperate the message handler to replace of anonymous function;