          bool hasMate = false, bool firstInPair = false, Read * mate = NULL, 
          AlignmentResult mateResult = NotFound, GenomeLocation mateLocation = 0, Direction mateDirection = FORWARD,
          bool alignedAsPair = false) const; 
+diff -rupN -x Xcode -x .git tmp/snap/SNAPLib/SortedDataWriter.cpp snap/SNAPLib/SortedDataWriter.cpp
+--- tmp/snap/SNAPLib/SortedDataWriter.cpp	2016-01-18 14:51:10.000000000 -0500
++++ snap/SNAPLib/SortedDataWriter.cpp	2016-01-18 14:44:34.000000000 -0500
+@@ -335,7 +335,7 @@ SortedDataFilterSupplier::mergeSort()
+     }
+     for (SortBlockVector::iterator i = blocks.begin(); i != blocks.end(); i++) {
+         i->reader = readerSupplier->getDataReader(1, MAX_READ_LENGTH * 8, 0.0,
+-            min(1UL << 23, max(1UL << 17, bufferSpace / blocks.size()))); // 128kB to 8MB buffer space per block
++            min(1ULL << 23, max(1ULL << 17, bufferSpace / blocks.size()))); // 128kB to 8MB buffer space per block
+         i->reader->init(tempFileName);
+         i->reader->reinit(i->start, i->bytes);
+     }
+diff -rupN -x Xcode -x .git tmp/snap/SNAPLib/directions.h snap/SNAPLib/directions.h
+--- tmp/snap/SNAPLib/directions.h	2016-01-18 14:51:10.000000000 -0500
++++ snap/SNAPLib/directions.h	2015-10-12 16:54:59.000000000 -0400
+@@ -33,4 +33,4 @@ const int RC = 1;
+ inline Direction OppositeDirection(Direction direction) {
+     _ASSERT(FORWARD == direction || RC == direction);
+     return 1-direction;
+-}
+\ No newline at end of file
++}

             result->status[whichRead] = result->mapq[whichRead] > MAPQ_LIMIT_FOR_SINGLE_HIT ? SingleHit : MultipleHits;
             result->score[whichRead] = bestResultScore[whichRead];
diff -rupN -x Xcode -x .git tmp/snap/SNAPLib/ReadWriter.cpp snap/SNAPLib/ReadWriter.cpp
--- tmp/snap/SNAPLib/ReadWriter.cpp	2015-07-28 15:15:02.000000000 -0400
+++ snap/SNAPLib/ReadWriter.cpp	2015-07-28 15:36:56.000000000 -0400
@@ -174,7 +174,9 @@ SimpleReadWriter::writeReads(
             finalLocations[whichResult] = results[whichResult].location;

+struct TS_MapqEstimationFeatures {
+	
+	TS_MapqEstimationFeatures() :
+	bestPossible(0),
+	bestScore(0),
+	secondBestScore(0),
+	probabilityOfAllCandidates(0.0),
