diff --git a/src/rssm.cpp b/src/rssm.cpp
index d6e5fe70a2cb93b7113df0f04698d797054bcd68..4ce7b0e3baaf24a276d711d53330ca0722eae3db 100644
--- a/src/rssm.cpp
+++ b/src/rssm.cpp
@@ -44,21 +44,18 @@ class RssmRawFile {
 // Read raw data file, store contents as class variables
 void RssmRawFile::RdRawYam( FILE *F_in )
 {
-    COld old;
-    string lin, key, val;
+    string lin, key, val, bla, blub;
     CCoord co;
     CScan sout;
-    int iz;
+    int iz, ndet;
     double num;
-    
+    vector<double> numvec;
+
     daq_time_step=0;
     angles.clear();
 
     CYamlRead y( F_in );
 
-    old.as_on_disk = true;
-    NOlm::OloAdd(&old);
-    
     y.checktype( YAML_STREAM_START_EVENT, "no stream\n" );
     y.checktype( YAML_DOCUMENT_START_EVENT, "no document\n" );
     y.checktype( YAML_MAPPING_START_EVENT, "main: no map\n" );
@@ -67,121 +64,104 @@ void RssmRawFile::RdRawYam( FILE *F_in )
     y.checktype( YAML_MAPPING_START_EVENT, "Meta: no map\n" );
     y.checkvalue( "format" );
     val = y.getscalar( "format" );
-    if( strncmp( val.c_str(), "acq5.0 for yaml1", 16 ) )
-        throw( string("Unexpected format") );
+    if( strncmp( val.c_str(), "acq5.1 for yaml1", 16 ) )
+        throw( string("Unexpected format") + val );
     y.skipvalues( 2 );
     y.checktype( YAML_MAPPING_END_EVENT, "Meta: no end of map\n" );
 
     y.checkvalue( "History" );
     y.checktype( YAML_SEQUENCE_START_EVENT, "History: no seq\n" );
-    y.checktype( YAML_MAPPING_START_EVENT, "History: meas: no map\n" );
-    y.checkvalue( "measured on SPHERES" );
-    old.lDoc.push_back( "measured on SPHERES" );
-    y.checktype( YAML_MAPPING_START_EVENT, "History: meas: meas: no map\n" );
-    while( true ){
-        y.next();
-        if( y.event.type == YAML_MAPPING_END_EVENT ){
-            y.done();
-            break;
-        }
-        if( y.event.type != YAML_SCALAR_EVENT )
-            throw string( "No scalar key in Hist:meas "
-                          "; last valid entry was \"" + y.last_valid + "\"" );
-        key = (const char*)y.event.data.scalar.value;
-        y.last_valid = key;
-        y.done();
-        y.next();
-        if( y.event.type != YAML_SCALAR_EVENT )
-            throw string( "No scalar value in Hist:meas "
-                          "; last valid entry was \"" + y.last_valid + "\"" );
-        val = (const char*)y.event.data.scalar.value;
-        y.last_valid = val;
-        y.done();
-        old.lDoc.push_back( "  " + key + ": " + val );
+    while( y.scalar_from_seq( "History", &val ) )
+        ; // do nothing
+
+    y.checkvalue( "Shortpar" );
+    y.checktype( YAML_MAPPING_START_EVENT, "Shortpar: no map\n" );
+    while( y.pair_from_map( "Shortpar", &key, &val ) ){
         if        ( key=="incremental" ){
             if      ( val=="true" )
                 incremental = true;
             else if ( val=="false" )
                 incremental = false;
             else
-                throw "Invalid value of 'incremental'";
-        } else if ( key=="until" ){
+                throw string( "Invalid value [" ) + val +
+                    "] of 'incremental'";
+        } else if ( key=="measured_until" ){
             char date_string[24];
             sscanf( val.c_str(), "%24c", date_string );
             struct tm date_broken;
             strptime( date_string, "%F %A %H:%M:%S", &date_broken );
             measured_until = mktime( &date_broken );
+        } else if ( key=="ndet" ){
+            if( mystd::any2int( val, &ndet ) )
+                throw string( "invalid ndet" );
+        } else if ( key=="daq_time_step" ){
+            mystd::string_extract_word( val, &bla, &blub );
+            mystd::any2dbl( bla, &daq_time_step );
         }
     }
-    y.checktype( YAML_MAPPING_END_EVENT, "History: meas: no end of map\n" );
-    while( y.scalar_from_seq( "history", &lin ) ){
-        old.lDoc.push_back(lin);
-    }
+    if( !daq_time_step )
+        throw string( "daq time step not found" );
 
-    y.checkvalue( "Param" );
-    y.checktype( YAML_SEQUENCE_START_EVENT, "Param: no seq\n" );
+    y.checkvalue( "Longpar" );
+    y.getscalar( "Longpar emptyness" );
+
+    y.checkvalue( "Detectors" );
+    y.checktype( YAML_SEQUENCE_START_EVENT, "Detectors: no seq\n" );
     while( true ){
         y.next();
         if( y.event.type == YAML_SEQUENCE_END_EVENT )
             break;
         if( y.event.type != YAML_MAPPING_START_EVENT )
-            throw string( "Param: no map; last entry was " + y.last_valid );
+            throw string ( "Dets: no map" );
         y.done();
-        key = y.getscalar( "Param: name or note" );
-        if( key=="note" ){
-            y.skipvalues( 1 );
-            y.checktype( YAML_MAPPING_END_EVENT, "Param: no end of note" );
-            continue;
-        }
-        if( key!="name" )
-            throw string( "Param entry starting neither with note, "
-                          "nor with name" );
-        co.name = y.getscalar( "param.name" );
-        if ( co.name=="daq_time_step" ){
-            // useful double value
-            y.checkvalue( "unit" );
-            co.unit = y.getscalar( "param(" + co.name + ").unit" );
-            y.checkvalue( "value" );
-            val = y.getscalar( "param(" + co.name + ").value" );
-            if( mystd::any2dbl( val, &num ) )
-                throw string( "param(" ) + co.name + "): invalid value " + val;
-            old.RPar.push_back( CParam( co, num ) );
-            y.checktype( YAML_MAPPING_END_EVENT,
-                         "Param "+co.name+": no eom\n" );
-            if( co.name=="daq_time_step" )
-                daq_time_step = num;
-        } else {
-            // no useful value
-            while( true ){
-                y.next();
-                if( y.event.type == YAML_MAPPING_END_EVENT )
-                    break;
-                y.done();
-            }
-        }
+        if( !y.pair_from_map( "Dets", &key, &val ) )
+            throw string( "invalid Det angle entry" );
+        if( key != "angle" )
+            throw string ( "missing angle" );
+        if( mystd::any2dbl( val, &num ) )
+            throw string( "Dets:angles: invalid value " ) + val;
+        if( !y.pair_from_map( "Dets", &key, &val ) )
+            throw string( "invalid Det path_offset entry" );
+        y.checktype( YAML_MAPPING_END_EVENT, "Dets: end of map" );
+        angles.push_back( num );
     }
     y.done();
+    if( angles.size()!=ndet )
+        throw string( "ndet inconsistent" );
 
-    y.checkvalue( "Detectors" );
-    y.checktype( YAML_MAPPING_START_EVENT, "Detectors: no map\n" );
-    y.checkvalue( "note" );
-    y.skipvalues( 1 );
-    y.checkvalue( "angles" );
-    y.checktype( YAML_SEQUENCE_START_EVENT, "Dets:angles: no seq\n" );
+    y.checkvalue( "EnergyHistograms" );
+    y.checktype( YAML_SEQUENCE_START_EVENT, "E-Hist: no seq\n" );
     while( true ){
         y.next();
         if( y.event.type == YAML_SEQUENCE_END_EVENT )
             break;
-        if( y.event.type != YAML_SCALAR_EVENT )
-            throw string ( "Dets:angles: no scalar" );
-        val = (const char*)y.event.data.scalar.value;
+        if( y.event.type != YAML_SEQUENCE_START_EVENT )
+            throw string ( "E-Hist: seq: no seq" );
         y.done();
+        val = y.getscalar( "x-value" );
         if( mystd::any2dbl( val, &num ) )
-            throw "Dets:angles: invalid value " + val;
+            throw string( "E-Hist: invalid x-value " ) + val;
+        for( int i=0; i<4; ++i )
+            rawdata[i].push_back( num );
+        for( int i=0; i<4; ++i ){
+            val = y.getscalar( "cnts line" );
+            if( mystd::str2vec( val, &numvec ) )
+                throw string( "cnts line extraction failed" );
+            if( numvec.size()!=ndet )
+                throw string( "hist: ndet incompatibility" );
+            for( int ii=0; ii<numvec.size(); ++ii )
+                rawdata[i].push_back( numvec[ii] );
+        }
+        for( int i=0; i<4; ++i ){
+            val = y.getscalar( "time line" );
+            if( mystd::str2vec( val, &numvec ) )
+                throw string( "time line extraction failed" );
+            for( int ii=0; ii<numvec.size(); ++ii )
+                rawdata[i].push_back( numvec[ii] );
+        }
     }
     y.done();
- 
-    key = y.getscalar( "Note ?" );
+
 }    
 
 // Read raw data file, store contents as class variables
@@ -438,6 +418,7 @@ void NRSSM::ReadScan( int format, int flag )
             if (F_in) fclose(F_in);
             return;
         }
+        ret = 0;
     } else {
         printf( "invalid format" );
         return;
diff --git a/src/yamc.cpp b/src/yamc.cpp
index 3d8d9f52fd0bedd8feb361e7a4cc72cc9aba170e..77c997bce84921e18d21e7735ceb834f9c970447 100644
--- a/src/yamc.cpp
+++ b/src/yamc.cpp
@@ -84,7 +84,7 @@ bool CYamlRead::scalar_from_seq( string seqname, string *ret )
     return true;
 }
 
-bool CYamlRead::line_from_map( string mapname, string *ret )
+bool CYamlRead::pair_from_map( string mapname, string *key, string *val )
 {
     next();
     if( event.type == YAML_MAPPING_END_EVENT ){
@@ -94,13 +94,13 @@ bool CYamlRead::line_from_map( string mapname, string *ret )
     if( event.type != YAML_SCALAR_EVENT )
         throw string( "No scalar key in mapping " ) + mapname +
             "; last valid entry was \"" + last_valid + "\"";
-    *ret = (const char*)event.data.scalar.value;
+    *key = (const char*)event.data.scalar.value;
     done();
     next();
     if( event.type != YAML_SCALAR_EVENT )
         throw string( "No scalar value in mapping " ) + mapname +
             "; last valid entry was \"" + last_valid + "\"";
-    *ret += string(": ") + (const char*)event.data.scalar.value;
+    *val = (const char*)event.data.scalar.value;
     last_valid = (const char*)event.data.scalar.value;
     done();
     return true;
diff --git a/src/yamc.h b/src/yamc.h
index 0fef933d94f00557a229ee94cd131a12f0bc1f1c..80d1da54773603312d44544740b8b4d335d1c579 100644
--- a/src/yamc.h
+++ b/src/yamc.h
@@ -21,7 +21,7 @@ class CYamlRead {
     void checkvalue( string value );
     void skipvalues( int repet );
     bool scalar_from_seq( string seqname, string *ret );
-    bool line_from_map( string mapname, string *ret );
+    bool pair_from_map( string mapname, string *key, string *val );
     string getscalar( string scalarname );
     bool getCoord( string label, CCoord *co );
 };