messages thread refactoring