Refactoring in MessagesHelper (belongs to #242)