Code refactor in MessageCollectingActor class.