Refactor constructor of MessageProcessor