diff --git a/src/format.h b/src/format.h
index 26f093c5ac14f14d525727dad78c3d3bfa1100e0..854b9173fe07404fbec87ffd211ba52987851dc2 100644
--- a/src/format.h
+++ b/src/format.h
@@ -14,13 +14,14 @@ struct block1{
 };
 
 struct muon{
-  uint32_t f;
-  uint32_t s;
+  uint32_t f; //first word
+  uint32_t s; //second word
+  uint32_t extra; //for intermediate marker and eta
 };
 
 struct block{
-  uint32_t orbit;
   uint32_t bx;
+  uint32_t orbit;
   muon mu[16];
 };
 
diff --git a/src/processor.cc b/src/processor.cc
index 8bfb17deef49258a567cf8ff27df38344c9890f7..484cc2556569dad0764ecb7232d4412554f85be7 100644
--- a/src/processor.cc
+++ b/src/processor.cc
@@ -2,118 +2,130 @@
 #include "format.h"
 #include "slice.h"
 #include "log.h"
+#include <iomanip>
 
 StreamProcessor::StreamProcessor(size_t max_size_, bool doZS_) : 
-  tbb::filter(parallel),
-  max_size(max_size_),
-  nbPackets(0),
-  doZS(doZS_)
+	tbb::filter(parallel),
+	max_size(max_size_),
+	nbPackets(0),
+	doZS(doZS_)
 { 
-  LOG(TRACE) << "Created transform filter at " << static_cast<void*>(this);
+	LOG(TRACE) << "Created transform filter at " << static_cast<void*>(this);
+	myfile.open ("example.txt");
 }  
 
 
 StreamProcessor::~StreamProcessor(){
-  //  fprintf(stderr,"Wrote %d muons \n",totcount);
+	//  fprintf(stderr,"Wrote %d muons \n",totcount);
+	myfile.close();
 }
 
 Slice* StreamProcessor::process(Slice& input, Slice& out)
 {
-  nbPackets++;
-  int bsize = sizeof(block1);
-  if((input.size()-constants::orbit_trailer_size)%bsize!=0){
-    LOG(WARNING)
-      << "Frame size not a multiple of block size. Will be skipped. Size="
-	    << input.size() << " - block size=" << bsize;
-    return &out;
-  }
-  char* p = input.begin();
-  char* q = out.begin();
-  uint32_t counts = 0;
+	nbPackets++;
+	int bsize = sizeof(block1);
+	if((input.size()-constants::orbit_trailer_size)%bsize!=0){
+		LOG(WARNING)
+			<< "Frame size not a multiple of block size. Will be skipped. Size="
+			<< input.size() << " - block size=" << bsize;
+		return &out;
+	}
+	char* p = input.begin();
+	char* q = out.begin();
+	uint32_t counts = 0;
 
-  
-  while(p!=input.end()){
-    bool endoforbit = false;
-    block1 *bl = (block1*)p;
-    int mAcount = 0;
-    int mBcount = 0;
-    uint32_t bxmatch=0;
-    uint32_t orbitmatch=0;
 
-    bool AblocksOn[8];
-    bool BblocksOn[8];
+	while(p!=input.end()){
+		bool endoforbit = false;
+		block1 *bl = (block1*)p;
+		int mAcount = 0;
+		int mBcount = 0;
+		uint32_t bxmatch=0;
+		uint32_t orbitmatch=0;
 
-    for(unsigned int i = 0; i < 8; i++){
-      if(bl->bx[i]==constants::deadbeef){
-	p += constants::orbit_trailer_size;
-	endoforbit = true;
-	break;
-      }
-      uint32_t bx = (bl->bx[i] >> shifts::bx) & masks::bx;
-      uint32_t interm = (bl->bx[i] >> shifts::interm) & masks::interm;
-      bl->mu1f[i] |= interm == constants::intermediate_marker ?
-	(constants::intermediate & masks::interm)<<shifts::interm :
-	(constants::final        & masks::interm)<<shifts::interm;
-      bl->mu2f[i] |= interm == constants::intermediate_marker ?
-	(constants::intermediate & masks::interm)<<shifts::interm :
-	(constants::final        & masks::interm)<<shifts::interm;
-      bxmatch += (bx==((bl->bx[0] >> shifts::bx) & masks::bx))<<i;
-      uint32_t orbit = bl->orbit[i];
-      orbitmatch += (orbit==bl->orbit[0])<<i;
-      uint32_t pt = (bl->mu1f[i] >> shifts::pt) & masks::pt;
-      AblocksOn[i]=(pt>0 || (doZS==0));
-      if(pt>0 || (doZS==0)){
-	mAcount++;
-      }
-      pt = (bl->mu2f[i] >> shifts::pt) & masks::pt;
-      BblocksOn[i]=(pt>0 || (doZS==0));
-      if(pt>0 || (doZS==0)){
-	mBcount++;
-      }
-    }
-    if(endoforbit) continue;
-    uint32_t bxcount = std::max(mAcount,mBcount);
-    if(bxcount == 0) {
-      p+=bsize;
-      LOG(WARNING) << '#' << nbPackets << ": Detected a bx with zero muons, this should not happen. Packet is skipped."; 
-      continue;
-    }
+		bool AblocksOn[8];
+		bool BblocksOn[8];
+		for(unsigned int i = 0; i < 8; i++){
+			if(bl->orbit[i]==constants::deadbeef){
+				p += constants::orbit_trailer_size;
+				endoforbit = true;
+				break;
+			}
+			uint32_t bx = (bl->bx[i] >> shifts::bx) & masks::bx;
+			uint32_t interm = (bl->bx[i] >> shifts::interm) & masks::interm;
+			uint32_t orbit = bl->orbit[i];
+		//	std::cout << bx << "," << orbit << "," << interm << std::endl;
+//		std::cout << std::hex << bl->mu1f[i] << std::endl;	
+/*			bl->mu1f[i] |= interm == constants::intermediate_marker ?
+				(constants::intermediate & masks::interm)<<shifts::interm :
+				(constants::final        & masks::interm)<<shifts::interm;
+			bl->mu2f[i] |= interm == constants::intermediate_marker ?
+				(constants::intermediate & masks::interm)<<shifts::interm :
+				(constants::final        & masks::interm)<<shifts::interm;
+*/
+			bxmatch += (bx==((bl->bx[0] >> shifts::bx) & masks::bx))<<i;
+			orbitmatch += (orbit==bl->orbit[0])<<i; 
+			uint32_t pt = (bl->mu1f[i] >> shifts::pt) & masks::pt;
+			uint32_t etae = (bl->mu1f[i] >> shifts::etaext) & masks::eta;
+//			std::cout << bx << "," << orbit << "," << interm << "," << etae << std::endl;
+			
+			AblocksOn[i]=(pt>0 || (doZS==0));
+			if(pt>0 || (doZS==0)){
+				mAcount++;
+			}
+			pt = (bl->mu2f[i] >> shifts::pt) & masks::pt;
+			BblocksOn[i]=(pt>0 || (doZS==0));
+			if(pt>0 || (doZS==0)){
+				mBcount++;
+			}
+		}
+		if(endoforbit) continue;
+		uint32_t bxcount = std::max(mAcount,mBcount);
+		if(bxcount == 0) {
+			p+=bsize;
+			LOG(WARNING) << '#' << nbPackets << ": Detected a bx with zero muons, this should not happen. Packet is skipped."; 
+			continue;
+		}
 
-    uint32_t header = (bxmatch<<24)+(mAcount << 16) + (orbitmatch<<8) + mBcount;
+		uint32_t header = (bxmatch<<24)+(mAcount << 16) + (orbitmatch<<8) + mBcount;
 
-    counts += mAcount;
-    counts += mBcount;
-    memcpy(q,(char*)&header,4); q+=4;
-    memcpy(q,(char*)&bl->bx[0],4); q+=4;
-    memcpy(q,(char*)&bl->orbit[0],4); q+=4;
-    for(unsigned int i = 0; i < 8; i++){
-      if(AblocksOn[i]){
-	memcpy(q,(char*)&bl->mu1f[i],4); q+=4;
-	memcpy(q,(char*)&bl->mu1s[i],4); q+=4;
-      }
-    }
-    for(unsigned int i = 0; i < 8; i++){
-      if(BblocksOn[i]){
-	memcpy(q,(char*)&bl->mu2f[i],4); q+=4;
-	memcpy(q,(char*)&bl->mu2s[i],4); q+=4;
-      }
-    }
-    p+=sizeof(block1);
+		counts += mAcount;
+		counts += mBcount;
+		memcpy(q,(char*)&header,4); q+=4;
+		memcpy(q,(char*)&bl->bx[0],4); q+=4;
+		memcpy(q,(char*)&bl->orbit[0],4); q+=4;
+		for(unsigned int i = 0; i < 8; i++){
+			if(AblocksOn[i]){
+				memcpy(q,(char*)&bl->mu1f[i],4); q+=4;
+				memcpy(q,(char*)&bl->mu1s[i],4); q+=4;
+				//memcpy(q,(char*)&(bl->bx[i] &= ~0x1),4); q+=4; //set bit 0 to 0 for first muon
+				memcpy(q,(char*)&(bl->bx[i]),4); q+=4; //set bit 0 to 0 for first muon
+			}
+		}
+		for(unsigned int i = 0; i < 8; i++){
+			if(BblocksOn[i]){
+				memcpy(q,(char*)&bl->mu2f[i],4); q+=4;
+				memcpy(q,(char*)&bl->mu2s[i],4); q+=4;
+				//memcpy(q,(char*)&(bl->bx[i] |= 0x1),4); q+=4; //set bit 0 to 1 for second muon
+				memcpy(q,(char*)&(bl->bx[i]),4); q+=4; //set bit 0 to 1 for second muon
+			}
+		}
+		p+=sizeof(block1);
 
-  }
+	}
 
 
-    out.set_end(q);
-    out.set_counts(counts);
-    return &out;  
+	out.set_end(q);
+	out.set_counts(counts);
+	return &out;  
 }
 
 void* StreamProcessor::operator()( void* item ){
-  Slice& input = *static_cast<Slice*>(item);
-  Slice& out = *Slice::allocate( 2*max_size);
+	Slice& input = *static_cast<Slice*>(item);
+	Slice& out = *Slice::allocate( 2*max_size);
 
-  process(input, out);
+	process(input, out);
 
-  Slice::giveAllocated(&input);
-  return &out;
+	Slice::giveAllocated(&input);
+	return &out;
 }
diff --git a/src/processor.h b/src/processor.h
index b44921cbfe3803f511a14bdf9e569ebdca49eb95..22d41659453a1f8a88376b16cc006bc14ea91b0e 100644
--- a/src/processor.h
+++ b/src/processor.h
@@ -3,6 +3,8 @@
 
 #include "tbb/pipeline.h"
     
+#include <iostream>
+#include <fstream>
 //reformatter
 
 class Slice;
@@ -15,7 +17,8 @@ public:
 
 private:
   Slice* process(Slice& input, Slice& out);
-
+  
+  std::ofstream myfile;
 private:
   size_t max_size;
   uint64_t nbPackets;
diff --git a/src/scdaq.conf b/src/scdaq.conf
index 6d2b927bbb152b298632dbf3c5e6865e81a1a12c..d33c58d26984087fcd332885cd79748ac3f7cc6a 100644
--- a/src/scdaq.conf
+++ b/src/scdaq.conf
@@ -52,4 +52,4 @@ enable_stream_processor:yes
 enable_elastic_processor:no
 
 # Enable software zero-supression
-doZS:no
+doZS:yes