 +  bam_free_list2_t bam_free_list2;
 +
 +  int page_out;
-+  size_t max_cache_size;	// max bytes to keep bam1_t data in the main memory
-+  size_t cur_cache_size;
++//  size_t max_cache_size;	// max bytes to keep bam1_t data in the main memory
++//  size_t cur_cache_size;
 +//  volatile uint32_t bam_vaddr_seqid;
 +  long prof_n_spn;
 +} mt_bamcopy_t;

+      }
+      break;
+    }
+  }
+
+  bgzf->uncompressed_block = mt->orig_uncompressed_block;
+
+  return NULL;
+}
+
+static mt_blkrd_t mt_blkrd;
+static mt_blkrd_t * mt_blkrd_init(mt_linesplit_t *linesplit, samFile *fp) {
+  pthread_attr_t attr;
+  pthread_attr_init(&attr);
+  mt_blkrd_t *blkrd = &mt_blkrd;
+  blkrd->fp = fp;
+  blkrd->linesplit = linesplit;
+  blkrd->w = md_malloc(sizeof(blkrd->w[0])*n_block_reader, mem_blkrdInit, 1);
+  blkrd->read_bytes = 0;

+  mt_sort_sam_t *ss;
+} ss_worker_t;
+
+static int picard_sortsam_cmpfunc_clip(const void * v1, const void * v2, void * args) ;
+
+static void mt_sam_sorter__(int tidx, mt_sort_sam_t * ss) {
+  bucket_array_t * const ba = ss->bucket_array;
+  int const n_threads = ss->n_threads;
