refactoring, speed up message updating