* refactor code of sending msg