messages refactoring