diff --git a/src/core/identification_sources/identificationdatasource.cpp b/src/core/identification_sources/identificationdatasource.cpp
index aa21e177a7dfc1715228ae9061e6985a2c931eff..d1c701709fddb9d1dcf82dce52436972c51def85 100644
--- a/src/core/identification_sources/identificationdatasource.cpp
+++ b/src/core/identification_sources/identificationdatasource.cpp
@@ -195,7 +195,8 @@ pappso::MassSpectrumCstSPtr
 IdentificationDataSource::getMassSpectrumCstSPtr(unsigned int scan_number) const
 {
 
-  qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
+  qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__ << " "
+           << scan_number;
   if(_ms_run_sp.get()->getMzFormat() == pappso::MzFormat::MGF)
     {
       scan_number = scan_number - 1;
@@ -222,8 +223,14 @@ IdentificationDataSource::getMassSpectrumCstSPtr(unsigned int scan_number) const
 
   // qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__  <<
   // _ms_run_sp.get()->getMsRunReaderSp().get()->getSpectrumListSize();
+
+  qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__ ;
+  std::size_t spectrum_index =
+    msrun_reader_sp.get()->scanNumber2SpectrumIndex(scan_number);
+  qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__ << " "
+           << spectrum_index;
   pappso::MassSpectrumCstSPtr spectrum_sp =
-    msrun_reader_sp.get()->massSpectrumCstSPtr(scan_number);
+    msrun_reader_sp.get()->massSpectrumCstSPtr(spectrum_index);
   qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
   return spectrum_sp;
 }
diff --git a/src/core/peptideevidence.cpp b/src/core/peptideevidence.cpp
index 8361313666a156d25304832040c3e199aeee26b9..21a52fcd45a32ad9a3e99267d72ca8ef51c868ed 100644
--- a/src/core/peptideevidence.cpp
+++ b/src/core/peptideevidence.cpp
@@ -38,17 +38,17 @@ std::hash<std::string> PeptideEvidence::_hash_fn;
 PeptideEvidence::PeptideEvidence(MsRun *msrunid_sp, std::size_t scan_index)
 {
   _msrunid_sp  = msrunid_sp;
-  m_scan_index = scan_index;
+  m_scan_number = scan_index;
 
   _hash_sample_scan      = PeptideEvidence::_hash_fn(QString("%1 %2")
                                                   .arg(msrunid_sp->getXmlId())
-                                                  .arg(m_scan_index)
+                                                  .arg(m_scan_number)
                                                   .toStdString());
   _identification_engine = IdentificationEngine::unknown;
 }
 
 PeptideEvidence::PeptideEvidence(const PeptideEvidence &other)
-  : PeptideEvidence(other._msrunid_sp, other.m_scan_index)
+  : PeptideEvidence(other._msrunid_sp, other.m_scan_number)
 {
   _hash_sample_scan        = other._hash_sample_scan;
   _sp_grp_peptide          = other._sp_grp_peptide;
@@ -62,9 +62,7 @@ PeptideEvidence::PeptideEvidence(const PeptideEvidence &other)
   _checked                 = other._checked;
   _proxy_valid             = other._proxy_valid;
   _identification_engine   = other._identification_engine;
-  m_scan_index             = other.m_scan_index;
   m_scan_number            = other.m_scan_number;
-  m_mzml_id                = other.m_mzml_id;
 }
 
 pappso::pappso_double
diff --git a/src/core/peptideevidence.h b/src/core/peptideevidence.h
index ddbd0368261d8ab1c9987bf1d5e5b24555bf5f10..414fbcf601cd703fe7eb48b35d4a3383e18f73a2 100644
--- a/src/core/peptideevidence.h
+++ b/src/core/peptideevidence.h
@@ -29,8 +29,7 @@
  *     Olivier Langella <Olivier.Langella@u-psud.fr> - initial API and
  *implementation
  ******************************************************************************/
-#ifndef PEPTIDEEVIDENCE_H
-#define PEPTIDEEVIDENCE_H
+#pragma once
 
 #include <pappsomspp/types.h>
 #include "peptidextp.h"
@@ -118,8 +117,6 @@ class PeptideEvidence
   const MsRun *getMsRunP() const;
   IdentificationDataSource *getIdentificationDataSource() const;
   unsigned int getScanNumber() const;
-  std::size_t getSpectrumIndex() const;
-  const QString getSpectrumNativeId() const;
   pappso::pappso_double getRetentionTime() const;
   unsigned int getCharge() const;
   const PeptideXtpSp &getPeptideXtpSp() const;
@@ -156,9 +153,7 @@ class PeptideEvidence
   private:
   static std::hash<std::string> _hash_fn;
   MsRun *_msrunid_sp;
-  std::size_t m_scan_index  = 0;
   unsigned int m_scan_number = 0;
-  QString m_mzml_id;
   size_t _hash_sample_scan;
   pappso::GrpPeptideSp _sp_grp_peptide;
   PeptideXtpSp _peptide_sp;
@@ -181,4 +176,3 @@ class PeptideEvidence
    */
   IdentificationEngine _identification_engine;
 };
-#endif // PEPTIDEEVIDENCE_H
diff --git a/src/gui/peptide_detail_view/peptidewindow.cpp b/src/gui/peptide_detail_view/peptidewindow.cpp
index 00a1cbb38c8ea45a976dd899e678fd9ca1b49374..33d21dad54bf3ac853b22a80251891304424c2b2 100644
--- a/src/gui/peptide_detail_view/peptidewindow.cpp
+++ b/src/gui/peptide_detail_view/peptidewindow.cpp
@@ -46,7 +46,7 @@ SpectrumSpLoaderThread::doLoadSpectrumSp(PeptideEvidence *p_peptide_evidence)
   try
     {
       spectrum = p_peptide_evidence->getIdentificationDataSource()
-                   ->getMassSpectrumCstSPtr(p_peptide_evidence->getScan());
+                   ->getMassSpectrumCstSPtr(p_peptide_evidence->getScanNumber());
       emit spectrumSpReady(spectrum, QString(""), QString(""));
     }
 
@@ -231,7 +231,7 @@ PeptideWindow::updateDisplay()
           _p_peptide_evidence->getCharge())));
       ui->z_label->setText(QString("%1").arg(_p_peptide_evidence->getCharge()));
       ui->scan_label->setText(
-        QString("%1").arg(_p_peptide_evidence->getScan()));
+        QString("%1").arg(_p_peptide_evidence->getScanNumber()));
       ui->sample_label->setText(
         _p_peptide_evidence->getMsRunP()->getSampleName());
       ui->modification_label->setText(
@@ -307,7 +307,7 @@ PeptideWindow::openInPeptideViewer()
   arguments << _p_peptide_evidence->getPeptideXtpSp().get()->toString()
             << QString("%1").arg(_p_peptide_evidence->getCharge())
             << _p_peptide_evidence->getMsRunP()->getFilename()
-            << QString("%1").arg(_p_peptide_evidence->getScan());
+            << QString("%1").arg(_p_peptide_evidence->getScanNumber());
 
   qDebug() << "PeptideWindow::openInPeptideViewer " << program << " "
            << arguments.join(" ");
@@ -439,7 +439,7 @@ PeptideWindow::doSaveSvg()
         QString("%1/%2_%3.svg")
           .arg(default_location)
           .arg(_p_peptide_evidence->getMsRunP()->getSampleName())
-          .arg(_p_peptide_evidence->getScan());
+          .arg(_p_peptide_evidence->getScanNumber());
 
       if(_p_peptide_evidence->getValidationState() == ValidationState::grouped)
         {
@@ -449,7 +449,7 @@ PeptideWindow::doSaveSvg()
               .arg(
                 _p_peptide_evidence->getGrpPeptideSp().get()->getGroupingId())
               .arg(_p_peptide_evidence->getMsRunP()->getSampleName())
-              .arg(_p_peptide_evidence->getScan());
+              .arg(_p_peptide_evidence->getScanNumber());
         }
 
       QString filename = QFileDialog::getSaveFileName(
diff --git a/src/gui/peptide_list_view/peptidetablemodel.cpp b/src/gui/peptide_list_view/peptidetablemodel.cpp
index b867cf00da3e73ad822be3bca5fd580029ff80b0..ab608f74c3ec036bd3d061fce409b8ddf59a9074 100644
--- a/src/gui/peptide_list_view/peptidetablemodel.cpp
+++ b/src/gui/peptide_list_view/peptidetablemodel.cpp
@@ -259,7 +259,7 @@ PeptideTableModel::data(const QModelIndex &index, int role) const
                     (quint32)_p_protein_match->getPeptideMatchList()
                       .at(row)
                       .getPeptideEvidence()
-                      ->getScan());
+                      ->getScanNumber());
                   break;
                 case(std::int8_t)PeptideListColumn::rtmin:
                   return QVariant(
diff --git a/src/gui/peptide_list_view/peptidetableproxymodel.cpp b/src/gui/peptide_list_view/peptidetableproxymodel.cpp
index 3993cd41216919b5d97d242828271b8d9e6a68f6..9eb0a037a6756e92a786d8b9c882aefcb72884a9 100644
--- a/src/gui/peptide_list_view/peptidetableproxymodel.cpp
+++ b/src/gui/peptide_list_view/peptidetableproxymodel.cpp
@@ -136,7 +136,7 @@ PeptideTableProxyModel::filterAcceptsRow(int source_row,
           if(scan_num > 0)
             {
               scan_ok = false;
-              if(peptide_evidence->getScan() == scan_num)
+              if(peptide_evidence->getScanNumber() == scan_num)
                 {
                   scan_ok = true;
                 }
@@ -317,7 +317,8 @@ PeptideTableProxyModel::lessThan(const QModelIndex &left,
 
 
 QVariant
-PeptideTableProxyModel::headerData(int section, Qt::Orientation orientation,
+PeptideTableProxyModel::headerData(int section,
+                                   Qt::Orientation orientation,
                                    int role) const
 {
   int col = mapToSource(index(0, section)).column();
diff --git a/src/gui/protein_list_view/proteintableproxymodel.cpp b/src/gui/protein_list_view/proteintableproxymodel.cpp
index 2db9e8aefd9c6201009b2deed12f2e57c81e2fe2..7ebb39c35d7ecbfcc7ba173c75f88cfc7942d744 100644
--- a/src/gui/protein_list_view/proteintableproxymodel.cpp
+++ b/src/gui/protein_list_view/proteintableproxymodel.cpp
@@ -131,7 +131,7 @@ ProteinTableProxyModel::filterAcceptsRow(int source_row,
               if(scan_num > 0)
                 {
                   scan_ok = false;
-                  if(p_peptide_match.getPeptideEvidence()->getScan() ==
+                  if(p_peptide_match.getPeptideEvidence()->getScanNumber() ==
                      scan_num)
                     {
                       scan_ok = true;
@@ -378,7 +378,8 @@ ProteinTableProxyModel::data(const QModelIndex &index, int role) const
 }
 
 QVariant
-ProteinTableProxyModel::headerData(int section, Qt::Orientation orientation,
+ProteinTableProxyModel::headerData(int section,
+                                   Qt::Orientation orientation,
                                    int role) const
 {
   int col = mapToSource(index(0, section)).column();
diff --git a/src/gui/ptm_peptide_list_view/ptmpeptidetablemodel.cpp b/src/gui/ptm_peptide_list_view/ptmpeptidetablemodel.cpp
index ca333c6a2eb8909b7351cb914800d21ba344f689..ba001ecf8089b26cf8ec4a01315071967b31f549 100644
--- a/src/gui/ptm_peptide_list_view/ptmpeptidetablemodel.cpp
+++ b/src/gui/ptm_peptide_list_view/ptmpeptidetablemodel.cpp
@@ -243,7 +243,7 @@ PtmPeptideTableModel::data(const QModelIndex &index, int role) const
                                 .get()
                                 ->getRepresentativePeptideMatch()
                                 .getPeptideEvidence()
-                                ->getScan());
+                                ->getScanNumber());
               break;
             case(std::int8_t)PtmPeptideListColumn::rt:
               return QVariant((qreal)_ptm_sample_scan_list.at(row)
diff --git a/src/output/ods/spectrasheet.cpp b/src/output/ods/spectrasheet.cpp
index 7508d588acda3f8946b3b188549727e575e4b9aa..eb966e9e7a9fa53da99d4597df6d9858a4eb9e1f 100644
--- a/src/output/ods/spectrasheet.cpp
+++ b/src/output/ods/spectrasheet.cpp
@@ -184,7 +184,7 @@ SpectraSheet::writeIdentificationGroup(IdentificationGroup *p_ident)
           unsigned int arank = a->getGrpPeptideSp().get()->getRank();
           unsigned int ascan = a->getScanNumber();
           unsigned int brank = b->getGrpPeptideSp().get()->getRank();
-          unsigned int bscan = b->getScan();
+          unsigned int bscan = b->getScanNumber();
           return std::tie(arank, a->getMsRunP()->getSampleName(), ascan) <
                  std::tie(brank, b->getMsRunP()->getSampleName(), bscan);
         });
@@ -200,10 +200,10 @@ SpectraSheet::writeIdentificationGroup(IdentificationGroup *p_ident)
           // change spectra :
           unsigned int arank =
             p_best_peptide_evidence->getGrpPeptideSp().get()->getRank();
-          unsigned int ascan = p_best_peptide_evidence->getScan();
+          unsigned int ascan = p_best_peptide_evidence->getScanNumber();
           unsigned int brank =
             peptide_evidence->getGrpPeptideSp().get()->getRank();
-          unsigned int bscan = peptide_evidence->getScan();
+          unsigned int bscan = peptide_evidence->getScanNumber();
 
           if(std::tie(arank,
                       p_best_peptide_evidence->getMsRunP()->getSampleName(),
diff --git a/src/output/xpip.cpp b/src/output/xpip.cpp
index 8df777c902ed42ff6b8f9d4512ba1f94863ec9ce..51a542c8af1fdea4e8f46993b030cc2460b59d0b 100644
--- a/src/output/xpip.cpp
+++ b/src/output/xpip.cpp
@@ -592,18 +592,8 @@ Xpip::writePeptideEvidence(const PeptideEvidence *p_peptide_evidence)
           .arg(exception_std.what()));
     }
   qDebug() << "Xpip::writePeptideEvidence scan";
-  if(p_peptide_evidence->getSpectrumNativeId().isEmpty())
-    {
-      _output_stream->writeAttribute(
-        "scan", QString("%1").arg(p_peptide_evidence->getScanNumber()));
-    }
-  else
-    {
-      _output_stream->writeAttribute(
-        "idx", QString("%1").arg(p_peptide_evidence->getSpectrumIndex()));
-      _output_stream->writeAttribute("mzmlid",
-                                     p_peptide_evidence->getSpectrumNativeId());
-    }
+  _output_stream->writeAttribute(
+    "scan", QString("%1").arg(p_peptide_evidence->getScanNumber()));
   writeDoubleAttribute("rt", p_peptide_evidence->getRetentionTime());
   _output_stream->writeAttribute(
     "eng",
diff --git a/src/utils/peptideevidencestore.cpp b/src/utils/peptideevidencestore.cpp
index d87c0be3a3c31a29efa0abe3da08ccc0b3d443c8..8970a7d2e4cf1a4e3d6eb883a71d8cf7aee96ac5 100644
--- a/src/utils/peptideevidencestore.cpp
+++ b/src/utils/peptideevidencestore.cpp
@@ -52,17 +52,13 @@ PeptideEvidenceStore::getInstance(const PeptideEvidence *p_peptide_evidence)
   // << p_peptide_evidence->getScan(); qDebug() <<
   // "PeptideEvidenceStore::getInstance begin" ;
   std::multimap<unsigned int, PeptideEvidenceSp>::iterator it =
-    _multimap_scan_evidence.find(p_peptide_evidence->getSpectrumIndex());
-  if(p_peptide_evidence->getSpectrumNativeId().isEmpty())
-    {
-      it = _multimap_scan_evidence.find(p_peptide_evidence->getScanNumber());
-    }
+    _multimap_scan_evidence.find(p_peptide_evidence->getScanNumber());
   std::multimap<unsigned int, PeptideEvidenceSp>::iterator find_it =
     _multimap_scan_evidence.end();
 
 
   while((find_it == _multimap_scan_evidence.end()) &&
-        (it->first == p_peptide_evidence->getScan()) && (it != find_it))
+        (it->first == p_peptide_evidence->getScanNumber()) && (it != find_it))
     {
       if(it->second.get()->getPeptideXtpSp().get() ==
          p_peptide_evidence->getPeptideXtpSp().get())
@@ -84,7 +80,7 @@ PeptideEvidenceStore::getInstance(const PeptideEvidence *p_peptide_evidence)
       // insert it
       find_it = _multimap_scan_evidence.insert(
         std::pair<unsigned int, PeptideEvidenceSp>(
-          p_peptide_evidence->getScan(),
+          p_peptide_evidence->getScanNumber(),
           p_peptide_evidence->makePeptideEvidenceSp()));
       _peptide_evidence_list.push_back(find_it->second);
     }
@@ -133,9 +129,7 @@ PeptideEvidenceStore::getPeptideEvidenceList() const
 void
 PeptideEvidenceStore::getSameXicPeptideEvidenceList(
   std::vector<const PeptideEvidence *> &peptide_evidence_list,
-  const MsRun *p_msrun,
-  const PeptideXtp *p_peptide,
-  unsigned int charge) const
+  const MsRun *p_msrun, const PeptideXtp *p_peptide, unsigned int charge) const
 {
   for(const PeptideEvidenceSp &peptide_evidence_sp : _peptide_evidence_list)
     {