Refactoring message processor logic.