synchronize messages refactoring