[med-svn] [bedops] 01/03: New upstream version 2.4.28+dfsg

Steffen Möller moeller at moszumanska.debian.org
Fri Oct 20 21:58:30 UTC 2017


This is an automated email from the git hooks/post-receive script.

moeller pushed a commit to branch master
in repository bedops.

commit 2763b0f4eabe7c60665d1c70579b2fd2a475b48c
Author: Steffen Moeller <moeller at debian.org>
Date:   Mon Sep 11 14:23:30 2017 +0200

    New upstream version 2.4.28+dfsg
---
 .gitignore                                         |    8 +
 .travis.yml                                        |    4 +-
 Makefile                                           |  368 +++-
 README.md                                          |   19 +-
 applications/bed/bedextract/src/ExtractRows.cpp    |   51 +-
 applications/bed/bedextract/src/Makefile           |   24 +-
 applications/bed/bedextract/src/Makefile.darwin    |   28 +-
 applications/bed/bedmap/doc/known.issues           |   33 -
 applications/bed/bedmap/src/Bedmap.cpp             |  465 +++--
 applications/bed/bedmap/src/Input.hpp              |    6 +-
 applications/bed/bedmap/src/Makefile               |   21 +-
 applications/bed/bedmap/src/Makefile.darwin        |   27 +-
 applications/bed/bedmap/src/TDefs.hpp              |    2 +-
 .../bed/bedops/doc/Usage.Statement.Version1.2      |   35 -
 applications/bed/bedops/src/BedPadReader.hpp       |   18 +-
 applications/bed/bedops/src/Bedops.cpp             |  315 ++--
 applications/bed/bedops/src/Makefile               |   21 +-
 applications/bed/bedops/src/Makefile.darwin        |   29 +-
 applications/bed/closestfeats/src/BedReader.hpp    |   17 +-
 .../bed/closestfeats/src/ClosestFeature.cpp        |   89 +-
 applications/bed/closestfeats/src/Makefile         |   21 +-
 applications/bed/closestfeats/src/Makefile.darwin  |   29 +-
 applications/bed/conversion/src/Makefile           |   42 +-
 applications/bed/conversion/src/Makefile.darwin    |   32 +-
 applications/bed/conversion/src/convert2bed.c      | 1812 ++++++++++++++------
 applications/bed/conversion/src/convert2bed.h      |  686 ++++----
 .../bed/conversion/src/tests/bam/split2.bam        |  Bin 0 -> 1388 bytes
 .../bed/conversion/src/tests/bam/split2.sam        |   29 +
 applications/bed/conversion/src/wrappers/bam2bed   |   18 +-
 .../bed/conversion/src/wrappers/bam2starch         |   18 +-
 applications/bed/conversion/src/wrappers/sam2bed   |   18 +-
 .../bed/conversion/src/wrappers/sam2starch         |   18 +-
 applications/bed/sort-bed/src/CheckSort.cpp        |   10 +-
 applications/bed/sort-bed/src/Makefile             |   68 +-
 applications/bed/sort-bed/src/Makefile.darwin      |  101 +-
 applications/bed/sort-bed/src/Sort.cpp             |   33 +-
 applications/bed/sort-bed/src/SortDetails.cpp      |    8 +-
 applications/bed/sort-bed/src/Structures.hpp       |    3 -
 .../src/update-sort-bed-migrate-candidates.py      |    2 +-
 .../bed/sort-bed/src/update-sort-bed-slurm.py      |    2 +-
 .../sort-bed/src/update-sort-bed-starch-slurm.py   |    4 +-
 applications/bed/starch/src/Makefile               |   70 +-
 applications/bed/starch/src/Makefile.darwin        |   93 +-
 applications/bed/starch/src/starch-diff.py         |   11 +-
 applications/bed/starch/src/starch.c               |   40 +-
 applications/bed/starch/src/starch.h               |   10 +
 applications/bed/starch/src/starchcat.c            |  704 +++++---
 applications/bed/starch/src/starchcat.h            |   13 +
 .../bed/starch/src/starchcluster_gnuParallel.tcsh  |    2 +-
 applications/bed/starch/src/starchcluster_sge.tcsh |    2 +-
 .../bed/starch/src/starchcluster_slurm.tcsh        |    2 +-
 applications/bed/starch/src/starchstrip.c          |  184 +-
 applications/bed/starch/src/starchstrip.h          |   10 +
 applications/bed/starch/src/unstarch.c             |  364 ++--
 applications/bed/starch/src/unstarch.h             |   19 +-
 applications/other/switch-BEDOPS-binary-type       |   76 +
 docs/conf.py                                       |    2 +-
 docs/content/installation.rst                      |   56 +-
 .../reference/file-management/compression.rst      |    2 +-
 .../file-management/compression/starch-diff.rst    |    2 +-
 .../file-management/compression/starch.rst         |    2 +-
 .../file-management/compression/starchcat.rst      |    2 +-
 .../file-management/compression/starchstrip.rst    |    4 +-
 .../file-management/compression/unstarch.rst       |    2 +-
 .../file-management/conversion/gtf2bed.rst         |   12 +-
 .../file-management/conversion/psl2bed.rst         |    2 +-
 .../file-management/conversion/vcf2bed.rst         |    2 +-
 .../reference/file-management/sorting/sort-bed.rst |    2 +-
 .../reference/set-operations/bedextract.rst        |    2 +-
 docs/content/reference/set-operations/bedops.rst   |    2 +-
 .../reference/set-operations/closest-features.rst  |    2 +-
 docs/content/reference/statistics/bedmap.rst       |   11 +-
 docs/content/release.rst                           |   20 +-
 docs/content/revision-history.rst                  |  120 +-
 docs/content/usage-examples/snps-within-dhses.rst  |    2 +-
 docs/index.rst                                     |   18 +-
 .../general-headers/algorithm/bed/FindBedRange.hpp |   59 +-
 .../algorithm/visitors/Visitors.hpp                |    4 +-
 .../algorithm/visitors/bed/BedBaseVisitor.hpp      |    8 +-
 .../visitors/helpers/ProcessBedVisitorRow.hpp      |   21 +-
 .../visitors/numerical/ExtremeVisitor.hpp          |    2 +-
 .../algorithm/visitors/other/MultiVisitor.hpp      |   12 +-
 .../data/bed/AllocateIterator_BED_starch.hpp       |   73 +-
 ....hpp => AllocateIterator_BED_starch_minmem.hpp} |   42 +-
 interfaces/general-headers/data/bed/Bed.hpp        |  556 +++---
 .../general-headers/data/bed/BedCheckIterator.hpp  |  134 +-
 ...eckIterator.hpp => BedCheckIterator_minmem.hpp} |   60 +-
 interfaces/general-headers/data/bed/BedCompare.hpp |  109 +-
 interfaces/general-headers/data/bed/BedTypes.hpp   |   39 +-
 interfaces/general-headers/data/bed/Bed_minmem.hpp |  917 ++++++++++
 .../general-headers/data/starch/starchApi.hpp      |   38 +-
 .../general-headers/data/starch/starchHelpers.h    |    4 +-
 .../general-headers/suite/BEDOPS.Constants.hpp     |   51 +-
 .../general-headers/suite/BEDOPS.Version.hpp       |    4 +-
 .../utility/{PooledMemory.hpp => BitMonitor.hpp}   |  381 ++--
 .../general-headers/utility/CharPooledMemory.hpp   |  521 ++++++
 .../{SingletonType.hpp => CompilerMath.hpp}        |   41 +-
 .../general-headers/utility/PooledMemory.hpp       |  365 +---
 interfaces/general-headers/utility/PrintTypes.hpp  |   24 +-
 .../general-headers/utility/SingletonType.hpp      |   18 +-
 interfaces/general-headers/utility/Typify.hpp      |   24 +-
 interfaces/src/algorithm/sweep/WindowSweepImpl.cpp |   79 +-
 .../algorithm/sweep/WindowSweepImpl.specialize.cpp |   24 +-
 interfaces/src/data/starch/starchHelpers.c         |  177 +-
 interfaces/src/data/starch/starchMetadataHelpers.c |   17 +-
 interfaces/src/data/starch/starchSha1Digest.c      |  342 ++--
 interfaces/src/data/starch/unstarchHelpers.c       |   52 +-
 interfaces/src/utility/SingletonType.cpp           |   14 +
 packaging/deb/Dockerfile                           |    8 +-
 packaging/deb/control                              |    2 +-
 packaging/os_x/BEDOPS.pkgproj                      | 1197 ++++++++++++-
 packaging/rpm/Dockerfile                           |   12 +-
 packaging/rpm/bedops.spec                          |    2 +-
 system.mk/Makefile.darwin                          |  303 +---
 system.mk/Makefile.linux                           |  149 +-
 115 files changed, 8235 insertions(+), 4051 deletions(-)

diff --git a/.gitignore b/.gitignore
index 3398ce1..7b357b1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -61,3 +61,11 @@ tramp
 # OS X stuff
 .DS_Store
 __MACOSX
+
+applications/bed/bedextract/bin/
+applications/bed/bedmap/bin/
+applications/bed/bedops/bin/
+applications/bed/closestfeats/bin/
+applications/bed/conversion/bin/
+applications/bed/sort-bed/bin/
+applications/bed/starch/bin/
\ No newline at end of file
diff --git a/.travis.yml b/.travis.yml
index ec53eeb..b7ddbd7 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -15,5 +15,5 @@ install:
   - if [[ "$CXX" == "g++" ]]; then if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install -qq g++-4.8; fi; fi
   - if [[ "$CXX" == "g++" ]]; then if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 50; fi; fi
 script: 
-  - if [[ "$CC" == "gcc" ]]; then if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then make -j4; fi; fi
-  - if [[ "$CC" == "clang" ]]; then if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then make -j4; fi; fi
\ No newline at end of file
+  - if [[ "$CC" == "gcc" ]]; then if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then make all; fi; fi
+  - if [[ "$CC" == "clang" ]]; then if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then make all; fi; fi
\ No newline at end of file
diff --git a/Makefile b/Makefile
index cc0d879..b5fb8fb 100644
--- a/Makefile
+++ b/Makefile
@@ -1,17 +1,30 @@
-export KERNEL   := ${shell uname -a | cut -f1 -d' '}
-APPDIR           = applications/bed
-BINDIR           = bin
-OSXPKGROOT       = packaging/os_x
-OSXBUILDDIR      = ${OSXPKGROOT}/build
-OSXPKGDIR        = ${OSXPKGROOT}/resources/bin
-OSXLIBDIR        = ${OSXPKGROOT}/resources/lib
-
+export KERNEL        := ${shell uname -a | cut -f1 -d' '}
+APPDIR                = applications/bed
+OTHERDIR              = applications/other
+OSXPKGROOT            = packaging/os_x
+OSXBUILDDIR           = ${OSXPKGROOT}/build
+OSXPKGDIR             = ${OSXPKGROOT}/resources/bin
+OSXLIBDIR             = ${OSXPKGROOT}/resources/lib
+SELF                  = ${shell pwd}/Makefile
+MASSIVE_REST_EXP      = 22
+MASSIVE_ID_EXP        = 14
+MASSIVE_CHROM_EXP     = 8
+JPARALLEL             = 8
+MEGAROW               = megarow
+TYPICAL               = typical
+DEFAULT_BINARY_TYPE   = ${TYPICAL} 
+WRAPPERS              = $(wildcard ${APPDIR}/conversion/src/wrappers/*)
+CWD                  := $(shell pwd)
+BINDIR                = bin
+BINDIR_MODULE         = modules
+BINDIR_MODULE_TYPICAL = ${BINDIR_MODULE}/${TYPICAL}
+BINDIR_MODULE_MEGAROW = ${BINDIR_MODULE}/${MEGAROW}
 
 default:
 ifeq ($(KERNEL), Darwin)
-	$(MAKE) $(MAKECMDGOALS) -f system.mk/Makefile.darwin
+	$(MAKE) $(MAKECMDGOALS) -j $(JPARALLEL) -f system.mk/Makefile.darwin
 else
-	$(MAKE) $(MAKECMDGOALS) -f system.mk/Makefile.linux
+	$(MAKE) $(MAKECMDGOALS) -j $(JPARALLEL) -f system.mk/Makefile.linux
 endif
 
 clean: default
@@ -22,23 +35,173 @@ debug: default
 
 gprof: default
 
-install: prep_c install_conversion_scripts install_starch_scripts
-	-cp ${APPDIR}/sort-bed/bin/sort-bed ${BINDIR}/
-	-cp ${APPDIR}/sort-bed/bin/update-sort-bed-slurm ${BINDIR}/
-	-cp ${APPDIR}/sort-bed/bin/update-sort-bed-starch-slurm ${BINDIR}/
-	-cp ${APPDIR}/sort-bed/bin/update-sort-bed-migrate-candidates ${BINDIR}/
-	-cp ${APPDIR}/bedops/bin/bedops ${BINDIR}/
-	-cp ${APPDIR}/closestfeats/bin/closest-features ${BINDIR}/
-	-cp ${APPDIR}/bedmap/bin/bedmap ${BINDIR}/
-	-cp ${APPDIR}/bedextract/bin/bedextract ${BINDIR}/
-	-cp ${APPDIR}/starch/bin/starch ${BINDIR}/
-	-cp ${APPDIR}/starch/bin/unstarch ${BINDIR}/
-	-cp ${APPDIR}/starch/bin/starchcat ${BINDIR}/
-	-cp ${APPDIR}/starch/bin/starchstrip ${BINDIR}/
-	-cp ${APPDIR}/conversion/bin/convert2bed ${BINDIR}/
+all:
+	$(MAKE) support -f ${SELF}
+	$(MAKE) typical -f ${SELF}
+	$(MAKE) megarow -f ${SELF}
+	$(MAKE) install_all -f ${SELF}
+	$(MAKE) symlink_typical -f ${SELF}
+
+module_all:
+	$(MAKE) support -f ${SELF}
+	$(MAKE) typical -f ${SELF}
+	$(MAKE) megarow -f ${SELF}
+	$(MAKE) install_all -f ${SELF}
+	$(MAKE) module_binaries -f ${SELF}
+
+megarow:
+	$(MAKE) BINARY_TYPE=$(MEGAROW) BINARY_TYPE_NUM=1 POSTFIX=-$(MEGAROW) MEGAFLAGS="-DREST_EXPONENT=${MASSIVE_REST_EXP} -DID_EXPONENT=${MASSIVE_ID_EXP} -DCHROM_EXPONENT=${MASSIVE_CHROM_EXP}" -f ${SELF}
+
+typical:
+	$(MAKE) BINARY_TYPE=$(TYPICAL) BINARY_TYPE_NUM=0 POSTFIX=-$(TYPICAL) -f ${SELF}
+
+symlink_typical:
+	$(eval variablename=`find $(BINDIR)/ -maxdepth 1 -mindepth 1 -type f -name '*$(TYPICAL)' -print0 | xargs -L1 -0 -I{} sh -c 'basename {}'`)
+	for i in ${variablename}; do \
+		fooname=`echo $$i | sed 's/-$(TYPICAL)//'`; \
+		echo $${fooname}; \
+		ln -sf $$i $(BINDIR)/$${fooname}; \
+	done
 
+symlink_megarow:
+	$(eval variablename=`find $(BINDIR)/ -maxdepth 1 -mindepth 1 -type f -name '*$(MEGAROW)' -print0 | xargs -L1 -0 -I{} sh -c 'basename {}'`)
+	for i in ${variablename}; do \
+		fooname=`echo $$i | sed 's/-$(MEGAROW)//'`; \
+		echo $${fooname}; \
+		ln -sf $$i $(BINDIR)/$${fooname}; \
+	done
 
+install: prep_c install_conversion_scripts install_starch_scripts
+	-cp ${APPDIR}/sort-bed/bin/sort-bed- ${BINDIR}/sort-bed
+	-cp ${APPDIR}/sort-bed/bin/update-sort-bed-slurm- ${BINDIR}/update-sort-bed-slurm
+	-cp ${APPDIR}/sort-bed/bin/update-sort-bed-starch-slurm- ${BINDIR}/update-sort-bed-starch-slurm
+	-cp ${APPDIR}/sort-bed/bin/update-sort-bed-migrate-candidates- ${BINDIR}/update-sort-bed-migrate-candidates
+	-cp ${APPDIR}/bedops/bin/bedops- ${BINDIR}/bedops
+	-cp ${APPDIR}/closestfeats/bin/closest-features- ${BINDIR}/closest-features
+	-cp ${APPDIR}/bedmap/bin/bedmap- ${BINDIR}/bedmap
+	-cp ${APPDIR}/bedextract/bin/bedextract- ${BINDIR}/bedextract
+	-cp ${APPDIR}/starch/bin/starch- ${BINDIR}/starch
+	-cp ${APPDIR}/starch/bin/unstarch- ${BINDIR}/unstarch
+	-cp ${APPDIR}/starch/bin/starchcat- ${BINDIR}/starchcat
+	-cp ${APPDIR}/starch/bin/starchstrip- ${BINDIR}/starchstrip
+	-cp ${APPDIR}/conversion/bin/convert2bed- ${BINDIR}/convert2bed
+
+install_all: install_conversion_scripts_with_suffix install_starch_scripts_with_suffix
+	-cp ${APPDIR}/sort-bed/bin/sort-bed-$(MEGAROW) ${BINDIR}/sort-bed-$(MEGAROW)
+	-cp ${APPDIR}/sort-bed/bin/update-sort-bed-slurm-$(MEGAROW) ${BINDIR}/update-sort-bed-slurm-$(MEGAROW)
+	-cp ${APPDIR}/sort-bed/bin/update-sort-bed-starch-slurm-$(MEGAROW) ${BINDIR}/update-sort-bed-starch-slurm-$(MEGAROW)
+	-cp ${APPDIR}/sort-bed/bin/update-sort-bed-migrate-candidates-$(MEGAROW) ${BINDIR}/update-sort-bed-migrate-candidates-$(MEGAROW)
+	-cp ${APPDIR}/bedops/bin/bedops-$(MEGAROW) ${BINDIR}/bedops-$(MEGAROW)
+	-cp ${APPDIR}/closestfeats/bin/closest-features-$(MEGAROW) ${BINDIR}/closest-features-$(MEGAROW)
+	-cp ${APPDIR}/bedmap/bin/bedmap-$(MEGAROW) ${BINDIR}/bedmap-$(MEGAROW)
+	-cp ${APPDIR}/bedextract/bin/bedextract-$(MEGAROW) ${BINDIR}/bedextract-$(MEGAROW)
+	-cp ${APPDIR}/starch/bin/starch-$(MEGAROW) ${BINDIR}/starch-$(MEGAROW)
+	-cp ${APPDIR}/starch/bin/unstarch-$(MEGAROW) ${BINDIR}/unstarch-$(MEGAROW)
+	-cp ${APPDIR}/starch/bin/starchcat-$(MEGAROW) ${BINDIR}/starchcat-$(MEGAROW)
+	-cp ${APPDIR}/starch/bin/starchstrip-$(MEGAROW) ${BINDIR}/starchstrip-$(MEGAROW)
+	-cp ${APPDIR}/conversion/bin/convert2bed-$(MEGAROW) ${BINDIR}/convert2bed-$(MEGAROW)
+	-cp ${APPDIR}/sort-bed/bin/sort-bed-$(TYPICAL) ${BINDIR}/sort-bed-$(TYPICAL)
+	-cp ${APPDIR}/sort-bed/bin/update-sort-bed-slurm-$(TYPICAL) ${BINDIR}/update-sort-bed-slurm-$(TYPICAL)
+	-cp ${APPDIR}/sort-bed/bin/update-sort-bed-starch-slurm-$(TYPICAL) ${BINDIR}/update-sort-bed-starch-slurm-$(TYPICAL)
+	-cp ${APPDIR}/sort-bed/bin/update-sort-bed-migrate-candidates-$(TYPICAL) ${BINDIR}/update-sort-bed-migrate-candidates-$(TYPICAL)
+	-cp ${APPDIR}/bedops/bin/bedops-$(TYPICAL) ${BINDIR}/bedops-$(TYPICAL)
+	-cp ${APPDIR}/closestfeats/bin/closest-features-$(TYPICAL) ${BINDIR}/closest-features-$(TYPICAL)
+	-cp ${APPDIR}/bedmap/bin/bedmap-$(TYPICAL) ${BINDIR}/bedmap-$(TYPICAL)
+	-cp ${APPDIR}/bedextract/bin/bedextract-$(TYPICAL) ${BINDIR}/bedextract-$(TYPICAL)
+	-cp ${APPDIR}/starch/bin/starch-$(TYPICAL) ${BINDIR}/starch-$(TYPICAL)
+	-cp ${APPDIR}/starch/bin/unstarch-$(TYPICAL) ${BINDIR}/unstarch-$(TYPICAL)
+	-cp ${APPDIR}/starch/bin/starchcat-$(TYPICAL) ${BINDIR}/starchcat-$(TYPICAL)
+	-cp ${APPDIR}/starch/bin/starchstrip-$(TYPICAL) ${BINDIR}/starchstrip-$(TYPICAL)
+	-cp ${APPDIR}/conversion/bin/convert2bed-$(TYPICAL) ${BINDIR}/convert2bed-$(TYPICAL)
+	-cp ${OTHERDIR}/switch-BEDOPS-binary-type ${BINDIR}/switch-BEDOPS-binary-type
 
+module_binaries:
+	mkdir -p ${BINDIR_MODULE_TYPICAL}
+	-cp ${BINDIR}/sort-bed-$(TYPICAL) ${BINDIR_MODULE_TYPICAL}/sort-bed
+	-cp ${BINDIR}/update-sort-bed-slurm-$(TYPICAL) ${BINDIR_MODULE_TYPICAL}/update-sort-bed-slurm
+	-cp ${BINDIR}/update-sort-bed-starch-slurm-$(TYPICAL) ${BINDIR_MODULE_TYPICAL}/update-sort-bed-starch-slurm
+	-cp ${BINDIR}/update-sort-bed-migrate-candidates-$(TYPICAL) ${BINDIR_MODULE_TYPICAL}/update-sort-bed-migrate-candidates
+	-cp ${BINDIR}/bedops-$(TYPICAL) ${BINDIR_MODULE_TYPICAL}/bedops
+	-cp ${BINDIR}/closest-features-$(TYPICAL) ${BINDIR_MODULE_TYPICAL}/closest-features
+	-cp ${BINDIR}/bedmap-$(TYPICAL) ${BINDIR_MODULE_TYPICAL}/bedmap
+	-cp ${BINDIR}/bedextract-$(TYPICAL) ${BINDIR_MODULE_TYPICAL}/bedextract
+	-cp ${BINDIR}/starch-$(TYPICAL) ${BINDIR_MODULE_TYPICAL}/starch
+	-cp ${BINDIR}/unstarch-$(TYPICAL) ${BINDIR_MODULE_TYPICAL}/unstarch
+	-cp ${BINDIR}/starchcat-$(TYPICAL) ${BINDIR_MODULE_TYPICAL}/starchcat
+	-cp ${BINDIR}/starchstrip-$(TYPICAL) ${BINDIR_MODULE_TYPICAL}/starchstrip
+	-cp ${BINDIR}/starch-diff-$(TYPICAL) ${BINDIR_MODULE_TYPICAL}/starch-diff
+	-cp ${BINDIR}/convert2bed-$(TYPICAL) ${BINDIR_MODULE_TYPICAL}/convert2bed
+	-cp ${BINDIR}/bam2bed-$(TYPICAL) ${BINDIR_MODULE_TYPICAL}/bam2bed
+	-cp ${BINDIR}/gff2bed-$(TYPICAL) ${BINDIR_MODULE_TYPICAL}/gff2bed
+	-cp ${BINDIR}/gtf2bed-$(TYPICAL) ${BINDIR_MODULE_TYPICAL}/gtf2bed
+	-cp ${BINDIR}/gvf2bed-$(TYPICAL) ${BINDIR_MODULE_TYPICAL}/gvf2bed
+	-cp ${BINDIR}/psl2bed-$(TYPICAL) ${BINDIR_MODULE_TYPICAL}/psl2bed
+	-cp ${BINDIR}/rmsk2bed-$(TYPICAL) ${BINDIR_MODULE_TYPICAL}/rmsk2bed
+	-cp ${BINDIR}/sam2bed-$(TYPICAL) ${BINDIR_MODULE_TYPICAL}/sam2bed
+	-cp ${BINDIR}/vcf2bed-$(TYPICAL) ${BINDIR_MODULE_TYPICAL}/vcf2bed
+	-cp ${BINDIR}/wig2bed-$(TYPICAL) ${BINDIR_MODULE_TYPICAL}/wig2bed
+	-cp ${BINDIR}/bam2starch-$(TYPICAL) ${BINDIR_MODULE_TYPICAL}/bam2starch
+	-cp ${BINDIR}/gff2starch-$(TYPICAL) ${BINDIR_MODULE_TYPICAL}/gff2starch
+	-cp ${BINDIR}/gtf2starch-$(TYPICAL) ${BINDIR_MODULE_TYPICAL}/gtf2starch
+	-cp ${BINDIR}/gvf2starch-$(TYPICAL) ${BINDIR_MODULE_TYPICAL}/gvf2starch
+	-cp ${BINDIR}/psl2starch-$(TYPICAL) ${BINDIR_MODULE_TYPICAL}/psl2starch
+	-cp ${BINDIR}/rmsk2starch-$(TYPICAL) ${BINDIR_MODULE_TYPICAL}/rmsk2starch
+	-cp ${BINDIR}/sam2starch-$(TYPICAL) ${BINDIR_MODULE_TYPICAL}/sam2starch
+	-cp ${BINDIR}/vcf2starch-$(TYPICAL) ${BINDIR_MODULE_TYPICAL}/vcf2starch
+	-cp ${BINDIR}/wig2starch-$(TYPICAL) ${BINDIR_MODULE_TYPICAL}/wig2starch
+	-cp ${BINDIR}/bam2bed_sge-$(TYPICAL) ${BINDIR_MODULE_TYPICAL}/bam2bed_sge
+	-cp ${BINDIR}/bam2bed_slurm-$(TYPICAL) ${BINDIR_MODULE_TYPICAL}/bam2bed_slurm
+	-cp ${BINDIR}/bam2bed_gnuParallel-$(TYPICAL) ${BINDIR_MODULE_TYPICAL}/bam2bed_gnuParallel
+	-cp ${BINDIR}/bam2starch_sge-$(TYPICAL) ${BINDIR_MODULE_TYPICAL}/bam2starch_sge
+	-cp ${BINDIR}/bam2starch_slurm-$(TYPICAL) ${BINDIR_MODULE_TYPICAL}/bam2starch_slurm
+	-cp ${BINDIR}/bam2starch_gnuParallel-$(TYPICAL) ${BINDIR_MODULE_TYPICAL}/bam2starch_gnuParallel
+	-cp ${BINDIR}/starchcluster_sge-$(TYPICAL) ${BINDIR_MODULE_TYPICAL}/starchcluster_sge
+	-cp ${BINDIR}/starchcluster_gnuParallel-$(TYPICAL) ${BINDIR_MODULE_TYPICAL}/starchcluster_gnuParallel
+	-cp ${BINDIR}/starchcluster_slurm-$(TYPICAL) ${BINDIR_MODULE_TYPICAL}/starchcluster_slurm
+	-cp ${BINDIR}/starch-diff-$(TYPICAL) ${BINDIR_MODULE_TYPICAL}/starch-diff
+	mkdir -p ${BINDIR_MODULE_MEGAROW}
+	-cp ${BINDIR}/sort-bed-$(MEGAROW) ${BINDIR_MODULE_MEGAROW}/sort-bed
+	-cp ${BINDIR}/update-sort-bed-slurm-$(MEGAROW) ${BINDIR_MODULE_MEGAROW}/update-sort-bed-slurm
+	-cp ${BINDIR}/update-sort-bed-starch-slurm-$(MEGAROW) ${BINDIR_MODULE_MEGAROW}/update-sort-bed-starch-slurm
+	-cp ${BINDIR}/update-sort-bed-migrate-candidates-$(MEGAROW) ${BINDIR_MODULE_MEGAROW}/update-sort-bed-migrate-candidates
+	-cp ${BINDIR}/bedops-$(MEGAROW) ${BINDIR_MODULE_MEGAROW}/bedops
+	-cp ${BINDIR}/closest-features-$(MEGAROW) ${BINDIR_MODULE_MEGAROW}/closest-features
+	-cp ${BINDIR}/bedmap-$(MEGAROW) ${BINDIR_MODULE_MEGAROW}/bedmap
+	-cp ${BINDIR}/bedextract-$(MEGAROW) ${BINDIR_MODULE_MEGAROW}/bedextract
+	-cp ${BINDIR}/starch-$(MEGAROW) ${BINDIR_MODULE_MEGAROW}/starch
+	-cp ${BINDIR}/unstarch-$(MEGAROW) ${BINDIR_MODULE_MEGAROW}/unstarch
+	-cp ${BINDIR}/starchcat-$(MEGAROW) ${BINDIR_MODULE_MEGAROW}/starchcat
+	-cp ${BINDIR}/starchstrip-$(MEGAROW) ${BINDIR_MODULE_MEGAROW}/starchstrip
+	-cp ${BINDIR}/starch-diff-$(MEGAROW) ${BINDIR_MODULE_MEGAROW}/starch-diff
+	-cp ${BINDIR}/convert2bed-$(MEGAROW) ${BINDIR_MODULE_MEGAROW}/convert2bed
+	-cp ${BINDIR}/bam2bed-$(MEGAROW) ${BINDIR_MODULE_MEGAROW}/bam2bed
+	-cp ${BINDIR}/gff2bed-$(MEGAROW) ${BINDIR_MODULE_MEGAROW}/gff2bed
+	-cp ${BINDIR}/gtf2bed-$(MEGAROW) ${BINDIR_MODULE_MEGAROW}/gtf2bed
+	-cp ${BINDIR}/gvf2bed-$(MEGAROW) ${BINDIR_MODULE_MEGAROW}/gvf2bed
+	-cp ${BINDIR}/psl2bed-$(MEGAROW) ${BINDIR_MODULE_MEGAROW}/psl2bed
+	-cp ${BINDIR}/rmsk2bed-$(MEGAROW) ${BINDIR_MODULE_MEGAROW}/rmsk2bed
+	-cp ${BINDIR}/sam2bed-$(MEGAROW) ${BINDIR_MODULE_MEGAROW}/sam2bed
+	-cp ${BINDIR}/vcf2bed-$(MEGAROW) ${BINDIR_MODULE_MEGAROW}/vcf2bed
+	-cp ${BINDIR}/wig2bed-$(MEGAROW) ${BINDIR_MODULE_MEGAROW}/wig2bed
+	-cp ${BINDIR}/bam2starch-$(MEGAROW) ${BINDIR_MODULE_MEGAROW}/bam2starch
+	-cp ${BINDIR}/gff2starch-$(MEGAROW) ${BINDIR_MODULE_MEGAROW}/gff2starch
+	-cp ${BINDIR}/gtf2starch-$(MEGAROW) ${BINDIR_MODULE_MEGAROW}/gtf2starch
+	-cp ${BINDIR}/gvf2starch-$(MEGAROW) ${BINDIR_MODULE_MEGAROW}/gvf2starch
+	-cp ${BINDIR}/psl2starch-$(MEGAROW) ${BINDIR_MODULE_MEGAROW}/psl2starch
+	-cp ${BINDIR}/rmsk2starch-$(MEGAROW) ${BINDIR_MODULE_MEGAROW}/rmsk2starch
+	-cp ${BINDIR}/sam2starch-$(MEGAROW) ${BINDIR_MODULE_MEGAROW}/sam2starch
+	-cp ${BINDIR}/vcf2starch-$(MEGAROW) ${BINDIR_MODULE_MEGAROW}/vcf2starch
+	-cp ${BINDIR}/wig2starch-$(MEGAROW) ${BINDIR_MODULE_MEGAROW}/wig2starch
+	-cp ${BINDIR}/bam2bed_sge-$(MEGAROW) ${BINDIR_MODULE_MEGAROW}/bam2bed_sge
+	-cp ${BINDIR}/bam2bed_slurm-$(MEGAROW) ${BINDIR_MODULE_MEGAROW}/bam2bed_slurm
+	-cp ${BINDIR}/bam2bed_gnuParallel-$(MEGAROW) ${BINDIR_MODULE_MEGAROW}/bam2bed_gnuParallel
+	-cp ${BINDIR}/bam2starch_sge-$(MEGAROW) ${BINDIR_MODULE_MEGAROW}/bam2starch_sge
+	-cp ${BINDIR}/bam2starch_slurm-$(MEGAROW) ${BINDIR_MODULE_MEGAROW}/bam2starch_slurm
+	-cp ${BINDIR}/bam2starch_gnuParallel-$(MEGAROW) ${BINDIR_MODULE_MEGAROW}/bam2starch_gnuParallel
+	-cp ${BINDIR}/starchcluster_sge-$(MEGAROW) ${BINDIR_MODULE_MEGAROW}/starchcluster_sge
+	-cp ${BINDIR}/starchcluster_gnuParallel-$(MEGAROW) ${BINDIR_MODULE_MEGAROW}/starchcluster_gnuParallel
+	-cp ${BINDIR}/starchcluster_slurm-$(MEGAROW) ${BINDIR_MODULE_MEGAROW}/starchcluster_slurm
+	-cp ${BINDIR}/starch-diff-$(MEGAROW) ${BINDIR_MODULE_MEGAROW}/starch-diff
 
 #######################
 # install details
@@ -47,40 +210,50 @@ prep_c:
 	mkdir -p ${BINDIR}
 
 install_debug: prep_c install_conversion_scripts install_starch_scripts
-	-cp ${APPDIR}/sort-bed/bin/debug.sort-bed ${BINDIR}/
-	-cp ${APPDIR}/sort-bed/bin/update-sort-bed-slurm ${BINDIR}/
-	-cp ${APPDIR}/sort-bed/bin/update-sort-bed-starch-slurm ${BINDIR}/
-	-cp ${APPDIR}/sort-bed/bin/update-sort-bed-migrate-candidates ${BINDIR}/
-	-cp ${APPDIR}/bedops/bin/debug.bedops ${BINDIR}/
-	-cp ${APPDIR}/closestfeats/bin/debug.closest-features ${BINDIR}/
-	-cp ${APPDIR}/bedmap/bin/debug.bedmap ${BINDIR}/
-	-cp ${APPDIR}/bedextract/bin/debug.bedextract ${BINDIR}/
-	-cp ${APPDIR}/starch/bin/debug.starch ${BINDIR}/
-	-cp ${APPDIR}/starch/bin/debug.unstarch ${BINDIR}/
-	-cp ${APPDIR}/starch/bin/debug.starchcat ${BINDIR}/
-	-cp ${APPDIR}/starch/bin/debug.starchstrip ${BINDIR}/
-	-cp ${APPDIR}/conversion/bin/debug.convert2bed ${BINDIR}/
+	-cp ${APPDIR}/sort-bed/bin/debug.sort-bed- ${BINDIR}/debug.sort-bed
+	-cp ${APPDIR}/sort-bed/bin/update-sort-bed-slurm- ${BINDIR}/update-sort-bed-slurm
+	-cp ${APPDIR}/sort-bed/bin/update-sort-bed-starch-slurm- ${BINDIR}/update-sort-bed-starch-slurm
+	-cp ${APPDIR}/sort-bed/bin/update-sort-bed-migrate-candidates- ${BINDIR}/update-sort-bed-migrate-candidates
+	-cp ${APPDIR}/bedops/bin/debug.bedops- ${BINDIR}/debug.bedops
+	-cp ${APPDIR}/closestfeats/bin/debug.closest-features- ${BINDIR}/debug.closest-features
+	-cp ${APPDIR}/bedmap/bin/debug.bedmap- ${BINDIR}/debug.bedmap
+	-cp ${APPDIR}/bedextract/bin/debug.bedextract- ${BINDIR}/debug.bedextract
+	-cp ${APPDIR}/starch/bin/debug.starch- ${BINDIR}/debug.starch
+	-cp ${APPDIR}/starch/bin/debug.unstarch- ${BINDIR}/debug.unstarch
+	-cp ${APPDIR}/starch/bin/debug.starchcat- ${BINDIR}/debug.starchcat
+	-cp ${APPDIR}/starch/bin/debug.starchstrip- ${BINDIR}/debug.starchstrip
+	-cp ${APPDIR}/conversion/bin/debug.convert2bed- ${BINDIR}/debug.convert2bed
 
 install_gprof: prep_c install_conversion_scripts install_starch_scripts
-	-cp ${APPDIR}/sort-bed/bin/gprof.sort-bed ${BINDIR}/
-	-cp ${APPDIR}/sort-bed/bin/update-sort-bed-slurm ${BINDIR}/
-	-cp ${APPDIR}/sort-bed/bin/update-sort-bed-starch-slurm ${BINDIR}/
-	-cp ${APPDIR}/sort-bed/bin/update-sort-bed-migrate-candidates ${BINDIR}/
-	-cp ${APPDIR}/bedops/bin/gprof.bedops ${BINDIR}/
-	-cp ${APPDIR}/closestfeats/bin/gprof.closest-features ${BINDIR}/
-	-cp ${APPDIR}/bedmap/bin/gprof.bedmap ${BINDIR}/
-	-cp ${APPDIR}/bedextract/bin/gprof.bedextract ${BINDIR}/
-	-cp ${APPDIR}/starch/bin/gprof.starch ${BINDIR}/
-	-cp ${APPDIR}/starch/bin/gprof.unstarch ${BINDIR}/
-	-cp ${APPDIR}/starch/bin/gprof.starchcat ${BINDIR}/
-	-cp ${APPDIR}/starch/bin/gprof.starchstrip ${BINDIR}/
-	-cp ${APPDIR}/conversion/bin/gprof.convert2bed ${BINDIR}/
+	-cp ${APPDIR}/sort-bed/bin/gprof.sort-bed- ${BINDIR}/gprof.sort-bed
+	-cp ${APPDIR}/sort-bed/bin/update-sort-bed-slurm- ${BINDIR}/update-sort-bed-slurm
+	-cp ${APPDIR}/sort-bed/bin/update-sort-bed-starch-slurm- ${BINDIR}/update-sort-bed-starch-slurm
+	-cp ${APPDIR}/sort-bed/bin/update-sort-bed-migrate-candidates- ${BINDIR}/update-sort-bed-migrate-candidates
+	-cp ${APPDIR}/bedops/bin/gprof.bedops- ${BINDIR}/gprof.bedops
+	-cp ${APPDIR}/closestfeats/bin/gprof.closest-features- ${BINDIR}/gprof.closest-features
+	-cp ${APPDIR}/bedmap/bin/gprof.bedmap- ${BINDIR}/gprof.bedmap
+	-cp ${APPDIR}/bedextract/bin/gprof.bedextract- ${BINDIR}/gprof.bedextract
+	-cp ${APPDIR}/starch/bin/gprof.starch- ${BINDIR}/gprof.starch
+	-cp ${APPDIR}/starch/bin/gprof.unstarch- ${BINDIR}/gprof.unstarch
+	-cp ${APPDIR}/starch/bin/gprof.starchcat- ${BINDIR}/gprof.starchcat
+	-cp ${APPDIR}/starch/bin/gprof.starchstrip- ${BINDIR}/gprof.starchstrip
+	-cp ${APPDIR}/conversion/bin/gprof.convert2bed- ${BINDIR}/gprof.convert2bed
 
 install_starch_scripts: prep_c
-	-cp ${APPDIR}/starch/bin/starchcluster_sge ${BINDIR}/
-	-cp ${APPDIR}/starch/bin/starchcluster_gnuParallel ${BINDIR}/
-	-cp ${APPDIR}/starch/bin/starchcluster_slurm ${BINDIR}/
-	-cp ${APPDIR}/starch/bin/starch-diff ${BINDIR}/
+	-cp ${APPDIR}/starch/bin/starchcluster_sge- ${BINDIR}/starchcluster_sge
+	-cp ${APPDIR}/starch/bin/starchcluster_gnuParallel- ${BINDIR}/starchcluster_gnuParallel
+	-cp ${APPDIR}/starch/bin/starchcluster_slurm- ${BINDIR}/starchcluster_slurm
+	-cp ${APPDIR}/starch/bin/starch-diff- ${BINDIR}/starch-diff
+
+install_starch_scripts_with_suffix: prep_c
+	-cp ${APPDIR}/starch/bin/starchcluster_sge-$(TYPICAL) ${BINDIR}/starchcluster_sge-$(TYPICAL)
+	-cp ${APPDIR}/starch/bin/starchcluster_gnuParallel-$(TYPICAL) ${BINDIR}/starchcluster_gnuParallel-$(TYPICAL)
+	-cp ${APPDIR}/starch/bin/starchcluster_slurm-$(TYPICAL) ${BINDIR}/starchcluster_slurm-$(TYPICAL)
+	-cp ${APPDIR}/starch/bin/starch-diff-$(TYPICAL) ${BINDIR}/starch-diff-$(TYPICAL)
+	-cp ${APPDIR}/starch/bin/starchcluster_sge-$(MEGAROW) ${BINDIR}/starchcluster_sge-$(MEGAROW)
+	-cp ${APPDIR}/starch/bin/starchcluster_gnuParallel-$(MEGAROW) ${BINDIR}/starchcluster_gnuParallel-$(MEGAROW)
+	-cp ${APPDIR}/starch/bin/starchcluster_slurm-$(MEGAROW) ${BINDIR}/starchcluster_slurm-$(MEGAROW)
+	-cp ${APPDIR}/starch/bin/starch-diff-$(MEGAROW) ${BINDIR}/starch-diff-$(MEGAROW)
 
 install_conversion_scripts: prep_c
 	-cp ${APPDIR}/conversion/src/wrappers/bam2bed ${BINDIR}/bam2bed
@@ -108,25 +281,50 @@ install_conversion_scripts: prep_c
 	-cp ${APPDIR}/conversion/src/wrappers/bam2starch_slurm ${BINDIR}/bam2starch_slurm
 	-cp ${APPDIR}/conversion/src/wrappers/bam2starch_gnuParallel ${BINDIR}/bam2starch_gnuParallel
 
-install_osx_packaging_bins: prep_c
+.PHONY: $(WRAPPERS)
+
+install_conversion_scripts_with_suffix: $(WRAPPERS)
+
+$(WRAPPERS): prep_c
+	cp $@ $(patsubst %,$(BINDIR)/%-$(TYPICAL), $(notdir $@))
+	cp $@ $(patsubst %,$(BINDIR)/%-$(MEGAROW), $(notdir $@))
+
+install_osx_packaging_bins: prep_c all
 	mkdir -p ${OSXPKGDIR}
-	-cp ${APPDIR}/sort-bed/bin/sort-bed ${OSXPKGDIR}/
-	-cp ${APPDIR}/sort-bed/bin/update-sort-bed-slurm ${OSXPKGDIR}/
-	-cp ${APPDIR}/sort-bed/bin/update-sort-bed-starch-slurm ${OSXPKGDIR}/
-	-cp ${APPDIR}/sort-bed/bin/update-sort-bed-migrate-candidates ${OSXPKGDIR}/
-	-cp ${APPDIR}/bedops/bin/bedops ${OSXPKGDIR}/
-	-cp ${APPDIR}/closestfeats/bin/closest-features ${OSXPKGDIR}/
-	-cp ${APPDIR}/bedmap/bin/bedmap ${OSXPKGDIR}/
-	-cp ${APPDIR}/bedextract/bin/bedextract ${OSXPKGDIR}/
-	-cp ${APPDIR}/starch/bin/starch ${OSXPKGDIR}/
-	-cp ${APPDIR}/starch/bin/unstarch ${OSXPKGDIR}/
-	-cp ${APPDIR}/starch/bin/starchcat ${OSXPKGDIR}/
-	-cp ${APPDIR}/starch/bin/starchstrip ${OSXPKGDIR}/
-	-cp ${APPDIR}/starch/bin/starchcluster_sge ${OSXPKGDIR}/starchcluster_sge
-	-cp ${APPDIR}/starch/bin/starchcluster_gnuParallel ${OSXPKGDIR}/starchcluster_gnuParallel
-	-cp ${APPDIR}/starch/bin/starchcluster_slurm ${OSXPKGDIR}/starchcluster_slurm
-	-cp ${APPDIR}/starch/bin/starch-diff ${OSXPKGDIR}/starch-diff
-	-cp ${APPDIR}/conversion/bin/convert2bed ${OSXPKGDIR}/
+	-cp ${APPDIR}/sort-bed/bin/sort-bed-typical ${OSXPKGDIR}/sort-bed-typical
+	-cp ${APPDIR}/sort-bed/bin/sort-bed-megarow ${OSXPKGDIR}/sort-bed-megarow
+	-cp ${APPDIR}/sort-bed/bin/update-sort-bed-slurm-typical ${OSXPKGDIR}/update-sort-bed-slurm-typical
+	-cp ${APPDIR}/sort-bed/bin/update-sort-bed-slurm-megarow ${OSXPKGDIR}/update-sort-bed-slurm-megarow
+	-cp ${APPDIR}/sort-bed/bin/update-sort-bed-starch-slurm-typical ${OSXPKGDIR}/update-sort-bed-starch-slurm-typical
+	-cp ${APPDIR}/sort-bed/bin/update-sort-bed-starch-slurm-megarow ${OSXPKGDIR}/update-sort-bed-starch-slurm-megarow
+	-cp ${APPDIR}/sort-bed/bin/update-sort-bed-migrate-candidates-typical ${OSXPKGDIR}/update-sort-bed-migrate-candidates-typical
+	-cp ${APPDIR}/sort-bed/bin/update-sort-bed-migrate-candidates-megarow ${OSXPKGDIR}/update-sort-bed-migrate-candidates-megarow
+	-cp ${APPDIR}/bedops/bin/bedops-typical ${OSXPKGDIR}/bedops-typical
+	-cp ${APPDIR}/bedops/bin/bedops-megarow ${OSXPKGDIR}/bedops-megarow
+	-cp ${APPDIR}/closestfeats/bin/closest-features-typical ${OSXPKGDIR}/closest-features-typical
+	-cp ${APPDIR}/closestfeats/bin/closest-features-megarow ${OSXPKGDIR}/closest-features-megarow
+	-cp ${APPDIR}/bedmap/bin/bedmap-typical ${OSXPKGDIR}/bedmap-typical
+	-cp ${APPDIR}/bedmap/bin/bedmap-megarow ${OSXPKGDIR}/bedmap-megarow
+	-cp ${APPDIR}/bedextract/bin/bedextract-typical ${OSXPKGDIR}/bedextract-typical
+	-cp ${APPDIR}/bedextract/bin/bedextract-megarow ${OSXPKGDIR}/bedextract-megarow
+	-cp ${APPDIR}/starch/bin/starch-typical ${OSXPKGDIR}/starch-typical
+	-cp ${APPDIR}/starch/bin/starch-megarow ${OSXPKGDIR}/starch-megarow
+	-cp ${APPDIR}/starch/bin/unstarch-typical ${OSXPKGDIR}/unstarch-typical
+	-cp ${APPDIR}/starch/bin/unstarch-megarow ${OSXPKGDIR}/unstarch-megarow
+	-cp ${APPDIR}/starch/bin/starchcat-typical ${OSXPKGDIR}/starchcat-typical
+	-cp ${APPDIR}/starch/bin/starchcat-megarow ${OSXPKGDIR}/starchcat-megarow
+	-cp ${APPDIR}/starch/bin/starchstrip-typical ${OSXPKGDIR}/starchstrip-typical
+	-cp ${APPDIR}/starch/bin/starchstrip-megarow ${OSXPKGDIR}/starchstrip-megarow
+	-cp ${APPDIR}/starch/bin/starchcluster_sge-typical ${OSXPKGDIR}/starchcluster_sge-typical
+	-cp ${APPDIR}/starch/bin/starchcluster_sge-megarow ${OSXPKGDIR}/starchcluster_sge-megarow
+	-cp ${APPDIR}/starch/bin/starchcluster_gnuParallel-typical ${OSXPKGDIR}/starchcluster_gnuParallel-typical
+	-cp ${APPDIR}/starch/bin/starchcluster_gnuParallel-megarow ${OSXPKGDIR}/starchcluster_gnuParallel-megarow
+	-cp ${APPDIR}/starch/bin/starchcluster_slurm-typical ${OSXPKGDIR}/starchcluster_slurm-typical
+	-cp ${APPDIR}/starch/bin/starchcluster_slurm-megarow ${OSXPKGDIR}/starchcluster_slurm-megarow
+	-cp ${APPDIR}/starch/bin/starch-diff-typical ${OSXPKGDIR}/starch-diff-typical
+	-cp ${APPDIR}/starch/bin/starch-diff-megarow ${OSXPKGDIR}/starch-diff-megarow
+	-cp ${APPDIR}/conversion/bin/convert2bed-typical ${OSXPKGDIR}/convert2bed-typical
+	-cp ${APPDIR}/conversion/bin/convert2bed-megarow ${OSXPKGDIR}/convert2bed-megarow
 	-cp ${APPDIR}/conversion/src/wrappers/bam2bed ${OSXPKGDIR}/bam2bed
 	-cp ${APPDIR}/conversion/src/wrappers/gff2bed ${OSXPKGDIR}/gff2bed
 	-cp ${APPDIR}/conversion/src/wrappers/gtf2bed ${OSXPKGDIR}/gtf2bed
@@ -151,14 +349,34 @@ install_osx_packaging_bins: prep_c
 	-cp ${APPDIR}/conversion/src/wrappers/bam2starch_sge ${OSXPKGDIR}/bam2starch_sge
 	-cp ${APPDIR}/conversion/src/wrappers/bam2starch_slurm ${OSXPKGDIR}/bam2starch_slurm
 	-cp ${APPDIR}/conversion/src/wrappers/bam2starch_gnuParallel ${OSXPKGDIR}/bam2starch_gnuParallel
-	mkdir -p ${OSXLIBDIR}
+	-cp ${OTHERDIR}/switch-BEDOPS-binary-type ${OSXPKGDIR}
+	-cd ${OSXPKGDIR}; \
+	ln -sf ./sort-bed-typical ./sort-bed; \
+	ln -sf ./update-sort-bed-slurm-typical ./update-sort-bed-slurm; \
+	ln -sf ./update-sort-bed-starch-slurm-typical ./update-sort-bed-starch-slurm; \
+	ln -sf ./update-sort-bed-migrate-candidates-typical ./update-sort-bed-migrate-candidates; \
+	ln -sf ./bedops-typical ./bedops; \
+	ln -sf ./closest-features-typical ./closest-features; \
+	ln -sf ./bedmap-typical ./bedmap; \
+	ln -sf ./bedextract-typical ./bedextract; \
+	ln -sf ./starch-typical ./starch; \
+	ln -sf ./unstarch-typical ./unstarch; \
+	ln -sf ./starchcat-typical ./starchcat; \
+	ln -sf ./starchstrip-typical ./starchstrip; \
+	ln -sf ./starchcluster_sge-typical ./starchcluster_sge; \
+	ln -sf ./starchcluster_gnuParallel-typical ./starchcluster_gnuParallel; \
+	ln -sf ./starchcluster_slurm-typical ./starchcluster_slurm; \
+	ln -sf ./starch-diff-typical ./starch-diff; \
+	ln -sf ./convert2bed-typical ./convert2bed; \
+	cd ${CWD}; \
+	mkdir -p ${OSXLIBDIR}; \
 
 update_bedops_version:
 ifndef OLD_VER
-	$(error Old version variable OLD_VER is undefined (e.g., 2.4.25))
+	$(error Old version variable OLD_VER is undefined (e.g., 2.4.26))
 endif
 ifndef NEW_VER
-	$(error New version variable NEW_VER is undefined (e.g., 2.4.26))
+	$(error New version variable NEW_VER is undefined (e.g., 2.4.27))
 endif
 ifeq ($(KERNEL), Darwin)
 	sed -i "" -e "s/"$$OLD_VER"/"$$NEW_VER"/g" README.md
diff --git a/README.md b/README.md
index 3197176..2a67f2f 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-## BEDOPS v2.4.26: high-performance genomic feature operations ##
+## BEDOPS v2.4.28: high-performance genomic feature operations ##
 
 [![Build Status](https://travis-ci.org/bedops/bedops.svg?branch=master)](https://travis-ci.org/bedops/bedops) [![GitHub stars](https://img.shields.io/github/stars/bedops/bedops.svg)](https://github.com/bedops/bedops/stargazers) [![Project license](https://img.shields.io/badge/license-GPLv2-blue.svg)](https://github.com/bedops/bedops/blob/master/LICENSE) [![Documentation Status](https://readthedocs.org/projects/bedops/badge/?version=latest)](https://readthedocs.org/projects/bedops/?badge=latest)
 
@@ -6,9 +6,9 @@
 
 ### About ###
 
-**BEDOPS v2.4.26** is a suite of tools to address common questions raised in genomic studies — mostly with regard to overlap and proximity relationships between data sets. It aims to be scalable and flexible, facilitating the efficient and accurate analysis and management of large-scale genomic data. 
+**BEDOPS v2.4.28** is a suite of tools to address common questions raised in genomic studies — mostly with regard to overlap and proximity relationships between data sets. It aims to be scalable and flexible, facilitating the efficient and accurate analysis and management of large-scale genomic data. 
 
-The <a href="https://bedops.readthedocs.io/en/latest/content/overview.html#overview">overview</a> section of the **BEDOPS v2.4.26** documentation summarizes the toolkit, functionality and performance enhancements. The <a href="https://bedops.readthedocs.io/en/latest/index.html#reference">reference</a> table offers documentation for all applications and scripts.
+The <a href="https://bedops.readthedocs.io/en/latest/content/overview.html#overview">overview</a> section of the **BEDOPS v2.4.28** documentation summarizes the toolkit, functionality and performance enhancements. The <a href="https://bedops.readthedocs.io/en/latest/index.html#reference">reference</a> table offers documentation for all applications and scripts.
 
 
 ### Downloads ###
@@ -28,21 +28,20 @@ The <a href="https://bedops.readthedocs.io/en/latest/content/overview.html#overv
 <tr>
 <td valign="top">
 <ul style="list-style-type:square; font-size:smaller; margin-left:0; margin-right:0px; padding-right:0px; padding-left:20px;">
-<li><a href="https://github.com/bedops/bedops/releases/download/v2.4.26/bedops_linux_x86_64-v2.4.26.tar.bz2">x86-64 (64-bit)</a> binaries</li>
-<li><a href="https://github.com/bedops/bedops/releases/download/v2.4.26/bedops_linux_i386-v2.4.26.tar.bz2">i386 (32-bit)</a> binaries</li>
+<li><a href="https://github.com/bedops/bedops/releases/download/v2.4.28/bedops_linux_x86_64-v2.4.28.tar.bz2">x86-64 (64-bit)</a> binaries</li>
 <li><a href="http://bedops.readthedocs.io/en/latest/content/installation.html#linux">Installation instructions</a> for Linux hosts</li>
 </ul>
 </td>
 <td valign="top">
 <ul style="list-style-type:square; font-size:smaller; margin-left:0; margin-right:0px; padding-right:0px; padding-left:20px;">
-<li><a href="https://github.com/bedops/bedops/releases/download/v2.4.26/BEDOPS.2.4.26.pkg.zip">Intel (32-/64-bit, 10.7-10.12)</a> installer package</li>
+<li><a href="https://github.com/bedops/bedops/releases/download/v2.4.28/BEDOPS.2.4.28.pkg.zip">Intel (64-bit, 10.10-10.12)</a> installer package</li>
 <li><a href="http://bedops.readthedocs.io/en/latest/content/installation.html#mac-os-x">Installation instructions</a> for Mac OS X hosts</li>
 </ul>
 </td>
 <td valign="top">
 <ul style="list-style-type:square; font-size:smaller; margin-left:0; margin-right:0px; padding-right:0px; padding-left:20px;">
-<li><a href="https://github.com/bedops/bedops/archive/v2.4.26.tar.gz">Source code</a> (tar.gz)</li>
-<li><a href="https://github.com/bedops/bedops/archive/v2.4.26.zip">Source code</a> (zip)</li>
+<li><a href="https://github.com/bedops/bedops/archive/v2.4.28.tar.gz">Source code</a> (tar.gz)</li>
+<li><a href="https://github.com/bedops/bedops/archive/v2.4.28.zip">Source code</a> (zip)</li>
 <li><a href="http://bedops.readthedocs.io/en/latest/content/installation.html#installation-via-source-code">Compilation instructions</a></li>
 </ul>
 </td>
@@ -51,11 +50,11 @@ The <a href="https://bedops.readthedocs.io/en/latest/content/overview.html#overv
 
 ### Documentation ###
 
-Complete documentation for **BEDOPS v2.4.26** tools is available at: <a href="https://bedops.readthedocs.io/en/latest/index.html">https://bedops.readthedocs.io/</a>
+Complete documentation for **BEDOPS v2.4.28** tools is available at: <a href="https://bedops.readthedocs.io/en/latest/index.html">https://bedops.readthedocs.io/</a>
 
 ### Citation ###
 
-If you use **BEDOPS v2.4.26** in your research, please cite the following manuscript:
+If you use **BEDOPS v2.4.28** in your research, please cite the following manuscript:
 
 > Shane Neph, M. Scott Kuehn, Alex P. Reynolds, et al.  
 > [**BEDOPS: high-performance genomic feature operations**  
diff --git a/applications/bed/bedextract/src/ExtractRows.cpp b/applications/bed/bedextract/src/ExtractRows.cpp
index 7d9456f..837f6ca 100644
--- a/applications/bed/bedextract/src/ExtractRows.cpp
+++ b/applications/bed/bedextract/src/ExtractRows.cpp
@@ -33,12 +33,13 @@
 #include <map>
 #include <numeric>
 #include <string>
+#include <type_traits>
 #include <utility>
 #include <vector>
 
 #include "algorithm/bed/FindBedRange.hpp"
 #include "algorithm/visitors/helpers/ProcessBedVisitorRow.hpp"
-#include "data/bed/BedTypes.hpp"
+//#include "data/bed/BedTypes.hpp"
 #include "data/bed/BedCheckIterator.hpp"
 #include "suite/BEDOPS.Constants.hpp"
 #include "suite/BEDOPS.Version.hpp"
@@ -50,6 +51,17 @@ namespace {
   const std::string citation = BEDOPS::citation();
   const std::string version = BEDOPS::revision();
   const std::string authors = "Shane Neph & Alex Reynolds";
+  constexpr std::size_t PoolSz = 2*8;
+
+#if BEDOPS_BINARY_TYPE == 0
+  const std::string application_type = "typical";
+#else
+#if BEDOPS_BINARY_TYPE == 1
+  const std::string application_type = "megarow";
+#else
+  const std::string application_type = "typical";
+#endif
+#endif
 
   //======
   // Help
@@ -66,12 +78,11 @@ namespace {
   //=======
   template <typename ValueType>
   struct Cache {
-    Cache() : empty_(true), value_()
+    Cache() : empty_(true)
       { }
 
     template <typename T>
     void operator()(const T* t) {
-      value_ = static_cast<ValueType>(*t);
       empty_ = false;
     }
 
@@ -80,7 +91,6 @@ namespace {
 
   private:
     bool empty_;
-    ValueType value_;
   };
 
   using Bed::extract_details::TargetBedType;
@@ -156,8 +166,8 @@ namespace {
     }
 
     OpMode Mode() const { return m_; }
-    FILE* File1() { return f1_; }
-    FILE* File2() { return f2_; }
+    FILE* File1() const { return f1_; }
+    FILE* File2() const { return f2_; }
     std::string File2Name() const { return f2Name_; }
     std::string Chrome() const { return(chrom_); }
 
@@ -238,10 +248,20 @@ namespace {
     return(c == EOF);
   }
 
+  //=============
+  // get_pool()
+  //============
+  template <typename BedTypePtr>
+  Ext::PooledMemory<typename std::remove_pointer<BedTypePtr>::type, PoolSz>&
+  get_pool() {
+    static Ext::PooledMemory<typename std::remove_pointer<BedTypePtr>::type, PoolSz> pool;
+    return pool;
+  }
+
   //==========
   // doWork()
   //==========
-  void doWork(Input& input) {
+  void doWork(const Input& input) {
     // execute the mode requested by the user
     Input::OpMode mode = input.Mode();
     FILE* f = input.File1();
@@ -253,11 +273,13 @@ namespace {
     if ( mode == Input::TWOFILE ) { // find elements of file1 that overlap specified ranges of file2
       Visitors::BedHelpers::Println printer;
       if ( input.File2Name() == "stdin" ) {
-        Bed::bed_check_iterator<TargetBedType*> titer(std::cin, input.File2Name()), teof;
+        auto& mem = get_pool<TargetBedType*>();
+        Bed::bed_check_iterator<TargetBedType*, PoolSz> titer(std::cin, input.File2Name(), mem), teof;
         find_bed_range(f, titer, teof, printer);
       } else {
         std::ifstream* infile = new std::ifstream(input.File2Name().c_str());
-        Bed::bed_check_iterator<TargetBedType*> titer(*infile, input.File2Name()), teof;
+        auto& mem = get_pool<TargetBedType*>();
+        Bed::bed_check_iterator<TargetBedType*, PoolSz> titer(*infile, input.File2Name(), mem), teof;
         find_bed_range(f, titer, teof, printer);
         delete infile;
       }
@@ -289,8 +311,9 @@ namespace {
         if ( lbound.first && lbound.second != at_end ) {
           std::fseek(f, lbound.second, SEEK_SET);
           ByteOffset b = std::ftell(f);
-          QueryBedType q(f);
-          printf("%s\n", q.chrom());
+          auto q = new QueryBedType(f);
+          printf("%s\n", q->chrom());
+          delete q;
           std::fseek(f, b, SEEK_SET);
         }
         else
@@ -325,20 +348,20 @@ int main(int argc, char** argv) {
   } catch(const Help& h) {
     std::cout << prognm << std::endl;
     std::cout << "  citation: " + citation << std::endl;
-    std::cout << "  version:  " + version << std::endl;
+    std::cout << "  version:  " + version + " (" + application_type + ")" << std::endl;
     std::cout << "  authors:  " + authors << std::endl;
     std::cout << usage() << std::endl;
     isok = true;
   } catch(const Version& v) {
     std::cout << prognm << std::endl;
     std::cout << "  citation: " + citation << std::endl;
-    std::cout << "  version:  " + version << std::endl;
+    std::cout << "  version:  " + version + " (" + application_type + ")" << std::endl;
     std::cout << "  authors:  " + authors << std::endl;
     isok = true;
   } catch(std::string& msg) {
     std::cerr << prognm << std::endl;
     std::cerr << "  citation: " + citation << std::endl;
-    std::cerr << "  version:  " + version << std::endl;
+    std::cerr << "  version:  " + version + " (" + application_type + ")" << std::endl;
     std::cerr << "  authors:  " + authors << std::endl;
     std::cerr << usage() << std::endl;
     std::cerr << msg << std::endl;
diff --git a/applications/bed/bedextract/src/Makefile b/applications/bed/bedextract/src/Makefile
index 11f935d..9cc2e67 100644
--- a/applications/bed/bedextract/src/Makefile
+++ b/applications/bed/bedextract/src/Makefile
@@ -6,7 +6,7 @@ LIB2                    = $(MAIN)/interfaces/src/utility
 LIB3                    = $(MAIN)/interfaces/src/data/starch
 THISDIR                 = ${shell pwd}
 PARTY3                  = ${THISDIR}/$(MAIN)/third-party
-OBJDIR                  = objects
+OBJDIR                  = objects_${BINARY_TYPE}
 LIBJANSSON              = libjansson.a
 LIBBZIP2                = libbz2.a
 LIBZLIB                 = libz.a
@@ -25,23 +25,31 @@ INCLUDES                = -iquote$(HEAD) -I${LOCALJANSSONINCDIR} -I${LOCALBZIP2I
 LIBLOCATION             = -L${LOCALJANSSONLIBDIR} -L${LOCALBZIP2LIBDIR} -L${LOCALZLIBDIR}
 LIBRARIES               = ${LOCALJANSSONLIB} ${LOCALBZIP2LIB} ${LOCALZLIBLIB}
 BLDFLAGS                = -Wall -pedantic -O3 -std=c++11
-SFLAGS                  = -static
+SFLAGS                  = -static ${MEGAFLAGS}
+
+ifeq ($(BINARY_TYPE),)
+	TFLAG = -DBEDOPS_BINARY_TYPE=0
+else
+	TFLAG = -DBEDOPS_BINARY_TYPE=$(BINARY_TYPE_NUM)
+endif
 
 dependency_names        = NaN starchConstants starchFileHelpers starchHelpers starchMetadataHelpers unstarchHelpers starchSha1Digest starchBase64Coding
 dependencies            = $(addprefix $(OBJDIR)/, $(addsuffix .o, $(dependency_names)))
-FLAGS                   = $(SFLAGS) -s $(BLDFLAGS) $(dependencies) ${LIBLOCATION} ${INCLUDES}
-DFLAGS                  = $(SFLAGS) -g -O0 -std=c++11 -Wall -fno-inline -pedantic $(dependencies) ${LIBLOCATION} ${INCLUDES}
-GPROFFLAGS              = $(SFLAGS) -O -std=c++11 -Wall -pedantic -pg $(dependencies) ${LIBLOCATION} ${INCLUDES}
+FLAGS                   = $(SFLAGS) -s $(TFLAG) $(BLDFLAGS) $(dependencies) ${LIBLOCATION} ${INCLUDES}
+DFLAGS                  = $(SFLAGS) -g -O0 -std=c++11 -Wall -fno-inline -pedantic $(dependencies) $(TFLAG) ${LIBLOCATION} ${INCLUDES}
+GPROFFLAGS              = $(SFLAGS) -O -std=c++11 -Wall -pedantic -pg $(dependencies) $(TFLAG) ${LIBLOCATION} ${INCLUDES}
 
 SOURCE1                 = ExtractRows.cpp
 BINDIR                  = ../bin
-PROG                    = bedextract
+PROG                    = bedextract-${BINARY_TYPE}
 
 build: $(BINDIR)/$(PROG)
+	rm -rf ${OBJDIR}
 
 build_gprof: $(BINDIR)/gprof.$(PROG)
 
 build_debug: $(BINDIR)/debug.$(PROG)
+	rm -rf ${OBJDIR}
 
 dependencies: $(dependencies)
 
@@ -62,6 +70,4 @@ $(OBJDIR)/%.o : $(LIB3)/%.c
 
 clean:
 	rm -rf $(OBJDIR)
-	rm -f $(BINDIR)/$(PROG)
-	rm -f $(BINDIR)/*.$(PROG)
-	rm -rf $(BINDIR)
\ No newline at end of file
+	rm -rf $(BINDIR)
diff --git a/applications/bed/bedextract/src/Makefile.darwin b/applications/bed/bedextract/src/Makefile.darwin
index 819622d..a7f67af 100644
--- a/applications/bed/bedextract/src/Makefile.darwin
+++ b/applications/bed/bedextract/src/Makefile.darwin
@@ -1,5 +1,3 @@
-MIN_OSX_VERSION      = 10.7
-
 MAIN                 = ../../../..
 MAINAPPDIR           = ../..
 HEAD                 = $(MAIN)/interfaces/general-headers
@@ -8,7 +6,7 @@ LIB2                 = $(MAIN)/interfaces/src/utility
 LIB3                 = $(MAIN)/interfaces/src/data/starch
 THISDIR              = ${shell pwd}
 PARTY3               = ${THISDIR}/$(MAIN)/third-party
-OBJDIR               = objects_$(ARCH)
+OBJDIR               = objects_$(ARCH)_${BINARY_TYPE}
 LIBJANSSON           = libjansson.a
 LIBBZIP2             = libbz2.a
 LIBZLIB              = libz.a
@@ -30,25 +28,33 @@ LIBRARIES            = ${LOCALJANSSONLIB} ${LOCALBZIP2LIB} ${LOCALZLIBLIB}
 STDFLAGS             = -Wall -pedantic -std=c++11 -stdlib=libc++
 BLDFLAGS             = -O3 ${STDFLAGS}
 
+ifeq ($(BINARY_TYPE),)
+	TFLAG = -DBEDOPS_BINARY_TYPE=0
+else
+	TFLAG = -DBEDOPS_BINARY_TYPE=$(BINARY_TYPE_NUM)
+endif
 
-FLAGS                = $(BLDFLAGS) $(OBJDIR)/NaN.o $(OBJDIR)/starchConstants.o $(OBJDIR)/starchFileHelpers.o $(OBJDIR)/starchHelpers.o $(OBJDIR)/starchMetadataHelpers.o $(OBJDIR)/unstarchHelpers.o $(OBJDIR)/starchSha1Digest.o $(OBJDIR)/starchBase64Coding.o ${LIBLOCATION} ${INCLUDES}
+FLAGS                = $(BLDFLAGS) $(TFLAG) $(OBJDIR)/NaN.o $(OBJDIR)/starchConstants.o $(OBJDIR)/starchFileHelpers.o $(OBJDIR)/starchHelpers.o $(OBJDIR)/starchMetadataHelpers.o $(OBJDIR)/unstarchHelpers.o $(OBJDIR)/starchSha1Digest.o $(OBJDIR)/starchBase64Coding.o ${LIBLOCATION} ${INCLUDES}
 
-DFLAGS               = -g -O0 ${STDFLAGS} $(OBJDIR)/NaN.o $(OBJDIR)/starchConstants.o $(OBJDIR)/starchFileHelpers.o $(OBJDIR)/starchHelpers.o $(OBJDIR)/starchMetadataHelpers.o $(OBJDIR)/unstarchHelpers.o $(OBJDIR)/starchSha1Digest.o $(OBJDIR)/starchBase64Coding.o ${LIBLOCATION} ${INCLUDES}
+DFLAGS               = -g -O0 ${STDFLAGS} $(TFLAG) $(OBJDIR)/NaN.o $(OBJDIR)/starchConstants.o $(OBJDIR)/starchFileHelpers.o $(OBJDIR)/starchHelpers.o $(OBJDIR)/starchMetadataHelpers.o $(OBJDIR)/unstarchHelpers.o $(OBJDIR)/starchSha1Digest.o $(OBJDIR)/starchBase64Coding.o ${LIBLOCATION} ${INCLUDES}
 
-GPROFFLAGS           = -O -pg ${STDFLAGS} $(OBJDIR)/NaN.o $(OBJDIR)/starchConstants.o $(OBJDIR)/starchFileHelpers.o $(OBJDIR)/starchHelpers.o $(OBJDIR)/starchMetadataHelpers.o $(OBJDIR)/unstarchHelpers.o $(OBJDIR)/starchSha1Digest.o $(OBJDIR)/starchBase64Coding.o ${LIBLOCATION} ${INCLUDES}
+GPROFFLAGS           = -O -pg ${STDFLAGS} $(TFLAG) $(OBJDIR)/NaN.o $(OBJDIR)/starchConstants.o $(OBJDIR)/starchFileHelpers.o $(OBJDIR)/starchHelpers.o $(OBJDIR)/starchMetadataHelpers.o $(OBJDIR)/unstarchHelpers.o $(OBJDIR)/starchSha1Digest.o $(OBJDIR)/starchBase64Coding.o ${LIBLOCATION} ${INCLUDES}
 
 SOURCE1              = ExtractRows.cpp
 BINDIR               = ../bin
-PROG                 = bedextract
+PROG                 = bedextract-${BINARY_TYPE}
 
 build: dependencies
-	$(CXX) -o $(BINDIR)/$(PROG)_$(ARCH) $(FLAGS) -mmacosx-version-min=$(MIN_OSX_VERSION) -arch $(ARCH) ${LIBRARIES} $(SOURCE1)
+	$(CXX) -o $(BINDIR)/$(PROG) $(FLAGS) -mmacosx-version-min=$(MIN_OSX_VERSION) -arch $(ARCH) ${LIBRARIES} $(SOURCE1)
+	rm -rf $(OBJDIR)
 
 build_debug: dependencies
-	$(CXX) -o $(BINDIR)/debug.$(PROG)_$(ARCH) $(DFLAGS) -mmacosx-version-min=$(MIN_OSX_VERSION) -arch $(ARCH) ${LIBRARIES} $(SOURCE1)
+	$(CXX) -o $(BINDIR)/debug.$(PROG) $(DFLAGS) -mmacosx-version-min=$(MIN_OSX_VERSION) -arch $(ARCH) ${LIBRARIES} $(SOURCE1)
+	rm -rf $(OBJDIR)
 
 build_gprof: dependencies
-	$(CXX) -o $(BINDIR)/gprof.$(PROG)_$(ARCH) $(GPROFFLAGS) -mmacosx-version-min=$(MIN_OSX_VERSION) -arch $(ARCH) ${LIBRARIES} $(SOURCE1)
+	$(CXX) -o $(BINDIR)/gprof.$(PROG) $(GPROFFLAGS) -mmacosx-version-min=$(MIN_OSX_VERSION) -arch $(ARCH) ${LIBRARIES} $(SOURCE1)
+	rm -rf $(OBJDIR)
 
 dependencies:
 	rm -rf $(OBJDIR)
@@ -64,6 +70,4 @@ dependencies:
 
 clean:
 	rm -rf $(OBJDIR)
-	rm -rf $(BINDIR)/$(PROG)*
-	rm -rf $(BINDIR)/*.$(PROG)*
 	rm -rf $(BINDIR)
diff --git a/applications/bed/bedmap/doc/known.issues b/applications/bed/bedmap/doc/known.issues
deleted file mode 100644
index a3283ff..0000000
--- a/applications/bed/bedmap/doc/known.issues
+++ /dev/null
@@ -1,33 +0,0 @@
-Shane Neph
-Create Date : Dec. 18, 2009
-
-sort-bed cannot sort output from bedmap --echo --[otherops] with multi-column outputs separated by '|', for example, when the ref file has 3 columns:
-chr1  1  10|something.  bedops/bedmap/closest-features wouldn't be able to work on it either.
-
-
----------------------------------------------------------------------------------------------------
-Non-issues, but 'gotchas'
-
-
-=========
-Gotcha-1:
-=========
-File1:
-chr1  1  2   i  1
-chr1  7  15  j  2
-chr1  12 20  k  3
-
-File2:
-chr1 1  4
-chr1 3  6
-chr1 10 30
-
-You use:
-bedmap --fraction-map 1 --echo-mapRange --echo-mapScore File2 File1
-
-You receive:
-chr1 1 2|1
-<blank line>
-chr1 7 20|2;3
-
-It's a good idea to use --indicator or --echo to ensure there are no blank lines in the output, or use --skip-unmapped to exclude those on the output.
diff --git a/applications/bed/bedmap/src/Bedmap.cpp b/applications/bed/bedmap/src/Bedmap.cpp
index 4692a33..c9a1870 100644
--- a/applications/bed/bedmap/src/Bedmap.cpp
+++ b/applications/bed/bedmap/src/Bedmap.cpp
@@ -28,6 +28,7 @@
 #include <map>
 #include <sstream>
 #include <string>
+#include <type_traits>
 #include <utility>
 #include <vector>
 
@@ -36,7 +37,9 @@
 #include "algorithm/visitors/helpers/ProcessVisitorRow.hpp"
 #include "algorithm/WindowSweep.hpp"
 #include "data/bed/AllocateIterator_BED_starch.hpp"
+#include "data/bed/AllocateIterator_BED_starch_minmem.hpp"
 #include "data/bed/BedCheckIterator.hpp"
+#include "data/bed/BedCheckIterator_minmem.hpp"
 #include "data/bed/BedDistances.hpp"
 #include "data/bed/BedTypes.hpp"
 #include "suite/BEDOPS.Version.hpp"
@@ -55,6 +58,18 @@ namespace BedMap {
   const std::string version = BEDOPS::revision();
   const std::string authors = "Shane Neph & Scott Kuehn";
   const std::string citation = BEDOPS::citation();
+  constexpr std::size_t PoolSz = 8*8*8;
+  bool minimumMemory = false;
+
+#if BEDOPS_BINARY_TYPE == 0
+  const std::string application_type = "typical";
+#else
+#if BEDOPS_BINARY_TYPE == 1
+  const std::string application_type = "megarow";
+#else
+  const std::string application_type = "typical";
+#endif
+#endif
 
   //======
   // Help
@@ -84,6 +99,8 @@ namespace BedMap {
                    const std::vector<std::string>& visitorNames,
                    const std::vector <std::vector<std::string> >& visitorArgs);
 
+  bool checkStarchNesting(const std::string&, const std::string&);
+
 } // namespace BedMap
 
 
@@ -101,9 +118,14 @@ int main(int argc, char **argv) {
 
     std::vector<std::string> visitorNames = input.visitorNames_;
     std::vector< std::vector<std::string> > visitorArgs = input.visitorArgs_;
-    int prec = input.precision_;
-    bool sci = input.useScientific_;
- 
+    const int prec = input.precision_;
+    const bool sci = input.useScientific_;
+    BedMap::minimumMemory = input.useMinMemory_;
+
+    // if all Starch inputs and no nested elements, then can use --faster if the
+    //   overlap criterion allows it.
+    const bool starchFast = !BedMap::checkStarchNesting(input.refFileName_, input.mapFileName_);
+
     if ( input.isPercMap_ ) { // % overlap relative to MapType's size (signalmapish)
       Bed::PercentOverlapMapping bedDist(input.percOvr_);
       Bed::Overlapping sweepDist(0); // dist type for sweep different from BedBaseVisitor's
@@ -125,12 +147,13 @@ int main(int argc, char **argv) {
                           input.minRefFields_, input.minMapFields_, input.errorCheck_,
                           input.outDelim_, input.multiDelim_, prec, sci, input.fastMode_,
                           input.sweepAll_, input.chrom_, input.skipUnmappedRows_, visitorNames, visitorArgs);
-    } else if ( input.isExact_ ) { // must be identical coordinates
+    } else if ( input.isExact_ ) { // must be identical coordinates; should work fine with fully-nested elements
       Bed::Exact bedDist;
       Bed::Overlapping sweepDist(0); // dist type for sweep different from BedBaseVisitor's
+      const bool fastMode = true;
       BedMap::selectSweep(sweepDist, bedDist, input.refFileName_, input.mapFileName_,
                           input.minRefFields_, input.minMapFields_, input.errorCheck_,
-                          input.outDelim_, input.multiDelim_, prec, sci, input.fastMode_,
+                          input.outDelim_, input.multiDelim_, prec, sci, fastMode,
                           input.sweepAll_, input.chrom_, input.skipUnmappedRows_, visitorNames, visitorArgs);
     } else if ( input.isPercEither_ ) { // % overlap relative to either MapType's or RefType's size
       Bed::PercentOverlapEither bedDist(input.percOvr_);
@@ -144,34 +167,34 @@ int main(int argc, char **argv) {
       Bed::RangedDist sweepDist(input.rangeBP_); // same as bedDist in this case
       BedMap::selectSweep(sweepDist, bedDist, input.refFileName_, input.mapFileName_,
                           input.minRefFields_, input.minMapFields_, input.errorCheck_,
-                          input.outDelim_, input.multiDelim_, prec, sci, input.fastMode_,
+                          input.outDelim_, input.multiDelim_, prec, sci, (input.fastMode_ || starchFast),
                           input.sweepAll_, input.chrom_, input.skipUnmappedRows_, visitorNames, visitorArgs);
     } else { // require a certain amount of bp overlap
       Bed::Overlapping bedDist(input.overlapBP_);
       Bed::Overlapping sweepDist(0); // dist type for sweep different from BedBaseVisitor's
       BedMap::selectSweep(sweepDist, bedDist, input.refFileName_, input.mapFileName_,
                           input.minRefFields_, input.minMapFields_, input.errorCheck_,
-                          input.outDelim_, input.multiDelim_, prec, sci, input.fastMode_,
+                          input.outDelim_, input.multiDelim_, prec, sci, (input.fastMode_ || starchFast),
                           input.sweepAll_, input.chrom_, input.skipUnmappedRows_, visitorNames, visitorArgs);
     }
 
-    return(EXIT_SUCCESS);
+    return EXIT_SUCCESS;
   } catch(const BedMap::Help& h) { // show usage and exit success
     std::cout << BedMap::prognm << std::endl;
     std::cout << "  citation: " << BedMap::citation << std::endl;
-    std::cout << "  version:  " << BedMap::version << std::endl;
+    std::cout << "  version:  " << BedMap::version + " (" + BedMap::application_type + ")" << std::endl;
     std::cout << "  authors:  " << BedMap::authors << std::endl;
     std::cout << BedMap::Usage() << std::endl;
-    return(EXIT_SUCCESS);
+    return EXIT_SUCCESS;
   } catch(const BedMap::Version& v) { // show version and exit success
     std::cout << BedMap::prognm << std::endl;
     std::cout << "  citation: " << BedMap::citation << std::endl;
-    std::cout << "  version:  " << BedMap::version << std::endl;
+    std::cout << "  version:  " << BedMap::version + " (" + BedMap::application_type + ")" << std::endl;
     std::cout << "  authors:  " << BedMap::authors << std::endl;
   } catch(const BedMap::NoInput& ni) { // show usage and exit failure
     std::cerr << BedMap::prognm << std::endl;
     std::cerr << "  citation: " << BedMap::citation << std::endl;
-    std::cerr << "  version:  " << BedMap::version << std::endl;
+    std::cerr << "  version:  " << BedMap::version + " (" + BedMap::application_type + ")" << std::endl;
     std::cerr << "  authors:  " << BedMap::authors << std::endl;
     std::cerr << BedMap::Usage() << std::endl;
   } catch(std::string& s) {
@@ -183,12 +206,22 @@ int main(int argc, char **argv) {
   } catch(...) {
     std::cerr << "Unknown Error.  Aborting" << std::endl;
   }
-  return(EXIT_FAILURE);
+  return EXIT_FAILURE;
 }
 
 
 namespace BedMap {
 
+  //=============
+  // get_pool()
+  //============
+  template <typename BedTypePtr>
+  Ext::PooledMemory<typename std::remove_pointer<BedTypePtr>::type, PoolSz>&
+  get_pool() {
+    static Ext::PooledMemory<typename std::remove_pointer<BedTypePtr>::type, PoolSz> pool;
+    return pool;
+  }
+
   //============
   // runSweep(): single-file mode
   //============
@@ -204,7 +237,7 @@ namespace BedMap {
                 bool skipUnmappedRows,
                 std::vector<BaseClass*>& visitorGroup) {
 
-    typedef typename BaseClass::RefType RefType;
+    typedef typename std::remove_const<typename BaseClass::RefType>::type RefType;
     typedef Visitors::Helpers::PrintDelim PrintType;
 
     // Set up visitors
@@ -216,34 +249,65 @@ namespace BedMap {
     if ( !errorCheck ) { // faster iterators
       // Create file handle iterators
       Ext::FPWrap<Ext::InvalidFile> refFile(refFileName);
-      Bed::allocate_iterator_starch_bed<RefType*> refFileI(refFile, chrom), refFileEnd;
+      if ( !minimumMemory ) {
+        auto& mem1 = get_pool<RefType*>();
+        Bed::allocate_iterator_starch_bed<RefType*, PoolSz> refFileI(refFile, mem1, chrom), refFileEnd;
 
-      // Do work
-      if ( !fastMode )
-        WindowSweep::sweep(refFileI, refFileEnd, st, multiv);
-      else // no nested elements
-        WindowSweep::sweep(refFileI, refFileEnd, dt, multiv);
-    } else {
-      // Create file handle iterators
-      bool isStdin = (refFileName == "-");
-      std::ifstream infile(refFileName.c_str());
-      if ( !isStdin && !infile )
-          throw(Ext::UserError("Unable to find: " + refFileName));
-      if ( isStdin ) {
-        Bed::bed_check_iterator<RefType*> refFileI(std::cin, refFileName, chrom, nestCheck);
-        Bed::bed_check_iterator<RefType*> refFileEnd;
+        // Do work
         if ( !fastMode )
           WindowSweep::sweep(refFileI, refFileEnd, st, multiv);
         else // no nested elements
           WindowSweep::sweep(refFileI, refFileEnd, dt, multiv);
-      } else {
-        Bed::bed_check_iterator<RefType*> refFileI(infile, refFileName, chrom, nestCheck);
-        Bed::bed_check_iterator<RefType*> refFileEnd;
+      } else { // old school minimal memory iterator
+        Bed::allocate_iterator_starch_bed_mm<RefType*> refFileI(refFile, chrom), refFileEnd;
+
+        // Do work
         if ( !fastMode )
           WindowSweep::sweep(refFileI, refFileEnd, st, multiv);
         else // no nested elements
           WindowSweep::sweep(refFileI, refFileEnd, dt, multiv);
       }
+    } else {
+      // Create file handle iterators
+      bool isStdin = (refFileName == "-");
+      std::ifstream infile(refFileName.c_str());
+      if ( !isStdin && !infile )
+          throw(Ext::UserError("Unable to find: " + refFileName));
+      if ( isStdin ) {
+        if ( !minimumMemory ) {
+          auto& mem1 = get_pool<RefType*>();
+          Bed::bed_check_iterator<RefType*, PoolSz> refFileI(std::cin, refFileName, mem1, chrom, nestCheck);
+          Bed::bed_check_iterator<RefType*, PoolSz> refFileEnd;
+          if ( !fastMode )
+            WindowSweep::sweep(refFileI, refFileEnd, st, multiv);
+          else // no nested elements
+            WindowSweep::sweep(refFileI, refFileEnd, dt, multiv);
+        } else { // old school minimum memory iterator
+          Bed::bed_check_iterator_mm<RefType*> refFileI(std::cin, refFileName, chrom, nestCheck);
+          Bed::bed_check_iterator_mm<RefType*> refFileEnd;
+          if ( !fastMode )
+            WindowSweep::sweep(refFileI, refFileEnd, st, multiv);
+          else // no nested elements
+            WindowSweep::sweep(refFileI, refFileEnd, dt, multiv);
+        }
+      } else {
+        if ( !minimumMemory ) {
+          auto& mem1 = get_pool<RefType*>();
+          Bed::bed_check_iterator<RefType*, PoolSz> refFileI(infile, refFileName, mem1, chrom, nestCheck);
+          Bed::bed_check_iterator<RefType*, PoolSz> refFileEnd;
+          if ( !fastMode )
+            WindowSweep::sweep(refFileI, refFileEnd, st, multiv);
+          else // no nested elements
+            WindowSweep::sweep(refFileI, refFileEnd, dt, multiv);
+        } else { // old school minimum memory iterator
+          Bed::bed_check_iterator_mm<RefType*> refFileI(infile, refFileName, chrom, nestCheck);
+          Bed::bed_check_iterator_mm<RefType*> refFileEnd;
+          if ( !fastMode )
+            WindowSweep::sweep(refFileI, refFileEnd, st, multiv);
+          else // no nested elements
+            WindowSweep::sweep(refFileI, refFileEnd, dt, multiv);
+        }
+      }
     }
 
     // multiv does cleanup
@@ -266,8 +330,8 @@ namespace BedMap {
                 bool skipUnmappedRows,
                 std::vector<BaseClass*>& visitorGroup) {
 
-    typedef typename BaseClass::RefType RefType;
-    typedef typename BaseClass::MapType MapType;
+    typedef typename std::remove_const<typename BaseClass::RefType>::type RefType;
+    typedef typename std::remove_const<typename BaseClass::MapType>::type MapType;
     typedef Visitors::Helpers::PrintDelim PrintType;
 
     // Set up visitors
@@ -279,15 +343,29 @@ namespace BedMap {
     if ( !errorCheck ) { // faster iterators
       // Create file handle iterators
       Ext::FPWrap<Ext::InvalidFile> refFile(refFileName);
-      Bed::allocate_iterator_starch_bed<RefType*> refFileI(refFile, chrom), refFileEnd;
-      Ext::FPWrap<Ext::InvalidFile> mapFile(mapFileName);
-      Bed::allocate_iterator_starch_bed<MapType*> mapFileI(mapFile, chrom), mapFileEnd;
+      if ( !minimumMemory ) {
+        auto& mem1 = get_pool<RefType*>();
+        Bed::allocate_iterator_starch_bed<RefType*, PoolSz> refFileI(refFile, mem1, chrom), refFileEnd;
+        Ext::FPWrap<Ext::InvalidFile> mapFile(mapFileName);
+        auto& mem2 = get_pool<MapType*>();
+        Bed::allocate_iterator_starch_bed<MapType*, PoolSz> mapFileI(mapFile, mem2, chrom), mapFileEnd;
+
+        // Do work
+        if ( !fastMode )
+          WindowSweep::sweep(refFileI, refFileEnd, mapFileI, mapFileEnd, st, multiv, sweepAll);
+        else // no nested elements
+          WindowSweep::sweep(refFileI, refFileEnd, mapFileI, mapFileEnd, dt, multiv, sweepAll);
+      } else { // old school minimal memory iterator
+        Bed::allocate_iterator_starch_bed_mm<RefType*> refFileI(refFile, chrom), refFileEnd;
+        Ext::FPWrap<Ext::InvalidFile> mapFile(mapFileName);
+        Bed::allocate_iterator_starch_bed_mm<MapType*> mapFileI(mapFile, chrom), mapFileEnd;
 
-      // Do work
-      if ( !fastMode )
-        WindowSweep::sweep(refFileI, refFileEnd, mapFileI, mapFileEnd, st, multiv, sweepAll);
-      else // no nested elements
-        WindowSweep::sweep(refFileI, refFileEnd, mapFileI, mapFileEnd, dt, multiv, sweepAll);
+        // Do work
+        if ( !fastMode )
+          WindowSweep::sweep(refFileI, refFileEnd, mapFileI, mapFileEnd, st, multiv, sweepAll);
+        else // no nested elements
+          WindowSweep::sweep(refFileI, refFileEnd, mapFileI, mapFileEnd, dt, multiv, sweepAll);
+      }
     } else {
       // Create file handle iterators
       typedef Ext::UserError EType;
@@ -302,27 +380,55 @@ namespace BedMap {
         throw(EType("Unable to find: " + mapFileName));
 
       // Do work
-      if ( isStdinRef ) {
-        Bed::bed_check_iterator<RefType*> refFileI(std::cin, refFileName, chrom, nestCheck), refFileEnd;
-        Bed::bed_check_iterator<MapType*> mapFileI(mfin, mapFileName, chrom, nestCheck), mapFileEnd;
-        if ( !fastMode )
-          WindowSweep::sweep(refFileI, refFileEnd, mapFileI, mapFileEnd, st, multiv, sweepAll);
-        else // no nested elements
-          WindowSweep::sweep(refFileI, refFileEnd, mapFileI, mapFileEnd, dt, multiv, sweepAll);
-      } else {
-        Bed::bed_check_iterator<RefType*> refFileI(rfin, refFileName, chrom, nestCheck), refFileEnd;
-        if ( isStdinMap ) {
-          Bed::bed_check_iterator<MapType*> mapFileI(std::cin, mapFileName, chrom, nestCheck), mapFileEnd;
+      if ( !minimumMemory ) {
+        auto& mem1 = get_pool<RefType*>();
+        auto& mem2 = get_pool<MapType*>();
+        if ( isStdinRef ) {
+          Bed::bed_check_iterator<RefType*, PoolSz> refFileI(std::cin, refFileName, mem1, chrom, nestCheck), refFileEnd;
+          Bed::bed_check_iterator<MapType*, PoolSz> mapFileI(mfin, mapFileName, mem2, chrom, nestCheck), mapFileEnd;
           if ( !fastMode )
             WindowSweep::sweep(refFileI, refFileEnd, mapFileI, mapFileEnd, st, multiv, sweepAll);
           else // no nested elements
             WindowSweep::sweep(refFileI, refFileEnd, mapFileI, mapFileEnd, dt, multiv, sweepAll);
         } else {
-          Bed::bed_check_iterator<MapType*> mapFileI(mfin, mapFileName, chrom, nestCheck), mapFileEnd;
+          Bed::bed_check_iterator<RefType*, PoolSz> refFileI(rfin, refFileName, mem1, chrom, nestCheck), refFileEnd;
+          if ( isStdinMap ) {
+            Bed::bed_check_iterator<MapType*, PoolSz> mapFileI(std::cin, mapFileName, mem2, chrom, nestCheck), mapFileEnd;
+            if ( !fastMode )
+              WindowSweep::sweep(refFileI, refFileEnd, mapFileI, mapFileEnd, st, multiv, sweepAll);
+            else // no nested elements
+              WindowSweep::sweep(refFileI, refFileEnd, mapFileI, mapFileEnd, dt, multiv, sweepAll);
+          } else {
+            Bed::bed_check_iterator<MapType*, PoolSz> mapFileI(mfin, mapFileName, mem2, chrom, nestCheck), mapFileEnd;
+            if ( !fastMode )
+              WindowSweep::sweep(refFileI, refFileEnd, mapFileI, mapFileEnd, st, multiv, sweepAll);
+            else // no nested elements
+              WindowSweep::sweep(refFileI, refFileEnd, mapFileI, mapFileEnd, dt, multiv, sweepAll);
+          }
+        }
+      } else { // old school minimal memory iterator
+        if ( isStdinRef ) {
+          Bed::bed_check_iterator_mm<RefType*> refFileI(std::cin, refFileName, chrom, nestCheck), refFileEnd;
+          Bed::bed_check_iterator_mm<MapType*> mapFileI(mfin, mapFileName, chrom, nestCheck), mapFileEnd;
           if ( !fastMode )
             WindowSweep::sweep(refFileI, refFileEnd, mapFileI, mapFileEnd, st, multiv, sweepAll);
           else // no nested elements
             WindowSweep::sweep(refFileI, refFileEnd, mapFileI, mapFileEnd, dt, multiv, sweepAll);
+        } else {
+          Bed::bed_check_iterator_mm<RefType*> refFileI(rfin, refFileName, chrom, nestCheck), refFileEnd;
+          if ( isStdinMap ) {
+            Bed::bed_check_iterator_mm<MapType*> mapFileI(std::cin, mapFileName, chrom, nestCheck), mapFileEnd;
+            if ( !fastMode )
+              WindowSweep::sweep(refFileI, refFileEnd, mapFileI, mapFileEnd, st, multiv, sweepAll);
+            else // no nested elements
+              WindowSweep::sweep(refFileI, refFileEnd, mapFileI, mapFileEnd, dt, multiv, sweepAll);
+          } else {
+            Bed::bed_check_iterator_mm<MapType*> mapFileI(mfin, mapFileName, chrom, nestCheck), mapFileEnd;
+            if ( !fastMode )
+              WindowSweep::sweep(refFileI, refFileEnd, mapFileI, mapFileEnd, st, multiv, sweepAll);
+            else // no nested elements
+              WindowSweep::sweep(refFileI, refFileEnd, mapFileI, mapFileEnd, dt, multiv, sweepAll);
+          }
         }
       }
     }
@@ -338,7 +444,7 @@ namespace BedMap {
     std::string t = s;
     for ( std::size_t i = 0; i < t.size(); ++i )
       t[i] = std::toupper(t[i]);
-    return(t);
+    return t;
   }
 
 
@@ -368,13 +474,12 @@ namespace BedMap {
                           const std::vector<std::string>&,
                           const std::string& multivalColSep,
                           int precision, bool useScientific) {
-  
+
       typedef VisitorTypes<BaseVisitor> VTypes;
       BaseVisitor* rtn = 0;
-  
+
       // Create an instance associated with each name in classNames
       std::string nm = upper(className);
-   
 
       if ( nm == visName<typename VTypes::Count>() )
         rtn = new typename VTypes::Count;
@@ -412,8 +517,7 @@ namespace BedMap {
         PT pt(precision, useScientific);
         rtn = new typename VTypes::OvrUniqFract(pt);
       }
-
-      return(rtn);
+      return rtn;
     }
   };
 
@@ -432,11 +536,11 @@ namespace BedMap {
                           const std::vector<std::string>& args,
                           const std::string& multivalColSep,
                           int precision, bool useScientific) {
-  
+
       typedef VisitorTypes<BaseVisitor> VTypes;
       BaseVisitor* rtn = SuperClass::generate(d, className, args, multivalColSep, precision, useScientific);
       if ( rtn )
-        return(rtn);
+        return rtn;
 
       // Create an instance associated with className
       std::string nm = upper(className);
@@ -449,7 +553,7 @@ namespace BedMap {
         rtn = new typename VTypes::EchoMapUniqueID(PT(multivalColSep));
       }
 
-      return(rtn);
+      return rtn;
     }
   };
 
@@ -468,11 +572,11 @@ namespace BedMap {
                           const std::vector<std::string>& args,
                           const std::string& multivalColSep,
                           int precision, bool useScientific) {
-  
+
       typedef VisitorTypes<BaseVisitor> VTypes;
       BaseVisitor* rtn = SuperClass::generate(d, className, args, multivalColSep, precision, useScientific);
       if ( rtn )
-        return(rtn);
+        return rtn;
 
       // Create an instance associated with className
       std::string nm = upper(className);
@@ -549,7 +653,7 @@ namespace BedMap {
       else if ( nm == visName<typename VTypes::WMean>() )
         rtn = new typename VTypes::WMean(pt);
 
-      return(rtn);
+      return rtn;
     }
   };
 
@@ -573,7 +677,63 @@ namespace BedMap {
       visitorGroup.push_back(bc);
       ++iter;
     } // while
-    return(visitorGroup);
+    return visitorGroup;
+  }
+
+  //==============
+  // SelectBED<>
+  //==============
+  template <int NFields, bool UseMemPool = true>
+  struct SelectBED;
+
+  template <>
+  struct SelectBED<3, true> {
+    typedef Bed::BTAllRest::Bed3Type BType;
+  };
+
+  template <>
+  struct SelectBED<4, true> {
+    typedef Bed::BTAllRest::Bed4Type BType;
+  };
+
+  template <>
+  struct SelectBED<5, true> {
+    typedef Bed::BTAllRest::Bed5Type BType;
+  };
+
+
+  template <>
+  struct SelectBED<3, false> {
+    typedef Bed::BTAllRestNoPool::Bed3Type BType;
+  };
+
+  template <>
+  struct SelectBED<4, false> {
+    typedef Bed::BTAllRestNoPool::Bed4Type BType;
+  };
+
+  template <>
+  struct SelectBED<5, false> {
+    typedef Bed::BTAllRestNoPool::Bed5Type BType;
+  };
+
+  //======================
+  // checkStarchNesting()
+  //======================
+  bool checkStarchNesting(const std::string& f1, const std::string& f2) {
+    constexpr bool NoUseMemPool = false;
+    typedef SelectBED<3, NoUseMemPool>::BType BedType;
+    if ( f1 == "-" || f2 == "-" )
+      return true; // not applicable
+    Ext::FPWrap<Ext::InvalidFile> file1(f1);
+    Bed::allocate_iterator_starch_bed_mm<BedType*> a(file1);
+    bool rtn = a.has_nested();
+    if ( !rtn && f2 != "" ) {
+      Ext::FPWrap<Ext::InvalidFile> file2(f2);
+      Bed::allocate_iterator_starch_bed_mm<BedType*> b(file2);
+      rtn = b.has_nested();
+    }
+    return rtn;
   }
 
   //==============
@@ -619,38 +779,77 @@ namespace BedMap {
     Ext::Assert<Ext::ProgramError>(minRefFields <= minMapFields,
                                    "BedMap::callSweep() minimum fields program error detected");
 
+    constexpr bool UseMemPool = true;
+    constexpr bool NoUseMemPool = !UseMemPool;
     const bool nestCheck = ProcessMode;
     if ( minMapFields < 4 ) { // just need Bed3
-      typedef Bed::B3Rest RefType;
-      typedef Bed::B3Rest MapType;
-      typedef typename SelectBase<ProcessMode, BedDistType, RefType, MapType>::BaseClass BaseClass;
-      BedMap::GenerateVisitors<BaseClass, 3> gv;
-      std::vector<BaseClass*> visitorGroup = getVisitors(gv, dt, multivalColSep, precision,
-                                                         useScientific, visitorNames, visitorArgs);
-      runSweep<BaseClass>(st, dt, refFileName, mapFileName, errorCheck, nestCheck,
-                          ProcessMode, sweepAll, colSep, chrom, skipUnmappedRows, visitorGroup);
+      if ( !BedMap::minimumMemory ) {
+        typedef typename SelectBED<3, UseMemPool>::BType RefType;
+        typedef RefType MapType;
+        typedef typename SelectBase<ProcessMode, BedDistType, RefType, MapType>::BaseClass BaseClass;
+        BedMap::GenerateVisitors<BaseClass, 3> gv;
+        std::vector<BaseClass*> visitorGroup = getVisitors(gv, dt, multivalColSep, precision,
+                                                           useScientific, visitorNames, visitorArgs);
+        runSweep<BaseClass>(st, dt, refFileName, mapFileName, errorCheck, nestCheck,
+                            ProcessMode, sweepAll, colSep, chrom, skipUnmappedRows, visitorGroup);
+      } else { // v2p4p26 and earlier mode
+        typedef typename SelectBED<3, NoUseMemPool>::BType RefType;
+        typedef RefType MapType;
+        typedef typename SelectBase<ProcessMode, BedDistType, RefType, MapType>::BaseClass BaseClass;
+        BedMap::GenerateVisitors<BaseClass, 3> gv;
+        std::vector<BaseClass*> visitorGroup = getVisitors(gv, dt, multivalColSep, precision,
+                                                           useScientific, visitorNames, visitorArgs);
+        runSweep<BaseClass>(st, dt, refFileName, mapFileName, errorCheck, nestCheck,
+                            ProcessMode, sweepAll, colSep, chrom, skipUnmappedRows, visitorGroup);
+      }
     } else if ( minMapFields < 5 ) { // just need Bed4 for Map and Bed3 for Ref
-      Ext::Assert<Ext::ProgramError>(minRefFields < minMapFields,
-                                     "BedMap::callSweep()-2 minimum fields program error detected");
-      typedef Bed::B3Rest RefType;
-      typedef Bed::B4Rest MapType;
-      typedef typename SelectBase<ProcessMode, BedDistType, RefType, MapType>::BaseClass BaseClass;
-      BedMap::GenerateVisitors<BaseClass, 4> gv;
-      std::vector<BaseClass*> visitorGroup = getVisitors(gv, dt, multivalColSep, precision,
-                                                         useScientific, visitorNames, visitorArgs);
-      runSweep<BaseClass>(st, dt, refFileName, mapFileName, errorCheck, nestCheck,
-                          ProcessMode, sweepAll, colSep, chrom, skipUnmappedRows, visitorGroup);
+      if ( !BedMap::minimumMemory ) {
+        Ext::Assert<Ext::ProgramError>(minRefFields < minMapFields,
+                                       "BedMap::callSweep()-2 minimum fields program error detected");
+        typedef typename SelectBED<3, UseMemPool>::BType RefType;
+        typedef typename SelectBED<4, UseMemPool>::BType MapType;
+        typedef typename SelectBase<ProcessMode, BedDistType, RefType, MapType>::BaseClass BaseClass;
+        BedMap::GenerateVisitors<BaseClass, 4> gv;
+        std::vector<BaseClass*> visitorGroup = getVisitors(gv, dt, multivalColSep, precision,
+                                                           useScientific, visitorNames, visitorArgs);
+        runSweep<BaseClass>(st, dt, refFileName, mapFileName, errorCheck, nestCheck,
+                            ProcessMode, sweepAll, colSep, chrom, skipUnmappedRows, visitorGroup);
+      } else { // v2p4p26 and earlier mode
+        Ext::Assert<Ext::ProgramError>(minRefFields < minMapFields,
+                                       "BedMap::callSweep()-2 minimum fields program error detected");
+        typedef typename SelectBED<3, NoUseMemPool>::BType RefType;
+        typedef typename SelectBED<4, NoUseMemPool>::BType MapType;
+        typedef typename SelectBase<ProcessMode, BedDistType, RefType, MapType>::BaseClass BaseClass;
+        BedMap::GenerateVisitors<BaseClass, 4> gv;
+        std::vector<BaseClass*> visitorGroup = getVisitors(gv, dt, multivalColSep, precision,
+                                                           useScientific, visitorNames, visitorArgs);
+        runSweep<BaseClass>(st, dt, refFileName, mapFileName, errorCheck, nestCheck,
+                            ProcessMode, sweepAll, colSep, chrom, skipUnmappedRows, visitorGroup);
+      }
     } else { // need Bed5 for Map and Bed3 for Ref
-      Ext::Assert<Ext::ProgramError>(minRefFields == 3,
-                                     "BedMap::callSweep()-2 minimum fields program error detected");
-      typedef Bed::B3Rest RefType;
-      typedef Bed::B5Rest MapType;
-      typedef typename SelectBase<ProcessMode, BedDistType, RefType, MapType>::BaseClass BaseClass;
-      BedMap::GenerateVisitors<BaseClass, 5> gv;
-      std::vector<BaseClass*> visitorGroup = getVisitors(gv, dt, multivalColSep, precision,
-                                                         useScientific, visitorNames, visitorArgs);
-      runSweep<BaseClass>(st, dt, refFileName, mapFileName, errorCheck, nestCheck,
-                          ProcessMode, sweepAll, colSep, chrom, skipUnmappedRows, visitorGroup);
+      if ( !BedMap::minimumMemory ) {
+        Ext::Assert<Ext::ProgramError>(minRefFields == 3,
+                                       "BedMap::callSweep()-2 minimum fields program error detected");
+        typedef typename SelectBED<3, UseMemPool>::BType RefType;
+        typedef typename SelectBED<5, UseMemPool>::BType MapType;
+        typedef typename SelectBase<ProcessMode, BedDistType, RefType, MapType>::BaseClass BaseClass;
+        BedMap::GenerateVisitors<BaseClass, 5> gv;
+        std::vector<BaseClass*> visitorGroup = getVisitors(gv, dt, multivalColSep, precision,
+                                                           useScientific, visitorNames, visitorArgs);
+        runSweep<BaseClass>(st, dt, refFileName, mapFileName, errorCheck, nestCheck,
+                            ProcessMode, sweepAll, colSep, chrom, skipUnmappedRows, visitorGroup);
+      } else { // v2p4p26 and earlier mode
+        Ext::Assert<Ext::ProgramError>(minRefFields == 3,
+                                       "BedMap::callSweep()-2 minimum fields program error detected");
+        typedef typename SelectBED<3, NoUseMemPool>::BType RefType;
+        typedef typename SelectBED<5, NoUseMemPool>::BType MapType;
+        typedef typename SelectBase<ProcessMode, BedDistType, RefType, MapType>::BaseClass BaseClass;
+        BedMap::GenerateVisitors<BaseClass, 5> gv;
+        std::vector<BaseClass*> visitorGroup = getVisitors(gv, dt, multivalColSep, precision,
+                                                           useScientific, visitorNames, visitorArgs);
+        runSweep<BaseClass>(st, dt, refFileName, mapFileName, errorCheck, nestCheck,
+                            ProcessMode, sweepAll, colSep, chrom, skipUnmappedRows, visitorGroup);
+      }
     }
   }
 
@@ -672,31 +871,63 @@ namespace BedMap {
                  const std::vector<std::string>& visitorNames,
                  const std::vector< std::vector<std::string> >& visitorArgs) {
 
-    const bool nestCheck = ProcessMode;
+    constexpr bool nestCheck = ProcessMode;
+    constexpr bool UseMemPool = true;
+    constexpr bool NoUseMemPool = !UseMemPool;
     if ( minRefFields < 4 ) { // just need Bed3
-      typedef Bed::B3Rest RefType;
-      typedef typename SelectBase<ProcessMode, BedDistType, RefType, RefType>::BaseClass BaseClass;
-      BedMap::GenerateVisitors<BaseClass, 3> gv;
-      std::vector<BaseClass*> visitorGroup = getVisitors(gv, dt, multivalColSep, precision,
-                                                         useScientific, visitorNames, visitorArgs);
-      runSweep<BaseClass>(st, dt, refFileName, errorCheck, nestCheck,
-                          ProcessMode, colSep, chrom, skipUnmappedRows, visitorGroup);
+      if ( !BedMap::minimumMemory ) {
+        typedef typename SelectBED<3, UseMemPool>::BType RefType;
+        typedef typename SelectBase<ProcessMode, BedDistType, RefType, RefType>::BaseClass BaseClass;
+        BedMap::GenerateVisitors<BaseClass, 3> gv;
+        std::vector<BaseClass*> visitorGroup = getVisitors(gv, dt, multivalColSep, precision,
+                                                           useScientific, visitorNames, visitorArgs);
+        runSweep<BaseClass>(st, dt, refFileName, errorCheck, nestCheck,
+                            ProcessMode, colSep, chrom, skipUnmappedRows, visitorGroup);
+      } else { // v2p4p26 and earlier mode
+        typedef typename SelectBED<3, NoUseMemPool>::BType RefType;
+        typedef typename SelectBase<ProcessMode, BedDistType, RefType, RefType>::BaseClass BaseClass;
+        BedMap::GenerateVisitors<BaseClass, 3> gv;
+        std::vector<BaseClass*> visitorGroup = getVisitors(gv, dt, multivalColSep, precision,
+                                                           useScientific, visitorNames, visitorArgs);
+        runSweep<BaseClass>(st, dt, refFileName, errorCheck, nestCheck,
+                            ProcessMode, colSep, chrom, skipUnmappedRows, visitorGroup);
+      }
     } else if ( minRefFields < 5 ) { // need Bed4
-      typedef Bed::B4Rest RefType;
-      typedef typename SelectBase<ProcessMode, BedDistType, RefType, RefType>::BaseClass BaseClass;
-      BedMap::GenerateVisitors<BaseClass, 4> gv;
-      std::vector<BaseClass*> visitorGroup = getVisitors(gv, dt, multivalColSep, precision,
-                                                         useScientific, visitorNames, visitorArgs);
-      runSweep<BaseClass>(st, dt, refFileName, errorCheck, nestCheck,
-                          ProcessMode, colSep, chrom, skipUnmappedRows, visitorGroup);
+      if ( !BedMap::minimumMemory ) {
+        typedef typename SelectBED<4, UseMemPool>::BType RefType;
+        typedef typename SelectBase<ProcessMode, BedDistType, RefType, RefType>::BaseClass BaseClass;
+        BedMap::GenerateVisitors<BaseClass, 4> gv;
+        std::vector<BaseClass*> visitorGroup = getVisitors(gv, dt, multivalColSep, precision,
+                                                           useScientific, visitorNames, visitorArgs);
+        runSweep<BaseClass>(st, dt, refFileName, errorCheck, nestCheck,
+                            ProcessMode, colSep, chrom, skipUnmappedRows, visitorGroup);
+      } else { // v2p4p26 and earlier mode
+        typedef typename SelectBED<4, NoUseMemPool>::BType RefType;
+        typedef typename SelectBase<ProcessMode, BedDistType, RefType, RefType>::BaseClass BaseClass;
+        BedMap::GenerateVisitors<BaseClass, 4> gv;
+        std::vector<BaseClass*> visitorGroup = getVisitors(gv, dt, multivalColSep, precision,
+                                                           useScientific, visitorNames, visitorArgs);
+        runSweep<BaseClass>(st, dt, refFileName, errorCheck, nestCheck,
+                            ProcessMode, colSep, chrom, skipUnmappedRows, visitorGroup);
+      }
     } else { // need Bed5
-      typedef Bed::B5Rest RefType;
-      typedef typename SelectBase<ProcessMode, BedDistType, RefType, RefType>::BaseClass BaseClass;
-      BedMap::GenerateVisitors<BaseClass, 5> gv;
-      std::vector<BaseClass*> visitorGroup = getVisitors(gv, dt, multivalColSep, precision,
-                                                         useScientific, visitorNames, visitorArgs);
-      runSweep<BaseClass>(st, dt, refFileName, errorCheck, nestCheck,
-                          ProcessMode, colSep, chrom, skipUnmappedRows, visitorGroup);
+      if ( !BedMap::minimumMemory ) {
+        typedef typename SelectBED<5, UseMemPool>::BType RefType;
+        typedef typename SelectBase<ProcessMode, BedDistType, RefType, RefType>::BaseClass BaseClass;
+        BedMap::GenerateVisitors<BaseClass, 5> gv;
+        std::vector<BaseClass*> visitorGroup = getVisitors(gv, dt, multivalColSep, precision,
+                                                           useScientific, visitorNames, visitorArgs);
+        runSweep<BaseClass>(st, dt, refFileName, errorCheck, nestCheck,
+                            ProcessMode, colSep, chrom, skipUnmappedRows, visitorGroup);
+      } else { // v2p4p26 and earlier mode
+        typedef typename SelectBED<5, NoUseMemPool>::BType RefType;
+        typedef typename SelectBase<ProcessMode, BedDistType, RefType, RefType>::BaseClass BaseClass;
+        BedMap::GenerateVisitors<BaseClass, 5> gv;
+        std::vector<BaseClass*> visitorGroup = getVisitors(gv, dt, multivalColSep, precision,
+                                                           useScientific, visitorNames, visitorArgs);
+        runSweep<BaseClass>(st, dt, refFileName, errorCheck, nestCheck,
+                            ProcessMode, colSep, chrom, skipUnmappedRows, visitorGroup);
+      }
     }
   }
 
diff --git a/applications/bed/bedmap/src/Input.hpp b/applications/bed/bedmap/src/Input.hpp
index 9432798..d658f5d 100644
--- a/applications/bed/bedmap/src/Input.hpp
+++ b/applications/bed/bedmap/src/Input.hpp
@@ -76,7 +76,7 @@ namespace BedMap {
       : refFileName_(""), mapFileName_(""), rangeBP_(0), overlapBP_(0),
         percOvr_(0.0), isPercMap_(false), isPercRef_(false), isPercEither_(false),
         isPercBoth_(false), isRangeBP_(false), isOverlapBP_(false), isExact_(false),
-        precision_(6), useScientific_(false), setPrec_(false), numFiles_(0),
+        precision_(6), useScientific_(false), useMinMemory_(false), setPrec_(false), numFiles_(0),
         minRefFields_(0), minMapFields_(0), errorCheck_(false), sweepAll_(false),
         outDelim_("|"), multiDelim_(";"), fastMode_(false), rangeAlias_(false),
         chrom_("all"), skipUnmappedRows_(false) {
@@ -130,6 +130,8 @@ namespace BedMap {
           skipUnmappedRows_ = true;
         } else if ( next == "sci" ) {
           useScientific_ = true;
+        } else if ( next == "min-memory" ) {
+          useMinMemory_ = true;
         } else if ( next == "prec" ) {
           Ext::Assert<ArgError>(argcntr < argc, "No precision value given");
           Ext::Assert<ArgError>(!setPrec_, "--prec specified multiple times.");
@@ -384,6 +386,7 @@ namespace BedMap {
     bool isExact_;
     int precision_;
     bool useScientific_;
+    bool useMinMemory_;
     bool setPrec_;
     unsigned int numFiles_;
     unsigned int minRefFields_;
@@ -471,6 +474,7 @@ namespace BedMap {
     usage << "                              --bp-ovr, --range, --fraction-both, and --exact overlap options only. \n";
     usage << "      --header              Accept headers (VCF, GFF, SAM, BED, WIG) in any input file.             \n";
     usage << "      --help                Print this message and exit successfully.                               \n";
+    usage << "      --min-memory          Minimize memory usage (slower).                                         \n";
     usage << "      --multidelim <delim>  Change delimiter of multi-value output columns from ';' to <delim>.     \n";
     usage << "      --prec <int>          Change the post-decimal precision of scores to <int>.  0 <= <int>.      \n";
     usage << "      --sci                 Use scientific notation for score outputs.                              \n";
diff --git a/applications/bed/bedmap/src/Makefile b/applications/bed/bedmap/src/Makefile
index a006b24..6c63449 100644
--- a/applications/bed/bedmap/src/Makefile
+++ b/applications/bed/bedmap/src/Makefile
@@ -19,28 +19,37 @@ LOCALBZIP2INCDIR    = ${LOCALBZIP2DIR}
 LOCALZLIBDIR        = ${PARTY3}/zlib
 LOCALZLIBLIB        = ${LOCALZLIBDIR}/${LIBZLIB}
 LOCALZLIBINCDIR     = ${LOCALZLIBDIR}
-OBJDIR              = objects
+OBJDIR              = objects_${BINARY_TYPE}
 INCLUDES            = -iquote${HEAD} -I${PARTY3} -I${LOCALJANSSONINCDIR} -I${LOCALBZIP2INCDIR} -I${LOCALZLIBINCDIR}
 LIBLOCATION         = -L${LOCALJANSSONLIBDIR} -L${LOCALBZIP2LIBDIR} -L${LOCALZLIBDIR}
 LIBRARIES           = ${LOCALJANSSONLIB} ${LOCALBZIP2LIB} ${LOCALZLIBLIB}
 BLDFLAGS            = -Wall -pedantic -O3 -std=c++11 
 SFLAGS              = -static
 
+ifeq ($(BINARY_TYPE),)
+	TFLAG = -DBEDOPS_BINARY_TYPE=0
+else
+	TFLAG = -DBEDOPS_BINARY_TYPE=$(BINARY_TYPE_NUM)
+endif
+
 dependency_names    = NaN starchConstants starchFileHelpers starchHelpers starchMetadataHelpers unstarchHelpers starchSha1Digest starchBase64Coding
 dependencies        = $(addprefix $(OBJDIR)/, $(addsuffix .o, $(dependency_names)))
-FLAGS               = ${SFLAGS} -s ${BLDFLAGS} $(dependencies) ${LIBLOCATION} ${INCLUDES}
-DFLAGS              = ${SFLAGS} -g -O0 -std=c++11 -DDEBUG=1 -fno-inline -Wall -pedantic $(dependencies) ${LIBLOCATION} ${INCLUDES}
-GPROFFLAGS          = ${SFLAGS} -pg -O -std=c++11 -Wall -pedantic $(dependencies) ${LIBLOCATION} ${INCLUDES}
+FLAGS               = ${TFLAG} ${SFLAGS} ${MEGAFLAGS} -s ${BLDFLAGS} $(dependencies) ${LIBLOCATION} ${INCLUDES}
+DFLAGS              = ${TFLAG} ${SFLAGS} ${MEGAFLAGS} -g -O0 -std=c++11 -DDEBUG=1 -fno-inline -Wall -pedantic $(dependencies) ${LIBLOCATION} ${INCLUDES}
+GPROFFLAGS          = ${TFLAG} ${SFLAGS} ${MEGAFLAGS} -pg -O -std=c++11 -Wall -pedantic $(dependencies) ${LIBLOCATION} ${INCLUDES}
 
 SOURCE1             = Bedmap.cpp
 BINDIR              = ../bin
-PROG                = bedmap
+PROG                = bedmap-${BINARY_TYPE}
 
 build: $(BINDIR)/$(PROG)
+	rm -rf ${OBJDIR}
 
 build_gprof: $(BINDIR)/gprof.$(PROG)
+	rm -rf ${OBJDIR}
 
 build_debug: $(BINDIR)/debug.$(PROG)
+	rm -rf ${OBJDIR}
 
 dependencies: $(dependencies)
 
@@ -60,7 +69,5 @@ $(OBJDIR)/%.o : $(LIB3)/%.c
 	mkdir -p $(OBJDIR) && $(CXX) -c ${BLDFLAGS} $^ -o $@ ${INCLUDES}
 
 clean:
-	rm -f ${BINDIR}/${PROG}
-	rm -f ${BINDIR}/*.${PROG}
 	rm -rf ${OBJDIR}
 	rm -rf ${BINDIR}
diff --git a/applications/bed/bedmap/src/Makefile.darwin b/applications/bed/bedmap/src/Makefile.darwin
index 8faa142..9be3a08 100644
--- a/applications/bed/bedmap/src/Makefile.darwin
+++ b/applications/bed/bedmap/src/Makefile.darwin
@@ -1,5 +1,3 @@
-MIN_OSX_VERSION      = 10.7
-
 MAIN                 = ../../../..
 MAINAPPDIR           = ../..
 HEAD                 = $(MAIN)/interfaces/general-headers
@@ -8,7 +6,7 @@ LIB2                 = $(MAIN)/interfaces/src/utility
 LIB3                 = $(MAIN)/interfaces/src/data/starch
 THISDIR              = ${shell pwd}
 PARTY3               = ${THISDIR}/$(MAIN)/third-party
-OBJDIR               = objects_$(ARCH)
+OBJDIR               = objects_$(ARCH)_${BINARY_TYPE}
 LIBJANSSON           = libjansson.a
 LIBBZIP2             = libbz2.a
 LIBZLIB              = libz.a
@@ -30,24 +28,33 @@ LIBRARIES            = ${LOCALJANSSONLIB} ${LOCALBZIP2LIB} ${LOCALZLIBLIB}
 STDFLAGS             = -Wall -pedantic -std=c++11 -stdlib=libc++
 BLDFLAGS             = -O3 ${STDFLAGS}
 
-FLAGS                = $(BLDFLAGS) $(OBJDIR)/NaN.o $(OBJDIR)/starchConstants.o $(OBJDIR)/starchFileHelpers.o $(OBJDIR)/starchHelpers.o $(OBJDIR)/starchMetadataHelpers.o $(OBJDIR)/unstarchHelpers.o $(OBJDIR)/starchSha1Digest.o $(OBJDIR)/starchBase64Coding.o ${LIBLOCATION} ${INCLUDES}
+ifeq ($(BINARY_TYPE),)
+	TFLAG = -DBEDOPS_BINARY_TYPE=0
+else
+	TFLAG = -DBEDOPS_BINARY_TYPE=$(BINARY_TYPE_NUM)
+endif
+
+FLAGS                = $(TFLAG) $(BLDFLAGS) $(OBJDIR)/NaN.o $(OBJDIR)/starchConstants.o $(OBJDIR)/starchFileHelpers.o $(OBJDIR)/starchHelpers.o $(OBJDIR)/starchMetadataHelpers.o $(OBJDIR)/unstarchHelpers.o $(OBJDIR)/starchSha1Digest.o $(OBJDIR)/starchBase64Coding.o ${LIBLOCATION} ${INCLUDES}
 
-DFLAGS               = -g -O0 -DDEBUG=1 ${STDFLAGS} $(OBJDIR)/NaN.o $(OBJDIR)/starchConstants.o $(OBJDIR)/starchFileHelpers.o $(OBJDIR)/starchHelpers.o $(OBJDIR)/starchMetadataHelpers.o $(OBJDIR)/unstarchHelpers.o $(OBJDIR)/starchSha1Digest.o $(OBJDIR)/starchBase64Coding.o ${LIBLOCATION} ${INCLUDES}
+DFLAGS               = -g -O0 -DDEBUG=1 $(TFLAG) ${STDFLAGS} $(OBJDIR)/NaN.o $(OBJDIR)/starchConstants.o $(OBJDIR)/starchFileHelpers.o $(OBJDIR)/starchHelpers.o $(OBJDIR)/starchMetadataHelpers.o $(OBJDIR)/unstarchHelpers.o $(OBJDIR)/starchSha1Digest.o $(OBJDIR)/starchBase64Coding.o ${LIBLOCATION} ${INCLUDES}
 
-GPROFFLAGS           = -O -pg ${STDFLAGS} $(OBJDIR)/NaN.o $(OBJDIR)/starchConstants.o $(OBJDIR)/starchFileHelpers.o $(OBJDIR)/starchHelpers.o $(OBJDIR)/starchMetadataHelpers.o $(OBJDIR)/unstarchHelpers.o $(OBJDIR)/starchSha1Digest.o $(OBJDIR)/starchBase64Coding.o ${LIBLOCATION} ${INCLUDES}
+GPROFFLAGS           = -O -pg $(TFLAG) ${STDFLAGS} $(OBJDIR)/NaN.o $(OBJDIR)/starchConstants.o $(OBJDIR)/starchFileHelpers.o $(OBJDIR)/starchHelpers.o $(OBJDIR)/starchMetadataHelpers.o $(OBJDIR)/unstarchHelpers.o $(OBJDIR)/starchSha1Digest.o $(OBJDIR)/starchBase64Coding.o ${LIBLOCATION} ${INCLUDES}
 
 SOURCE1              = Bedmap.cpp
 BINDIR               = ../bin
-PROG                 = bedmap
+PROG                 = bedmap-${BINARY_TYPE}
 
 build: dependencies
-	$(CXX) -o $(BINDIR)/$(PROG)_$(ARCH) $(FLAGS) -mmacosx-version-min=$(MIN_OSX_VERSION) -arch $(ARCH) ${LIBRARIES} $(SOURCE1)
+	$(CXX) -o $(BINDIR)/$(PROG) $(FLAGS) -mmacosx-version-min=$(MIN_OSX_VERSION) -arch $(ARCH) ${LIBRARIES} $(SOURCE1)
+	rm -rf $(OBJDIR)
 
 build_debug: dependencies
-	$(CXX) -o $(BINDIR)/debug.$(PROG)_$(ARCH) $(DFLAGS) -mmacosx-version-min=$(MIN_OSX_VERSION) -arch $(ARCH) ${LIBRARIES} $(SOURCE1)
+	$(CXX) -o $(BINDIR)/debug.$(PROG) $(DFLAGS) -mmacosx-version-min=$(MIN_OSX_VERSION) -arch $(ARCH) ${LIBRARIES} $(SOURCE1)
+	rm -rf $(OBJDIR)
 
 build_gprof: dependencies
-	$(CXX) -o $(BINDIR)/gprof.$(PROG)_$(ARCH) $(GPROFFLAGS) -mmacosx-version-min=$(MIN_OSX_VERSION) -arch $(ARCH) ${LIBRARIES} $(SOURCE1)
+	$(CXX) -o $(BINDIR)/gprof.$(PROG) $(GPROFFLAGS) -mmacosx-version-min=$(MIN_OSX_VERSION) -arch $(ARCH) ${LIBRARIES} $(SOURCE1)
+	rm -rf $(OBJDIR)
 
 dependencies:
 	rm -rf $(OBJDIR)
diff --git a/applications/bed/bedmap/src/TDefs.hpp b/applications/bed/bedmap/src/TDefs.hpp
index b7c8202..6711c57 100644
--- a/applications/bed/bedmap/src/TDefs.hpp
+++ b/applications/bed/bedmap/src/TDefs.hpp
@@ -70,9 +70,9 @@ namespace BedMap {
     typedef Visitors::Average<ProcessScorePrecision, BaseClass> Average;
     typedef Visitors::CoeffVariation<ProcessScorePrecision, BaseClass> CoeffVariation;
     typedef Visitors::Count<ProcessScore, BaseClass> Count;
+    typedef Visitors::Indicator<ProcessScore, BaseClass> Indicator;
     typedef Visitors::RollingKthAverage<ProcessScorePrecision, BaseClass, Ext::ArgumentError> KthAverage;
     typedef Visitors::Extreme<ProcessScorePrecision, BaseClass, MaxOrderArb> Max;
-    typedef Visitors::Indicator<ProcessScore, BaseClass> Indicator;
     typedef Visitors::Median<ProcessScorePrecision, BaseClass> Median;
     typedef Visitors::MedianAbsoluteDeviation<ProcessScorePrecision, BaseClass> MedianAbsoluteDeviation;
     typedef Visitors::Extreme<ProcessScorePrecision, BaseClass, MinOrderArb> Min;
diff --git a/applications/bed/bedops/doc/Usage.Statement.Version1.2 b/applications/bed/bedops/doc/Usage.Statement.Version1.2
deleted file mode 100644
index 29d6575..0000000
--- a/applications/bed/bedops/doc/Usage.Statement.Version1.2
+++ /dev/null
@@ -1,35 +0,0 @@
- bedops version: 1.2
-        authors: Shane Neph & Scott Kuehn
-
-      USAGE: bedops [process-flags] <operation> <File(s)>*
-          Every input file must be sorted per the sort-bed utility.
-          May use '-' for a file to indicate reading from standard input.
-          Each operation requires a minimum number of files as shown below.
-            There is no fixed maximum number of files that may be used.
-          Input files must have at least the first 3 columns of the BED specification,
-            and every end coordinate must be 1 bp beyond the end of its interval.
-
-      Process Flags:
-          --ec                Error check input files (slower).
-          --help              Print this message and exit successfully.
-          --help-<operation>  Detailed help on <operation>.
-                                An example is --help-c or --help--complement
-          --range <val>       Pad input file(s) symmetrically by <val> which may be
-                                negative to shrink or remove regions.  With -e/-n
-                                operations, the first/reference file is not padded.
-
-      Operations: (choose one of)
-          -c, --complement [-L] File1 [File]*
-          -d, --difference ReferenceFile File2 [File]*
-          -e, --element-of [-number% | -number (in bp)] ReferenceFile File2 [File]*
-                 by default, -e -100% is used.
-          -i, --intersect File1 File2 [File]*
-          -m, --merge File1 [File]*
-          -n, --not-element-of [-number% | -number (in bp)] ReferenceFile File2 [File]*
-                 by default, -n -100% is used.
-          -s, --symmdiff File1 File2 [File]*
-          -u, --everything File1 [File]*
-
-      NOTE: Only operations -e|n|u preserve all columns (no flattening)
-        Example: bedops --range 10 -u file1.bed
-
diff --git a/applications/bed/bedops/src/BedPadReader.hpp b/applications/bed/bedops/src/BedPadReader.hpp
index 7995181..39d658c 100644
--- a/applications/bed/bedops/src/BedPadReader.hpp
+++ b/applications/bed/bedops/src/BedPadReader.hpp
@@ -113,6 +113,10 @@ struct BedPadReader {
     cache_.push_back(bt);
   }
 
+  inline void Remove(BedType* bt) {
+    iter_.get_pool().release(bt);
+  }
+
   inline BedType* ReadLine() {
     static const bool done = false;
     static BedType* tmp = static_cast<BedType*>(0);
@@ -140,7 +144,7 @@ struct BedPadReader {
             return(tmp);
           }
           else // tmp vaporized by padding
-            delete tmp;
+            Remove(tmp);
         } else if ( lpad_ < 0 ) {
           if ( tmp->chrom() != lastChr_ ) { // cache_ is empty && iter_ != end
             getFirst(); // iter_ increments dealt with in getFirst()
@@ -168,7 +172,7 @@ struct BedPadReader {
 
   void Clean() {
     while ( !cache_.empty() ) {
-      delete cache_.back();
+      Remove(cache_.back());
       cache_.pop_back();
     }
   }
@@ -177,12 +181,12 @@ struct BedPadReader {
     Clean();
     BedType* tmp = static_cast<BedType*>(0);
     while ( (tmp = ReadLine()) )
-      delete tmp;
+      Remove(tmp);
   }
 
   ~BedPadReader() {
     while ( !cache_.empty() ) {
-      delete cache_.back();
+      Remove(cache_.back());
       cache_.pop_back();
     }
   }
@@ -204,7 +208,7 @@ private:
     MType mset;
     SType sset;
     TieType tmap;
-    BedType* const zero = static_cast<BedType*>(0);
+    static BedType* const zero = static_cast<BedType*>(0);
     BedType* tmp = zero;
     static const IterType end;
     const Bed::CoordType lpd = static_cast<Bed::CoordType>(std::abs(lpad_));
@@ -217,12 +221,12 @@ private:
           mset.insert(tmp);
           break; // all others meet the invariant condition: tmp->start() > lpd
         } else { // lpad_ < 0 and rpad_ < lpad_
-          delete tmp;
+          Remove(tmp);
           continue;
         }
       }
       if ( static_cast<double>(tmp->end()) + rpad_ <= 0 ) {
-        delete tmp;
+        Remove(tmp);
         continue;
       }
       tmp->start(0);
diff --git a/applications/bed/bedops/src/Bedops.cpp b/applications/bed/bedops/src/Bedops.cpp
index 9fb741f..a8a4e05 100644
--- a/applications/bed/bedops/src/Bedops.cpp
+++ b/applications/bed/bedops/src/Bedops.cpp
@@ -46,6 +46,8 @@
 #include "suite/BEDOPS.Version.hpp"
 #include "utility/Exception.hpp"
 #include "utility/FPWrap.hpp"
+#include "utility/PooledMemory.hpp"
+#include "utility/Typify.hpp"
 
 #include "BedPadReader.hpp"
 #include "Input.hpp"
@@ -59,6 +61,43 @@ namespace { // unnamed
   // not a valid coordinate range
   static const PType NADA_NOTHING = std::make_pair(1, 0);
 
+  constexpr std::size_t PoolSz = 512; // could be many input files though all will share through get_pool()
+  constexpr bool NODESTRUCT = false;
+  Ext::PooledMemory<Bed::B3Rest, PoolSz, NODESTRUCT> memRest;
+  Ext::PooledMemory<Bed::B3NoRest, PoolSz, NODESTRUCT> memNoRest;
+
+  inline
+  void Remove(Bed::B3Rest* p) {
+    memRest.release(p);
+  }
+
+  inline
+  Bed::B3Rest* CopyCreate(Bed::B3Rest const* p) {
+    return memRest.construct(*p);
+  }
+
+  inline
+  void Remove(Bed::B3NoRest* p) {
+    memNoRest.release(p);
+  }
+
+  inline
+  Bed::B3NoRest* CopyCreate(Bed::B3NoRest const* p) {
+    return memNoRest.construct(*p);
+  }
+
+  auto
+  get_pool_details(Ext::Type2Type<Bed::B3Rest*>) -> decltype(memRest)&
+    { return memRest; }
+
+  auto
+  get_pool_details(Ext::Type2Type<Bed::B3NoRest*>) -> decltype(memNoRest)&
+    { return memNoRest; }
+
+  template <typename BedTypePtr>
+  auto
+  get_pool() -> decltype( get_pool_details(Ext::Type2Type<BedTypePtr>()) )
+    { return get_pool_details(Ext::Type2Type<BedTypePtr>()); }
 } // unnamed
 
 
@@ -70,6 +109,16 @@ namespace BedOperations {
   const std::string version = BEDOPS::revision();
   const std::string authors = "Shane Neph & Scott Kuehn";
 
+#if BEDOPS_BINARY_TYPE == 0
+  const std::string application_type = "typical";
+#else
+#if BEDOPS_BINARY_TYPE == 1
+  const std::string application_type = "megarow";
+#else
+  const std::string application_type = "typical";
+#endif
+#endif
+
   void doWork(const Input& input);
 } // namespace BedOperations
 
@@ -87,7 +136,7 @@ int main(int argc, char** argv) {
   } catch(BedOperations::HelpException& h) {
     std::cout << BedOperations::prognm << std::endl;
     std::cout << "  citation: " + BedOperations::citation << std::endl;
-    std::cout << "  version:  " + BedOperations::version << std::endl;
+    std::cout << "  version:  " + BedOperations::version + " (" + BedOperations::application_type + ")" << std::endl;
     std::cout << "  authors:  " + BedOperations::authors << std::endl;
     std::cout << BedOperations::Usage() << std::endl;
     return(EXIT_SUCCESS);
@@ -95,7 +144,7 @@ int main(int argc, char** argv) {
     try {
       std::cout << BedOperations::prognm << std::endl;
       std::cout << "  citation: " + BedOperations::citation << std::endl;
-      std::cout << "  version:  " + BedOperations::version << std::endl;
+      std::cout << "  version:  " + BedOperations::version + " (" + BedOperations::application_type + ")" << std::endl;
       std::cout << "  authors:  " + BedOperations::authors << std::endl;
       std::cout << BedOperations::DetailedUsage(e.m_) << std::endl;
     } catch(const std::exception& s) {
@@ -105,13 +154,13 @@ int main(int argc, char** argv) {
   } catch(BedOperations::Version& v) {
     std::cout << BedOperations::prognm << std::endl;
     std::cout << "  citation: " + BedOperations::citation << std::endl;
-    std::cout << "  version:  " + BedOperations::version << std::endl;
+    std::cout << "  version:  " + BedOperations::version + " (" + BedOperations::application_type + ")" << std::endl;
     std::cout << "  authors:  " + BedOperations::authors << std::endl;
     return(EXIT_SUCCESS);
   } catch(BedOperations::NoInput& ni) {
     std::cout << BedOperations::prognm << std::endl;
     std::cout << "  citation: " + BedOperations::citation << std::endl;
-    std::cout << "  version:  " + BedOperations::version << std::endl;
+    std::cout << "  version:  " + BedOperations::version + " (" + BedOperations::application_type + ")" << std::endl;
     std::cout << "  authors:  " + BedOperations::authors << std::endl;
     std::cerr << BedOperations::Usage() << std::endl;
   } catch(std::string& s) {
@@ -159,7 +208,7 @@ struct GetType {
   typedef typename NoPtr<typename BedFiles::value_type>::Type::BedType BedType;
 
   /*
-    A c++ priority queue return the greatest element first.  This is done, by default
+    A c++ priority queue returns the greatest element first.  This is done, by default
       using std::less<>.  If you want the least element, you have to use std::greater<>.
     In our case, the analogs are Bed::GenomicAddressCompare for std::less<> (max element
       first), and Bed::InvertGenomicAddressCompare for std::greater<> (min element first).
@@ -173,6 +222,20 @@ struct GetType {
                   BedType*, std::vector<BedType*>,
                   Bed::GenomicAddressCompare<BedType, BedType>
                              > PQ;
+
+  template <typename BedType>
+  struct InvertedBedWithFileIdx : public Bed::InvertGenomicRestAddressCompare<BedType, BedType> {
+    typedef Bed::InvertGenomicRestAddressCompare<BedType, BedType> Base;
+    inline bool operator()(std::pair<BedType*, int>& p1, std::pair<BedType*, int>& p2) {
+      return Base::operator()(p1.first, p2.first);
+    }
+  };
+
+  // use when BedType has full_rest() and you need to keep track of which file it came from
+  typedef std::priority_queue<
+                  std::pair<BedType*, int>, std::vector<std::pair<BedType*, int>>,
+                  InvertedBedWithFileIdx<BedType>
+                             > IPQ_Rest;
 };
 
 //=============
@@ -225,14 +288,17 @@ struct createWork {
     std::vector<FPType*> filePointers;
     BedReaderType1* refFile = static_cast<BedReaderType1*>(0);
     BedReaderContainer bedFiles;
+    auto& mem1 = get_pool<typename IterType1::value_type>();
+    auto& mem2 = get_pool<typename IterType2::value_type>();
+
     for ( int i = 0; i < input.NumberFiles(); ++i ) {
       nextFilePtr = new FPType(input.GetFileName(i));
       filePointers.push_back(nextFilePtr);
       if ( 0 == i ) {
-        IterType1 fileI(*nextFilePtr, input.Chrom());
+        IterType1 fileI(*nextFilePtr, mem1, input.Chrom());
         refFile = new BedReaderType1(fileI, 0, 0); // never pad sole reference file
       } else {
-        IterType2 t(*nextFilePtr, input.Chrom());
+        IterType2 t(*nextFilePtr, mem2, input.Chrom());
         bedFiles.push_back(new BedReaderType2(t, input.GetLeftPad(), input.GetRightPad()));
       }
     } // for
@@ -266,10 +332,11 @@ struct createWork<IterType, IterType> {
     FPType* nextFilePtr = static_cast<FPType*>(0);
     std::vector<FPType*> filePointers;
     BedReaderContainer bedFiles;
+    auto& mem = get_pool<typename IterType::value_type>();
     for ( int i = 0; i < input.NumberFiles(); ++i ) {
       nextFilePtr = new FPType(input.GetFileName(i));
       filePointers.push_back(nextFilePtr);
-      IterType t(*nextFilePtr, input.Chrom());
+      IterType t(*nextFilePtr, mem, input.Chrom());
       bedFiles.push_back(new BedReaderType(t, input.GetLeftPad(), input.GetRightPad()));
     } // for
 
@@ -288,21 +355,24 @@ struct createWork<IterType, IterType> {
 //=================
 // createWork<T,U> : specialization for error checking
 //=================
-template <typename BedType1, typename BedType2>
-struct createWork< Bed::bed_check_iterator<BedType1*>, Bed::bed_check_iterator<BedType2*> > {
+template <typename BedType1, typename BedType2, std::size_t Sz>
+struct createWork< Bed::bed_check_iterator<BedType1*, Sz>, Bed::bed_check_iterator<BedType2*, Sz> > {
   static void run(const Input& input) {
     typedef std::ifstream* StreamPtr;
-    typedef Bed::bed_check_iterator<BedType1*> IterType1;
-    typedef Bed::bed_check_iterator<BedType2*> IterType2;
+    typedef Bed::bed_check_iterator<BedType1*, Sz> IterType1;
+    typedef Bed::bed_check_iterator<BedType2*, Sz> IterType2;
     typedef BedPadReader<IterType1> BedReaderType1;
     typedef BedPadReader<IterType2> BedReaderType2;
     typedef std::vector<BedReaderType2*> BedReaderContainer;
-    typedef typename Bed::bed_check_iterator<BedType1*>::Exception Error;
+    typedef typename Bed::bed_check_iterator<BedType1*, Sz>::Exception Error;
 
     StreamPtr nextFilePtr = static_cast<StreamPtr>(0);
     std::vector<StreamPtr> filePointers;
     BedReaderType1* refFile = static_cast<BedReaderType1*>(0);
     BedReaderContainer bedFiles;
+    auto& mem1 = get_pool<BedType1*>();
+    auto& mem2 = get_pool<BedType2*>();
+
     for ( int i = 0; i < input.NumberFiles(); ++i ) {
       // Create file handle iterators
       bool isStdin = (input.GetFileName(i) == "-");
@@ -313,22 +383,22 @@ struct createWork< Bed::bed_check_iterator<BedType1*>, Bed::bed_check_iterator<B
 
       if ( 0 == i ) {
         if ( isStdin ) {
-          IterType1 fileI(std::cin, "stdin", input.Chrom());
+          IterType1 fileI(std::cin, "stdin", mem1, input.Chrom());
           refFile = new BedReaderType1(fileI, 0, 0); // never pad sole Reference File
         } else {
           if ( !nextFilePtr || !(*nextFilePtr) )
             throw(Error("Unable to find file: " + input.GetFileName(i)));
-          IterType1 fileI(*nextFilePtr, input.GetFileName(i), input.Chrom());
+          IterType1 fileI(*nextFilePtr, input.GetFileName(i), mem1, input.Chrom());
           refFile = new BedReaderType1(fileI, 0, 0); // never pad sole Reference File
         }
       } else {
         if ( isStdin ) {
-          IterType2 fileI(std::cin, "stdin", input.Chrom());
+          IterType2 fileI(std::cin, "stdin", mem2, input.Chrom());
           bedFiles.push_back(new BedReaderType2(fileI, input.GetLeftPad(), input.GetRightPad()));
         } else {
           if ( !nextFilePtr || !(*nextFilePtr) )
             throw(Error("Unable to find file: " + input.GetFileName(i)));
-          IterType2 fileI(*nextFilePtr, input.GetFileName(i), input.Chrom());
+          IterType2 fileI(*nextFilePtr, input.GetFileName(i), mem2, input.Chrom());
           bedFiles.push_back(new BedReaderType2(fileI, input.GetLeftPad(), input.GetRightPad()));
         }
       }
@@ -354,30 +424,32 @@ struct createWork< Bed::bed_check_iterator<BedType1*>, Bed::bed_check_iterator<B
 //=================
 // createWork<T,T> : specialization for error checking
 //=================
-template <typename BedType>
-struct createWork< Bed::bed_check_iterator<BedType*>, Bed::bed_check_iterator<BedType*> > {
+template <typename BedType, std::size_t Sz>
+struct createWork< Bed::bed_check_iterator<BedType*, Sz>, Bed::bed_check_iterator<BedType*, Sz> > {
   static void run(const Input& input) {
     typedef std::ifstream* StreamPtr;
-    typedef Bed::bed_check_iterator<BedType*> IterType;
+    typedef Bed::bed_check_iterator<BedType*, Sz> IterType;
     typedef BedPadReader<IterType> BedReaderType;
     typedef std::vector<BedReaderType*> BedReaderContainer;
-    typedef typename Bed::bed_check_iterator<BedType*>::Exception Error;
+    typedef typename Bed::bed_check_iterator<BedType*, Sz>::Exception Error;
 
     StreamPtr nextFilePtr = static_cast<StreamPtr>(0);
     std::vector<StreamPtr> filePointers;
     BedReaderContainer bedFiles;
+    auto& mem = get_pool<BedType*>();
+
     for ( int i = 0; i < input.NumberFiles(); ++i ) {
       // Create file handle iterators
       bool isStdin = (input.GetFileName(i) == "-");
       if ( isStdin ) {
-        IterType fileI(std::cin, "stdin", input.Chrom());
+        IterType fileI(std::cin, "stdin", mem, input.Chrom());
         bedFiles.push_back(new BedReaderType(fileI, input.GetLeftPad(), input.GetRightPad()));
       } else {
         nextFilePtr = new std::ifstream(input.GetFileName(i).c_str());
         filePointers.push_back(nextFilePtr);
         if ( !nextFilePtr || !(*nextFilePtr) )
           throw(Error("Unable to find file: " + input.GetFileName(i)));
-        IterType fileI(*nextFilePtr, input.GetFileName(i), input.Chrom());
+        IterType fileI(*nextFilePtr, input.GetFileName(i), mem, input.Chrom());
         bedFiles.push_back(new BedReaderType(fileI, input.GetLeftPad(), input.GetRightPad()));
       }
     } // for
@@ -405,26 +477,26 @@ void doWork(const Input& input) {
   if ( mode == UNIONALL ) { // Keep all columns in all files
     typedef Bed::B3Rest BedType;
     if ( errorCheck )
-      createWork< Bed::bed_check_iterator<BedType*> >::run(input);
+      createWork< Bed::bed_check_iterator<BedType*, PoolSz> >::run(input);
     else
-      createWork< Bed::allocate_iterator_starch_bed<BedType*> >::run(input);
+      createWork< Bed::allocate_iterator_starch_bed<BedType*, PoolSz> >::run(input);
   }
   else if ( mode == ELEMENTOF || mode == NOTELEMENTOF ) { // Keep all columns only in first file
     typedef Bed::B3Rest BedType1;
     typedef Bed::B3NoRest BedType2;
     if ( errorCheck )
-      createWork< Bed::bed_check_iterator<BedType1*>,
-                  Bed::bed_check_iterator<BedType2*> >::run(input);
+      createWork< Bed::bed_check_iterator<BedType1*, PoolSz>,
+                  Bed::bed_check_iterator<BedType2*, PoolSz> >::run(input);
     else
-      createWork< Bed::allocate_iterator_starch_bed<BedType1*>,
-                  Bed::allocate_iterator_starch_bed<BedType2*> >::run(input);
+      createWork< Bed::allocate_iterator_starch_bed<BedType1*, PoolSz>,
+                  Bed::allocate_iterator_starch_bed<BedType2*, PoolSz> >::run(input);
   }
   else { // Only use 3 columns
     typedef Bed::B3NoRest BedType;
     if ( errorCheck )
-      createWork< Bed::bed_check_iterator<BedType*> >::run(input);
+      createWork< Bed::bed_check_iterator<BedType*, PoolSz> >::run(input);
     else
-      createWork< Bed::allocate_iterator_starch_bed<BedType*> >::run(input);
+      createWork< Bed::allocate_iterator_starch_bed<BedType*, PoolSz> >::run(input);
   }
 }
 
@@ -462,7 +534,7 @@ void doChop(BedFiles& bedFiles, Bed::CoordType chunkSize, Bed::CoordType stagger
       else
         i += stagger;
     } // for
-    delete r;
+    Remove(r);
   } // while
 }
 
@@ -483,7 +555,7 @@ void doComplement(BedFiles& bedFiles, bool fullLeft) {
       break;
     else if ( !nextline.first ) {
       record(nextline.second);
-      delete nextline.second;
+      Remove(nextline.second);
     }
   } // while
 }
@@ -494,19 +566,20 @@ void doComplement(BedFiles& bedFiles, bool fullLeft) {
 template <typename BedFiles>
 std::pair<bool, typename GetType<BedFiles>::BedType*>
   nextDifferenceLine(BedFiles&,
-                     typename GetType<BedFiles>::BedType*& nextRefMerge,
+                     typename GetType<BedFiles>::BedType*&,
                      typename GetType<BedFiles>::BedType*&);
 
 template <typename BedFiles>
 void doDifference(BedFiles& bedFiles) {
   typedef typename GetType<BedFiles>::BedType BedType;
   static BedType* const zero = static_cast<BedType*>(0);
-  const int noRef = 1; // 0 is master index
+  const int refIdx = 0;
+  const int noRefIdx = 1;
 
   bool done = false;
   std::pair<bool, BedType*> nextline = std::make_pair(false, zero);
   BedType* nextRefMerge = zero;
-  BedType* nextNonRefMerge = nextMergeAllLines(noRef, bedFiles.size(), bedFiles);
+  BedType* nextNonRefMerge = nextMergeAllLines(noRefIdx, bedFiles.size(), bedFiles);
   while ( !done ) {
     nextline = nextDifferenceLine(bedFiles, nextRefMerge, nextNonRefMerge);
     if ( !nextline.second )
@@ -514,11 +587,11 @@ void doDifference(BedFiles& bedFiles) {
     else if ( !nextline.first ) {
       record(nextline.second);
       if ( nextRefMerge == nextline.second ) {
-        delete nextRefMerge;
+        bedFiles[refIdx]->Remove(nextRefMerge);
         nextRefMerge = zero;
       }
-      else
-        delete nextline.second;
+      else // begotten from CopyCreate() in nextDifferenceLine
+        Remove(nextline.second);
     }
   } // while
 }
@@ -555,12 +628,12 @@ void doElementOf(RefFile& refFile, NonRefFiles& nonRefBedFiles, double thres, bo
     else if ( !r.first && r.second )
       record(nextRef);
 
-    delete nextRef;
+    Remove(nextRef);
     nextRef = getNextFileLine(refFile); // unmerged; may be zero
   } // while
 
   while ( !q.empty() ) {
-    delete q.front();
+    Remove(q.front());
     q.pop_front();
   } // while
 }
@@ -582,7 +655,7 @@ void doIntersection(BedFiles& bedFiles) {
     if ( !next )
       break;
     record(next);
-    delete next;
+    Remove(next);
   } // while
 }
 
@@ -600,7 +673,7 @@ void doMerge(BedFiles& bedFiles) {
     if ( !r )
       break;
     record(r);
-    delete r;
+    Remove(r);
     r = zero;
   } // while
 }
@@ -627,20 +700,20 @@ void doPartitions(BedFiles& bedFiles) {
     pq.pop();
     if ( pq.empty() ) {
       record(mn);
-      delete mn;
+      Remove(mn);
     } else {
-      BedType lcl = *mn;
+      BedType* lcl = CopyCreate(mn);
       BedType* curr = mn;
       while ( !pq.empty() ) {
         BedType* ct = pq.top(); // guaranteed to overlap mn, and not extend beyond mn
         pq.pop();
         if ( curr->end() <= ct->start() ) {
           record(curr);
-          delete curr;
+          Remove(curr);
           curr = ct;
         } else if ( ct->start() == curr->start() ) {
           if ( ct->end() == curr->end() ) { // dups
-            delete ct;
+            Remove(ct);
           } else { // ct->end() > curr->end()
             ct->start(curr->end());
             pq.push(ct);
@@ -651,9 +724,9 @@ void doPartitions(BedFiles& bedFiles) {
             } // while
             ct = pq.top(); // may not be an element whose start() we just redefined
                            // not popping on purpose
-            lcl.start(curr->start());
-            lcl.end(ct->start());
-            record(&lcl);
+            lcl->start(curr->start());
+            lcl->end(ct->start());
+            record(lcl);
 
             if ( curr->end() != ct->start() ) {
               // ct could be fully nested in curr
@@ -661,15 +734,15 @@ void doPartitions(BedFiles& bedFiles) {
               curr->start(ct->start());
               pq.push(curr);
             } else { // curr is no longer useful
-              delete curr;
+              Remove(curr);
             }
             curr = pq.top();
             pq.pop();
           }
         } else { // overlap and curr->start() < ct->start()
-          lcl.start(curr->start());
-          lcl.end(ct->start());
-          record(&lcl);
+          lcl->start(curr->start());
+          lcl->end(ct->start());
+          record(lcl);
           // ct could be fully nested in curr, and
           //  order could change after next modification.
           curr->start(ct->start());
@@ -679,8 +752,9 @@ void doPartitions(BedFiles& bedFiles) {
           pq.pop();
         }
       } // while
+      Remove(lcl);
       record(curr);
-      delete curr;
+      Remove(curr);
     }
   } // while
 }
@@ -708,7 +782,7 @@ void doSymmetricDifference(BedFiles& bedFiles) {
     if ( !nextDiff.second ) {
       if ( !first ) {
         record(toRecord);
-        delete toRecord;
+        Remove(toRecord);
         toRecord = zero;
       }
       break;
@@ -719,7 +793,7 @@ void doSymmetricDifference(BedFiles& bedFiles) {
       if ( !toRecord || std::strcmp(toRecord->chrom(), nextDiff.second->chrom()) != 0 ) {
         if ( !first && toRecord ) {
           record(toRecord);
-          delete toRecord;
+          Remove(toRecord);
         }
         toRecord = nextDiff.second;
       }
@@ -728,13 +802,13 @@ void doSymmetricDifference(BedFiles& bedFiles) {
         if ( !overlap ) {
           if ( !first ) {
             record(toRecord);
-            delete toRecord;
+            Remove(toRecord);
           }
           toRecord = nextDiff.second;
         }
         else {
-          delete toRecord;
-          delete nextDiff.second;
+          Remove(toRecord);
+          Remove(nextDiff.second);
           toRecord = overlap;
         }
       }
@@ -743,12 +817,12 @@ void doSymmetricDifference(BedFiles& bedFiles) {
   } // while
 
   if ( toRecord )
-    delete toRecord;
+    Remove(toRecord);
 }
 
-//==============
-// doUnionAll()
-//==============
+//=================================
+// doUnionAll() and doUnionAllPQ()
+//=================================
 template <typename BedFiles>
 typename std::enable_if<GetType<BedFiles>::BedType::UseRest, typename GetType<BedFiles>::BedType>::type*
 nextUnionAllLine(BedFiles&); /* requires BedType::UseRest to be true */
@@ -770,7 +844,7 @@ void doUnionAll(BedFiles& bedFiles) {
     while ( bedFiles[0]->HasNext() ) {
       r = bedFiles[0]->ReadLine();
       record(r);
-      delete r;
+      bedFiles[0]->Remove(r);
     } // while
     return;
   }
@@ -781,7 +855,42 @@ void doUnionAll(BedFiles& bedFiles) {
     if ( !r )
       break;
     record(r);
-    delete r;
+    Remove(r);
+  } // while
+}
+
+template <typename BedFiles>
+void doUnionAllPQ(BedFiles& bedFiles) {
+  /* meant for cases with large numbers of input files (50+ maybe) */
+  /* If inputs have duplicate entries, output will too */
+  typedef typename GetType<BedFiles>::BedType BedType;
+  typename GetType<BedFiles>::IPQ_Rest pq; // union uses full_rest()
+  static BedType* const zero = static_cast<BedType*>(0);
+
+  BedType* r = zero;
+  if ( 1 == bedFiles.size() ) {
+    /* a simple cat command, possibly post-padded as
+         dealt with in BedPadReader. */
+    while ( bedFiles[0]->HasNext() ) {
+      r = bedFiles[0]->ReadLine();
+      record(r);
+      bedFiles[0]->Remove(r);
+    } // while
+    return;
+  }
+
+  for ( std::size_t i = 0; i < bedFiles.size(); ++i ) {
+    if ( bedFiles[i]->HasNext() )
+      pq.push(std::make_pair(bedFiles[i]->ReadLine(), i));
+  } // for
+
+  while ( !pq.empty() ) {
+    const std::pair<BedType*, int> val = pq.top();
+    pq.pop();
+    record(val.first);
+    bedFiles[val.second]->Remove(val.first);
+    if ( bedFiles[val.second]->HasNext() )
+      pq.push(std::make_pair(bedFiles[val.second]->ReadLine(), val.second));
   } // while
 }
 
@@ -801,8 +910,8 @@ typename BedFile::BedType* getNextFileMergedCoords(BedFile& bedFile) {
     BedType* next = bedFile.ReadLine();
     BedType* merged = mergeOverlap(next, toRtn);
     if ( merged ) {
-      delete toRtn;
-      delete next;
+      bedFile.Remove(toRtn);
+      bedFile.Remove(next);
       toRtn = merged;
       next = zero;
     } else {
@@ -870,16 +979,16 @@ BedType* mergeOverlap(const BedType* p1, const BedType* p2) {
     return(toRtn);
   } else if ( p1->start() < p2->start() ) {
     if ( p1->end() >= p2->start() ) {
-      toRtn = new BedType(*p1);
+      toRtn = CopyCreate(p1);
       toRtn->end(std::max(p1->end(), p2->end()));
     }
   } else if ( p1->start() > p2->start() ) {
     if ( p2->end() >= p1->start() ) {
-      toRtn = new BedType(*p2);
+      toRtn = CopyCreate(p2);
       toRtn->end(std::max(p1->end(), p2->end()));
     }
   } else { // p1->start() == p2->start()
-    toRtn = new BedType(*p1);
+    toRtn = CopyCreate(p1);
     toRtn->end(std::max(p1->end(), p2->end()));
   }
   return(toRtn);
@@ -900,35 +1009,35 @@ std::pair<bool, typename GetType<BedFiles>::BedType*> nextComplementLine(BedFile
       return(std::make_pair(false, zero));
     else if ( fullLeft ) {
       // new chromosome -> first complement starts at base 0
-      BedType* tmp = new BedType(*last);
+      BedType* tmp = CopyCreate(last);
       tmp->start(0);
       tmp->end(last->start());
       if ( tmp->start() != tmp->end() )
         return(std::make_pair(false, tmp));
       else { // input coordinates include base 0 -> not part of complement
-        delete tmp;
+        Remove(tmp);
         return(std::make_pair(true, last));
       }
     }
   }
   BedType* nextline = nextMergeAllLines(0, bedFiles.size(), bedFiles);
   if ( nextline == zero ) { // stop condition
-    delete last;
+    Remove(last);
     last = zero;
     return(std::make_pair(false, zero));
   }
 
   if ( 0 != std::strcmp(nextline->chrom(), last->chrom()) ) {
-    delete last;
+    Remove(last);
     last = nextline;
     if ( fullLeft ) { // chrom change -> first complement starts at base 0
-      BedType* tmp = new BedType(*last);
+      BedType* tmp = CopyCreate(last);
       tmp->start(0);
       tmp->end(last->start());
       if ( tmp->start() != tmp->end() )
         return(std::make_pair(false, tmp));
       else { // input coordinates include base 0 -> not part of complement
-        delete tmp;
+        Remove(tmp);
         return(std::make_pair(true, last));
       }
     }
@@ -952,6 +1061,7 @@ std::pair<bool, typename GetType<BedFiles>::BedType*>
     nextDifferenceLine(BedFiles& bedFiles,
                        typename GetType<BedFiles>::BedType*& nextRefMerge,
                        typename GetType<BedFiles>::BedType*& nextNonRefMerge) {
+
   // Index 0 is the reference file
   typedef typename GetType<BedFiles>::BedType BedType;
   static BedType* const zero = static_cast<BedType*>(0);
@@ -976,7 +1086,7 @@ std::pair<bool, typename GetType<BedFiles>::BedType*>
   // Increment nextNonRefMerge until its back within range of nextRefMerge
   int cmp = std::strcmp(nextNonRefMerge->chrom(), nextRefMerge->chrom());
   while ( cmp < 0 || (0 == cmp && nextNonRefMerge->end() <= nextRefMerge->start()) ) {
-    delete nextNonRefMerge;
+    Remove(nextNonRefMerge);
     nextNonRefMerge = nextMergeAllLines(noRef, bedFiles.size(), bedFiles);
     if ( !nextNonRefMerge ) // always true after first true
       return(std::make_pair(noRecurse, nextRefMerge));
@@ -989,19 +1099,19 @@ std::pair<bool, typename GetType<BedFiles>::BedType*>
     return(std::make_pair(noRecurse, nextRefMerge));
   } else if ( nextNonRefMerge->start() <= nextRefMerge->start() && nextNonRefMerge->end() >= nextRefMerge->end() ) {
     /* complete reference overlap */
-    delete nextRefMerge;
+    bedFiles[ref]->Remove(nextRefMerge);
     nextRefMerge = getNextFileMergedCoords(*bedFiles[ref]);
     return(std::make_pair(callAgain, nextRefMerge)); // possible for nextRefMerge to be zero
     // direct recursion removed to prevent any possible stack overflow
     // return(nextDifferenceLine(bedFiles, nextRefMerge, nextNonRefMerge)); // curse some more
   } else if ( nextNonRefMerge->start() > nextRefMerge->start() ) {
     /* difference found up to nextNonRefMerge->start() */
-    BedType* toRtn = new BedType(*nextRefMerge);
+    BedType* toRtn = CopyCreate(nextRefMerge);
     toRtn->end(nextNonRefMerge->start());
     cmp = 0;
     nextRefMerge->start(nextNonRefMerge->end()); // safe if > nextRefMerge->end() momentarily
     while ( 0 == cmp && nextNonRefMerge->end() >= nextRefMerge->end() ) {
-      delete nextRefMerge;
+      bedFiles[ref]->Remove(nextRefMerge);
       nextRefMerge = getNextFileMergedCoords(*bedFiles[ref]);
       if ( !nextRefMerge )
         break;
@@ -1050,7 +1160,7 @@ std::pair<bool, typename RefFile::BedType*>
   // Increment nextMerge until its back within range of nextRef
   int cmp = std::strcmp(nextMerge->chrom(), nextRef->chrom());
   while ( cmp < 0 || (0 == cmp && nextMerge->end() <= nextRef->start()) ) {
-    delete nextMerge;
+    Remove(nextMerge);
     nextMerge = getNextMerge(mergeList, 0, nonRefBedFiles.size(), nonRefBedFiles);
     if ( !nextMerge ) {
       if ( !invert ) // ref cannot be an element of nothing
@@ -1134,13 +1244,13 @@ typename GetType<BedFiles>::BedType* nextIntersectLine(BedFiles& bedFiles) {
   } // for
 
 
-  toRtn = new BedType(*toRtn);
+  toRtn = CopyCreate(toRtn);
   int marker = -1;
   Bed::CoordType maxVal = std::numeric_limits<Bed::CoordType>::max();
   for ( int i = 0; i < static_cast<int>(bedFiles.size()); ++i ) { // find next intersection
     if ( !bedFiles[i]->HasNext() ) { // no more intersections
       if ( toRtn )
-        delete toRtn;
+        Remove(toRtn);
       return(zero);
     }
 
@@ -1148,10 +1258,10 @@ typename GetType<BedFiles>::BedType* nextIntersectLine(BedFiles& bedFiles) {
 
     int val = std::strcmp(next->chrom(), toRtn->chrom());
     while ( val < 0 || (val == 0 && next->end() <= toRtn->start()) ) {
-      delete next;
+      Remove(next);
       next = getNextFileMergedCoords(*bedFiles[i]);
       if ( !next ) { // no more intersections
-        delete toRtn;
+        Remove(toRtn);
         return(zero);
       }
       val = std::strcmp(next->chrom(), toRtn->chrom());
@@ -1159,8 +1269,8 @@ typename GetType<BedFiles>::BedType* nextIntersectLine(BedFiles& bedFiles) {
 
     bedFiles[i]->PushBack(next);
     if ( val > 0 || next->start() >= toRtn->end() ) {
-      delete toRtn;
-      toRtn = new BedType(*next);
+      Remove(toRtn);
+      toRtn = CopyCreate(next);
       i = -1;
       marker = -1;
       maxVal = std::numeric_limits<Bed::CoordType>::max();
@@ -1176,7 +1286,7 @@ typename GetType<BedFiles>::BedType* nextIntersectLine(BedFiles& bedFiles) {
     }
   } // for
   next = getNextFileMergedCoords(*bedFiles[marker]); // at least one file increment
-  delete next;
+  Remove(next);
   return(toRtn);
 }
 
@@ -1184,7 +1294,8 @@ typename GetType<BedFiles>::BedType* nextIntersectLine(BedFiles& bedFiles) {
 // nextMergeAllLines()
 //====================
 template <typename BedFiles>
-typename GetType<BedFiles>::BedType* nextMergeAllLines(int start, int end, BedFiles& bedFiles) {
+typename GetType<BedFiles>::BedType*
+nextMergeAllLines(int start, int end, BedFiles& bedFiles) {
 
   // Merge coordinates between files
   typedef typename GetType<BedFiles>::BedType BedType;
@@ -1221,7 +1332,7 @@ typename GetType<BedFiles>::BedType* nextMergeAllLines(int start, int end, BedFi
       continue;
     bt = bedFiles[i]->ReadLine();
     while ( 0 == (val = std::strcmp(bt->chrom(), toRtn->chrom())) && bt->end() <= toRtn->end() ) {
-      delete bt;
+      bedFiles[i]->Remove(bt);
       bt = bedFiles[i]->ReadLine();
       if ( !bt )
         break;
@@ -1233,7 +1344,7 @@ typename GetType<BedFiles>::BedType* nextMergeAllLines(int start, int end, BedFi
          bt->start() <= toRtn->end() &&
          bt->end() > toRtn->end() ) {
       toRtn->end(bt->end());
-      delete bt;
+      bedFiles[i]->Remove(bt);
       i = (start - 1); // start over on next iteration
     } else if ( bt ) {
       bedFiles[i]->PushBack(bt);
@@ -1302,7 +1413,7 @@ void nextPartitionGroup(BedFiles& bedFiles, PQueue& pq) {
 
       if ( bt->start() == minelem->start() ) {
         if ( bt->end() == minelem->end() ) // duplicate
-          delete bt;
+          bedFiles[i]->Remove(bt);
         else { // bt->end() > minelem->end(), no new info for pq
           bt->start(minelem->end());
           lclQ.push(bt);
@@ -1320,7 +1431,7 @@ void nextPartitionGroup(BedFiles& bedFiles, PQueue& pq) {
         if ( bt->end() <= minelem->end() ) // fully-nested or shared-end coord
           pq.push(bt);
         else { // bt->end() > minelem->end()
-          BedType* cpy = new BedType(*bt);
+          BedType* cpy = CopyCreate(bt);
           cpy->start(minelem->end());
           lclQ.push(cpy);
           bt->end(minelem->end());
@@ -1427,7 +1538,7 @@ std::pair<bool, typename GetType<BedFiles>::BedType*>
         b->start(minSecond);
         bedFiles[allMins[x]]->PushBack(b);
       } else {
-        delete b;
+        bedFiles[allMins[x]]->Remove(b);
       }
     } // for
     return(std::make_pair(callAgain, min)); // min just has to be nonzero; not used
@@ -1436,7 +1547,7 @@ std::pair<bool, typename GetType<BedFiles>::BedType*>
   } else if ( allMins.size() == 1 ) { // case 3
     BedType* b = bedFiles[allMins[0]]->ReadLine();
     if ( minSecond > nextFirst ) {
-      BedType* c = new BedType(*b);
+      BedType* c = CopyCreate(b);
       c->end(nextFirst);
       b->start(nextFirst); // multiple new mins for next time
       bedFiles[allMins[0]]->PushBack(b);
@@ -1458,7 +1569,7 @@ std::pair<bool, typename GetType<BedFiles>::BedType*>
           b->start(minSecond);
           bedFiles[allMins[x]]->PushBack(b);
         } else {
-          delete b;
+          bedFiles[allMins[x]]->Remove(b);
         }
       } // for
     }
@@ -1502,7 +1613,7 @@ nextUnionAllLine(BedFiles& bedFiles) {
             first = next;
             marker = i;
           } else if ( next->end() == first->end() ) {
-            if ( strcmp(next->rest(), first->rest()) < 0 ) {
+            if ( strcmp(next->full_rest(), first->full_rest()) < 0 ) {
               first = next;
               marker = i;
             }
@@ -1548,8 +1659,12 @@ void selectWork(const Input& input, BedFiles& bedFiles) {
       doSymmetricDifference(bedFiles);
       break;
     case UNIONALL:
-      if ( GetType<BedFiles>::BedType::UseRest )
-        doUnionAll(bedFiles);
+      if ( GetType<BedFiles>::BedType::UseRest ) {
+        if ( bedFiles.size() < 10 )
+          doUnionAll(bedFiles);
+        else
+          doUnionAllPQ(bedFiles);
+      } // else linker will fail
       break;
     default:
       throw(Ext::ProgramError("Unsupported mode"));
diff --git a/applications/bed/bedops/src/Makefile b/applications/bed/bedops/src/Makefile
index 30f187c..3e80d1f 100644
--- a/applications/bed/bedops/src/Makefile
+++ b/applications/bed/bedops/src/Makefile
@@ -21,27 +21,36 @@ LOCALBZIP2INCDIR    = ${LOCALBZIP2DIR}
 LOCALZLIBDIR        = ${PARTY3}/zlib
 LOCALZLIBLIB        = ${LOCALZLIBDIR}/${LIBZLIB}
 LOCALZLIBINCDIR     = ${LOCALZLIBDIR}
-OBJDIR              = objects
+OBJDIR              = objects_${BINARY_TYPE}
 INCLUDES            = -iquote$(HEAD) -I${LOCALJANSSONINCDIR} -I${LOCALBZIP2INCDIR} -I${LOCALZLIBINCDIR}
 LIBLOCATION         = -L${LOCALJANSSONLIBDIR} -L${LOCALBZIP2LIBDIR} -L${LOCALZLIBDIR}
 LIBRARIES           = ${LOCALJANSSONLIB} ${LOCALBZIP2LIB} ${LOCALZLIBLIB}
 BLDFLAGS            = -Wall -pedantic -O3 -std=c++11
 SFLAGS              = -static
 
+ifeq ($(BINARY_TYPE),)
+	TFLAG = -DBEDOPS_BINARY_TYPE=0
+else
+	TFLAG = -DBEDOPS_BINARY_TYPE=$(BINARY_TYPE_NUM)
+endif
+
 dependency_names    = NaN starchConstants starchFileHelpers starchHelpers starchMetadataHelpers unstarchHelpers starchSha1Digest starchBase64Coding
 dependencies        = $(addprefix $(OBJDIR)/, $(addsuffix .o, $(dependency_names)))
-FLAGS               = $(SFLAGS) -s $(BLDFLAGS) $(dependencies) ${LIBLOCATION} ${INCLUDES}
-DFLAGS              = $(SFLAGS) -g -O0 -DDEBUG_VERBOSE=1 -std=c++11 -Wall -fno-inline -pedantic -DDEBUG=1 $(dependencies) ${LIBLOCATION} ${INCLUDES}
-GPROFFLAGS          = $(SFLAGS) -O -std=c++11 -Wall -pedantic -pg $(dependencies) ${LIBLOCATION} ${INCLUDES}
+FLAGS               = $(SFLAGS) $(TFLAG) ${MEGAFLAGS} -s $(BLDFLAGS) $(dependencies) ${LIBLOCATION} ${INCLUDES}
+DFLAGS              = $(SFLAGS) $(TFLAG) ${MEGAFLAGS} -g -O0 -DDEBUG_VERBOSE=1 -std=c++11 -Wall -fno-inline -pedantic -DDEBUG=1 $(dependencies) ${LIBLOCATION} ${INCLUDES}
+GPROFFLAGS          = $(SFLAGS) $(TFLAG) ${MEGAFLAGS} -O -std=c++11 -Wall -pedantic -pg $(dependencies) ${LIBLOCATION} ${INCLUDES}
 SOURCE1             = Bedops.cpp
 BINDIR              = ../bin
-PROG                = bedops
+PROG                = bedops-${BINARY_TYPE}
 
 build: $(BINDIR)/$(PROG)
+	rm -rf $(OBJDIR)
 
 build_gprof: $(BINDIR)/gprof.$(PROG)
+	rm -rf $(OBJDIR)
 
 build_debug: $(BINDIR)/debug.$(PROG)
+	rm -rf $(OBJDIR)
 
 dependencies: $(dependencies)
 
@@ -67,8 +76,6 @@ test:
 	printf "\n\nTo run regression tests:\n  cd $(TMPTESTDIR) && java Regression TestPlan.xml\n"
 
 clean:
-	rm -f $(BINDIR)/$(PROG)
-	rm -f $(BINDIR)/*.$(PROG)
 	rm -rf $(OBJDIR)
 	rm -rf $(BINDIR)
 
diff --git a/applications/bed/bedops/src/Makefile.darwin b/applications/bed/bedops/src/Makefile.darwin
index 4a564f7..116a7b9 100644
--- a/applications/bed/bedops/src/Makefile.darwin
+++ b/applications/bed/bedops/src/Makefile.darwin
@@ -1,5 +1,3 @@
-MIN_OSX_VERSION      = 10.7
-
 MAIN                 = ../../../..
 MAINAPPDIR           = ../..
 HEAD                 = $(MAIN)/interfaces/general-headers
@@ -22,31 +20,40 @@ LOCALBZIP2INCDIR     = ${LOCALBZIP2DIR}
 LOCALZLIBDIR         = ${PARTY3}/darwin_intel_${ARCH}/zlib
 LOCALZLIBLIB         = ${LOCALZLIBDIR}/${LIBZLIB}
 LOCALZLIBINCDIR      = ${LOCALZLIBDIR}
-OBJDIR               = objects_$(ARCH)
+OBJDIR               = objects_$(ARCH)_${BINARY_TYPE}
 INCLUDES             = -iquote$(HEAD) -I${LOCALJANSSONINCDIR} -I${LOCALBZIP2INCDIR} -I${LOCALZLIBINCDIR}
 LIBLOCATION          = -L${LOCALJANSSONLIBDIR} -L${LOCALBZIP2LIBDIR} -L${LOCALZLIBDIR}
 LIBRARIES            = ${LOCALJANSSONLIB} ${LOCALBZIP2LIB} ${LOCALZLIBLIB}
 STDFLAGS             = -Wall -pedantic -std=c++11 -stdlib=libc++
 BLDFLAGS             = -O3 ${STDFLAGS}
 
-FLAGS                = $(BLDFLAGS) $(OBJDIR)/NaN.o $(OBJDIR)/starchConstants.o $(OBJDIR)/starchFileHelpers.o $(OBJDIR)/starchHelpers.o $(OBJDIR)/starchMetadataHelpers.o $(OBJDIR)/unstarchHelpers.o $(OBJDIR)/starchSha1Digest.o $(OBJDIR)/starchBase64Coding.o ${LIBLOCATION} ${INCLUDES}
+ifeq ($(BINARY_TYPE),)
+	TFLAG = -DBEDOPS_BINARY_TYPE=0
+else
+	TFLAG = -DBEDOPS_BINARY_TYPE=$(BINARY_TYPE_NUM)
+endif
+
+FLAGS                = ${TFLAG} ${MEGAFLAGS} $(BLDFLAGS) $(OBJDIR)/NaN.o $(OBJDIR)/starchConstants.o $(OBJDIR)/starchFileHelpers.o $(OBJDIR)/starchHelpers.o $(OBJDIR)/starchMetadataHelpers.o $(OBJDIR)/unstarchHelpers.o $(OBJDIR)/starchSha1Digest.o $(OBJDIR)/starchBase64Coding.o ${LIBLOCATION} ${INCLUDES}
 
-DFLAGS               = -g -O0 -DDEBUG_VERBOSE=1 -DDEBUG=1 ${STDFLAGS} $(OBJDIR)/NaN.o $(OBJDIR)/starchConstants.o $(OBJDIR)/starchFileHelpers.o $(OBJDIR)/starchHelpers.o $(OBJDIR)/starchMetadataHelpers.o $(OBJDIR)/unstarchHelpers.o $(OBJDIR)/starchSha1Digest.o $(OBJDIR)/starchBase64Coding.o ${LIBLOCATION} ${INCLUDES}
+DFLAGS               = ${TFLAG} ${MEGAFLAGS} -g -O0 -DDEBUG_VERBOSE=1 -DDEBUG=1 ${STDFLAGS} $(OBJDIR)/NaN.o $(OBJDIR)/starchConstants.o $(OBJDIR)/starchFileHelpers.o $(OBJDIR)/starchHelpers.o $(OBJDIR)/starchMetadataHelpers.o $(OBJDIR)/unstarchHelpers.o $(OBJDIR)/starchSha1Digest.o $(OBJDIR)/starchBase64Coding.o ${LIBLOCATION} ${INCLUDES}
 
-GPROFFLAGS           = -O -pg ${STDFLAGS} $(OBJDIR)/NaN.o $(OBJDIR)/starchConstants.o $(OBJDIR)/starchFileHelpers.o $(OBJDIR)/starchHelpers.o $(OBJDIR)/starchMetadataHelpers.o $(OBJDIR)/unstarchHelpers.o $(OBJDIR)/starchSha1Digest.o $(OBJDIR)/starchBase64Coding.o ${LIBLOCATION} ${INCLUDES}
+GPROFFLAGS           = ${TFLAG} ${MEGAFLAGS} -O -pg ${STDFLAGS} $(OBJDIR)/NaN.o $(OBJDIR)/starchConstants.o $(OBJDIR)/starchFileHelpers.o $(OBJDIR)/starchHelpers.o $(OBJDIR)/starchMetadataHelpers.o $(OBJDIR)/unstarchHelpers.o $(OBJDIR)/starchSha1Digest.o $(OBJDIR)/starchBase64Coding.o ${LIBLOCATION} ${INCLUDES}
 
 SOURCE1              = Bedops.cpp
 BINDIR               = ../bin
-PROG                 = bedops
+PROG                 = bedops-${BINARY_TYPE}
 
 build: dependencies
-	$(CXX) -o $(BINDIR)/$(PROG)_$(ARCH) $(FLAGS) -mmacosx-version-min=$(MIN_OSX_VERSION) -arch $(ARCH) ${LIBRARIES} $(SOURCE1)
+	$(CXX) -o $(BINDIR)/$(PROG) $(FLAGS) -mmacosx-version-min=$(MIN_OSX_VERSION) -arch $(ARCH) ${LIBRARIES} $(SOURCE1)
+	rm -rf $(OBJDIR)
 
 build_debug: dependencies
-	$(CXX) -o $(BINDIR)/debug.$(PROG)_$(ARCH) $(DFLAGS) -mmacosx-version-min=$(MIN_OSX_VERSION) -arch $(ARCH) ${LIBRARIES} $(SOURCE1)
+	$(CXX) -o $(BINDIR)/debug.$(PROG) $(DFLAGS) -mmacosx-version-min=$(MIN_OSX_VERSION) -arch $(ARCH) ${LIBRARIES} $(SOURCE1)
+	rm -rf $(OBJDIR)
 
 build_gprof: dependencies
-	$(CXX) -o $(BINDIR)/gprof.$(PROG)_$(ARCH) $(FLAGS) -mmacosx-version-min=$(MIN_OSX_VERSION) -arch $(ARCH) ${LIBRARIES} $(SOURCE1)
+	$(CXX) -o $(BINDIR)/gprof.$(PROG) $(FLAGS) -mmacosx-version-min=$(MIN_OSX_VERSION) -arch $(ARCH) ${LIBRARIES} $(SOURCE1)
+	rm -rf $(OBJDIR)
 
 dependencies:
 	rm -rf $(OBJDIR)
@@ -68,8 +75,6 @@ test:
 
 clean:
 	rm -rf $(OBJDIR)
-	rm -rf $(BINDIR)/$(PROG)*
-	rm -rf $(BINDIR)/*.$(PROG)*
 	rm -rf $(BINDIR)
 
 clean_test:
diff --git a/applications/bed/closestfeats/src/BedReader.hpp b/applications/bed/closestfeats/src/BedReader.hpp
index 25ce6bb..cf8cb52 100644
--- a/applications/bed/closestfeats/src/BedReader.hpp
+++ b/applications/bed/closestfeats/src/BedReader.hpp
@@ -46,7 +46,7 @@ template <typename IterType>
 struct BedReader {
   typedef typename NoPtr<typename IterType::value_type>::Type BedType;
 
-  explicit BedReader(IterType iter) : iter_(iter), cache_()
+  explicit BedReader(IterType iter) : iter_(iter), orig_(iter), cache_()
     { /* */ }
 
   BedReader(const BedReader& b); // not safe to copy due to iterators in some cases
@@ -80,8 +80,9 @@ struct BedReader {
   }
 
   void Clean() {
+    auto& mem = orig_.get_pool();
     while ( !cache_.empty() ) {
-      delete cache_.back();
+      mem.release(cache_.back());
       cache_.pop_back();
     }
   }
@@ -89,19 +90,13 @@ struct BedReader {
   void CleanAll() {
     Clean();
     BedType* tmp = static_cast<BedType*>(0);
+    auto& mem = orig_.get_pool();
     while ( (tmp = ReadLine()) )
-      delete tmp;
-  }
-
-  ~BedReader() {
-    while ( !cache_.empty() ) {
-      delete cache_.back();
-      cache_.pop_back();
-    }
+      mem.release(tmp);
   }
 
 private:
-  IterType iter_;
+  IterType iter_, orig_;
   std::vector<BedType*> cache_;
 };
 
diff --git a/applications/bed/closestfeats/src/ClosestFeature.cpp b/applications/bed/closestfeats/src/ClosestFeature.cpp
index 7e08a00..d4f497e 100644
--- a/applications/bed/closestfeats/src/ClosestFeature.cpp
+++ b/applications/bed/closestfeats/src/ClosestFeature.cpp
@@ -56,6 +56,17 @@ namespace FeatDist {
   const char* none = "NA";
   const Bed::SignedCoordType plus_infinite = std::numeric_limits<Bed::SignedCoordType>::max();
   const Bed::SignedCoordType minus_infinite = std::numeric_limits<Bed::SignedCoordType>::min();
+  const std::size_t PoolSz = 8*8*8; // only 2 file inputs
+
+#if BEDOPS_BINARY_TYPE == 0
+  const std::string application_type = "typical";
+#else
+#if BEDOPS_BINARY_TYPE == 1
+  const std::string application_type = "megarow";
+#else
+  const std::string application_type = "typical";
+#endif
+#endif
 
   void doWork(const Input&);
 } // namespace FeatDist
@@ -74,20 +85,20 @@ int main(int argc, char** argv) {
   } catch(FeatDist::HelpException& h) {
     std::cout << FeatDist::prognm << std::endl;
     std::cout << "  citation: " + FeatDist::citation << std::endl;
-    std::cout << "  version:  " + FeatDist::version << std::endl;
+    std::cout << "  version:  " + FeatDist::version + " (" + FeatDist::application_type + ")" << std::endl;
     std::cout << "  authors:  " + FeatDist::authors << std::endl;
     std::cout << FeatDist::Usage() << std::endl;
     return(EXIT_SUCCESS);
   } catch(FeatDist::VersionException& v) {
     std::cout << FeatDist::prognm << std::endl;
     std::cout << "  citation: " + FeatDist::citation << std::endl;
-    std::cout << "  version:  " + FeatDist::version << std::endl;
+    std::cout << "  version:  " + FeatDist::version + " (" + FeatDist::application_type + ")" << std::endl;
     std::cout << "  authors:  " + FeatDist::authors << std::endl;
     return(EXIT_SUCCESS);
   } catch(FeatDist::NoInput& ni) {
     std::cerr << FeatDist::prognm << std::endl;
     std::cerr << "  citation: " + FeatDist::citation << std::endl;
-    std::cerr << "  version:  " + FeatDist::version << std::endl;
+    std::cerr << "  version:  " + FeatDist::version + " (" + FeatDist::application_type + ")" << std::endl;
     std::cerr << "  authors:  " + FeatDist::authors << std::endl;
     std::cerr << FeatDist::Usage() << std::endl;
   } catch(const std::exception& stx) {
@@ -121,46 +132,68 @@ void runDistances(BedFile1& refFile, BedFile2& nonRefFile, const Input& input) {
     findDistances(refFile, nonRefFile, input.AllowOverlaps(), PrintAll(input.Delimiter(), printDistances, suppressRefField));
 }
 
+//=============
+// get_pool()
+//============
+template <typename BedTypePtr>
+Ext::PooledMemory<typename std::remove_pointer<BedTypePtr>::type, PoolSz>&
+get_pool() {
+  static Ext::PooledMemory<typename std::remove_pointer<BedTypePtr>::type, PoolSz> pool;
+  return pool;
+}
+
+//==========
+// remove()
+//==========
+template <typename BedType>
+inline
+void remove(BedType* b) {
+  static auto& p = get_pool<BedType*>();
+  p.release(b);
+}
+
 //=================
 // createWork<T,U>
 //=================
 template <typename BedType1, typename BedType2>
 struct createWork {
   static void run(const Input& input) {
+    auto& mem1 = get_pool<BedType1*>();
+    auto& mem2 = get_pool<BedType2*>();
     if ( input.ErrorCheck() ) {
       typedef Ext::UserError UE;
       typedef std::ifstream* StreamPtr;
-      typedef Bed::bed_check_iterator<BedType1*> IterType1;
-      typedef Bed::bed_check_iterator<BedType2*> IterType2;
+      typedef Bed::bed_check_iterator<BedType1*, PoolSz> IterType1;
+      typedef Bed::bed_check_iterator<BedType2*, PoolSz> IterType2;
       typedef BedReader<IterType1> BedReaderType1;
       typedef BedReader<IterType2> BedReaderType2;
-  
+
       StreamPtr refFilePtr = static_cast<StreamPtr>(0);
       StreamPtr nonRefFilePtr = static_cast<StreamPtr>(0);
       BedReaderType1* refFile = static_cast<BedReaderType1*>(0);
       BedReaderType2* nonRefFile = static_cast<BedReaderType2*>(0);
-  
+
       bool isStdin = (input.GetReferenceFileName() == "-");
       refFilePtr = new std::ifstream(input.GetReferenceFileName().c_str());
       if ( isStdin ) {
-        IterType1 fileI(std::cin, "stdin", input.Chrome());
+        IterType1 fileI(std::cin, "stdin", mem1, input.Chrome());
         refFile = new BedReaderType1(fileI);
       } else {
         if ( !refFilePtr || !(*refFilePtr) )
           throw(UE("Unable to find file: " + input.GetReferenceFileName()));
-        IterType1 fileI(*refFilePtr, input.GetReferenceFileName(), input.Chrome());
+        IterType1 fileI(*refFilePtr, input.GetReferenceFileName(), mem1, input.Chrome());
         refFile = new BedReaderType1(fileI);
       }
-  
+
       isStdin = (input.GetNonReferenceFileName() == "-");
       nonRefFilePtr = new std::ifstream(input.GetNonReferenceFileName().c_str());
       if ( isStdin ) {
-        IterType2 fileJ(std::cin, input.GetNonReferenceFileName(), input.Chrome());
+        IterType2 fileJ(std::cin, input.GetNonReferenceFileName(), mem2, input.Chrome());
         nonRefFile = new BedReaderType2(fileJ);
       } else {
         if ( !nonRefFilePtr || !(*nonRefFilePtr) )
           throw(UE("Unable to find file: " + input.GetNonReferenceFileName()));
-        IterType2 fileJ(*nonRefFilePtr, input.GetNonReferenceFileName(), input.Chrome());
+        IterType2 fileJ(*nonRefFilePtr, input.GetNonReferenceFileName(), mem2, input.Chrome());
         nonRefFile = new BedReaderType2(fileJ);
       }
 
@@ -178,24 +211,24 @@ struct createWork {
         delete refFilePtr;
       if ( nonRefFilePtr )
         delete nonRefFilePtr;
-  
+
     } else { // fast-mode
       typedef Ext::FPWrap<Ext::InvalidFile> FPType;
-      typedef Bed::allocate_iterator_starch_bed<BedType1*> IterType1;
-      typedef Bed::allocate_iterator_starch_bed<BedType2*> IterType2;
+      typedef Bed::allocate_iterator_starch_bed<BedType1*, PoolSz> IterType1;
+      typedef Bed::allocate_iterator_starch_bed<BedType2*, PoolSz> IterType2;
       typedef BedReader<IterType1> BedReaderType1;
       typedef BedReader<IterType2> BedReaderType2;
-  
+
       FPType* refFilePtr = static_cast<FPType*>(0);
       FPType* nonRefFilePtr = static_cast<FPType*>(0);
       BedReaderType1* refFile = static_cast<BedReaderType1*>(0);
       BedReaderType2* nonRefFile = static_cast<BedReaderType2*>(0);
-  
+
       refFilePtr = new FPType(input.GetReferenceFileName());
-      refFile = new BedReaderType1(IterType1(*refFilePtr, input.Chrome()));
-  
+      refFile = new BedReaderType1(IterType1(*refFilePtr, mem1, input.Chrome()));
+
       nonRefFilePtr = new FPType(input.GetNonReferenceFileName());
-      nonRefFile = new BedReaderType2(IterType2(*nonRefFilePtr, input.Chrome()));
+      nonRefFile = new BedReaderType2(IterType2(*nonRefFilePtr, mem2, input.Chrome()));
 
       runDistances(*refFile, *nonRefFile, input);
 
@@ -284,7 +317,7 @@ void findDistances(BedFile1& ref, BedFile2& nonRef, bool allowOverlaps, const Pr
     while ( (c = nonRef.ReadLine()) ) {
       dist = getDistance(c, b);
       if ( dist == minus_infinite ) { // different chromosomes; catch nonref up
-        delete c;
+        remove(c);
         continue;
       } else if ( dist == plus_infinite ) { // different chromosomes; catch ref up
         if ( left && !leftCached )
@@ -299,18 +332,18 @@ void findDistances(BedFile1& ref, BedFile2& nonRef, bool allowOverlaps, const Pr
       // Deal with left and right closest elements
       if ( dist < 0 && dist >= leftDist ) {
         while ( !read.empty() ) { // new best left makes all others obsolete
-          delete read.front();
+          remove(read.front());
           read.pop_front();
         } // while
         if ( left && !leftCached )
-          delete left; // never closest left element again
+          remove(left); // never closest left element again
         leftDist = dist;
         left = c;
         leftCached = false;
       } else if ( dist < 0 ) { // happens if previous element starts sooner and stops later
         if ( !leftCached ) // must keep things in sort order; left is not zero if here
           read.push_back(left);
-        delete c;
+        remove(c);
         leftCached = true;
       } else if ( dist > 0 && dist < rightDist ) {
         // right must be zero (overlap sets rightDist to 0); done processing left
@@ -334,7 +367,7 @@ void findDistances(BedFile1& ref, BedFile2& nonRef, bool allowOverlaps, const Pr
         //  Remember start coordinates only increase or stay the same.
         if ( c->start() <= b->start() ) { // hanging over left edge of ref
           if ( left && left->end() <= c->end() && !leftCached )
-            delete left; // never closest left element again
+            remove(left); // never closest left element again
           else if ( left && !leftCached ) // current left has end coordinate greater than c
             read.push_back(left);
           left = c;
@@ -368,11 +401,11 @@ void findDistances(BedFile1& ref, BedFile2& nonRef, bool allowOverlaps, const Pr
             }
           } else if ( proportion >= 0.5 ) { // new left element
             while ( !read.empty() ) { // new best left makes all others obsolete
-              delete read.front();
+              remove(read.front());
               read.pop_front();
             } // while
             if ( left && !leftCached ) // non-overlapping, current left element
-              delete left; // never closest left element again
+              remove(left); // never closest left element again
             leftCached = false;
             left = c;
             leftDist = 0;
@@ -408,7 +441,7 @@ void findDistances(BedFile1& ref, BedFile2& nonRef, bool allowOverlaps, const Pr
     read.clear();
 
     printer(b, left, right);
-    delete b;
+    remove(b);
   } // while more in ref
 }
 
diff --git a/applications/bed/closestfeats/src/Makefile b/applications/bed/closestfeats/src/Makefile
index 4811138..a219550 100755
--- a/applications/bed/closestfeats/src/Makefile
+++ b/applications/bed/closestfeats/src/Makefile
@@ -19,27 +19,36 @@ LOCALBZIP2INCDIR    = ${LOCALBZIP2DIR}
 LOCALZLIBDIR        = ${PARTY3}/zlib
 LOCALZLIBLIB        = ${LOCALZLIBDIR}/${LIBZLIB}
 LOCALZLIBINCDIR     = ${LOCALZLIBDIR}
-OBJDIR              = objects
+OBJDIR              = objects_${BINARY_TYPE}
 INCLUDES            = -iquote$(HEAD) -I${LOCALJANSSONINCDIR} -I${LOCALBZIP2INCDIR} -I${LOCALZLIBINCDIR}
 LIBLOCATION         = -L${LOCALJANSSONLIBDIR} -L${LOCALBZIP2LIBDIR} -L${LOCALZLIBDIR}
 LIBRARIES           = ${LOCALJANSSONLIB} ${LOCALBZIP2LIB} ${LOCALZLIBLIB}
 BLDFLAGS            = -Wall -pedantic -O3 -std=c++11
 SFLAGS              = -static
 
+ifeq ($(BINARY_TYPE),)
+	TFLAG = -DBEDOPS_BINARY_TYPE=0
+else
+	TFLAG = -DBEDOPS_BINARY_TYPE=$(BINARY_TYPE_NUM)
+endif
+
 dependency_names    = NaN starchConstants starchFileHelpers starchHelpers starchMetadataHelpers unstarchHelpers starchSha1Digest starchBase64Coding
 dependencies        = $(addprefix $(OBJDIR)/, $(addsuffix .o, $(dependency_names)))
-FLAGS               = $(SFLAGS) -s $(BLDFLAGS) $(dependencies) ${LIBLOCATION} ${INCLUDES}
-DFLAGS              = $(SFLAGS) -g -O0 -std=c++11 -Wall -fno-inline -pedantic $(dependencies) ${LIBLOCATION} ${INCLUDES}
-GPROFFLAGS          = $(SFLAGS) -O -std=c++11 -Wall -pedantic -pg $(dependencies) ${LIBLOCATION} ${INCLUDES}
+FLAGS               = $(SFLAGS) $(TFLAG) ${MEGAFLAGS} -s $(BLDFLAGS) $(dependencies) ${LIBLOCATION} ${INCLUDES}
+DFLAGS              = $(SFLAGS) $(TFLAG) ${MEGAFLAGS} -g -O0 -std=c++11 -Wall -fno-inline -pedantic $(dependencies) ${LIBLOCATION} ${INCLUDES}
+GPROFFLAGS          = $(SFLAGS) $(TFLAG) ${MEGAFLAGS} -O -std=c++11 -Wall -pedantic -pg $(dependencies) ${LIBLOCATION} ${INCLUDES}
 SOURCE1             = ClosestFeature.cpp
 BINDIR              = ../bin
-PROG                = closest-features
+PROG                = closest-features-${BINARY_TYPE}
 
 build: $(BINDIR)/$(PROG)
+	rm -rf $(OBJDIR)
 
 build_gprof: $(BINDIR)/gprof.$(PROG)
+	rm -rf $(OBJDIR)
 
 build_debug: $(BINDIR)/debug.$(PROG)
+	rm -rf $(OBJDIR)
 
 dependencies: $(dependencies)
 
@@ -59,7 +68,5 @@ $(OBJDIR)/%.o : $(LIB3)/%.c
 	mkdir -p $(OBJDIR) && $(CXX) -c ${BLDFLAGS} $^ -o $@ ${INCLUDES}
 
 clean:
-	rm -f $(BINDIR)/$(PROG)
-	rm -f $(BINDIR)/*.$(PROG)
 	rm -rf $(OBJDIR)
 	rm -rf $(BINDIR)
diff --git a/applications/bed/closestfeats/src/Makefile.darwin b/applications/bed/closestfeats/src/Makefile.darwin
index 324dd19..8d6eae3 100755
--- a/applications/bed/closestfeats/src/Makefile.darwin
+++ b/applications/bed/closestfeats/src/Makefile.darwin
@@ -1,5 +1,3 @@
-MIN_OSX_VERSION      = 10.7
-
 MAIN                 = ../../../..
 MAINAPPDIR           = ../..
 HEAD                 = $(MAIN)/interfaces/general-headers
@@ -8,7 +6,7 @@ LIB2                 = $(MAIN)/interfaces/src/utility
 LIB3                 = $(MAIN)/interfaces/src/data/starch
 THISDIR              = ${shell pwd}
 PARTY3               = ${THISDIR}/$(MAIN)/third-party
-OBJDIR               = objects_$(ARCH)
+OBJDIR               = objects_$(ARCH)_${BINARY_TYPE}
 LIBJANSSON           = libjansson.a
 LIBBZIP2             = libbz2.a
 LIBZLIB              = libz.a
@@ -30,24 +28,33 @@ LIBRARIES            = ${LOCALJANSSONLIB} ${LOCALBZIP2LIB} ${LOCALZLIBLIB}
 STDFLAGS             = -Wall -pedantic -std=c++11 -stdlib=libc++
 BLDFLAGS             = -O3 ${STDFLAGS}
 
-FLAGS                = $(BLDFLAGS) $(OBJDIR)/NaN.o $(OBJDIR)/starchConstants.o $(OBJDIR)/starchFileHelpers.o $(OBJDIR)/starchHelpers.o $(OBJDIR)/starchMetadataHelpers.o $(OBJDIR)/unstarchHelpers.o $(OBJDIR)/starchSha1Digest.o $(OBJDIR)/starchBase64Coding.o ${LIBLOCATION} ${INCLUDES}
+ifeq ($(BINARY_TYPE),)
+	TFLAG = -DBEDOPS_BINARY_TYPE=0
+else
+	TFLAG = -DBEDOPS_BINARY_TYPE=$(BINARY_TYPE_NUM)
+endif
+
+FLAGS                = ${TFLAG} ${MEGAFLAGS} $(BLDFLAGS) $(OBJDIR)/NaN.o $(OBJDIR)/starchConstants.o $(OBJDIR)/starchFileHelpers.o $(OBJDIR)/starchHelpers.o $(OBJDIR)/starchMetadataHelpers.o $(OBJDIR)/unstarchHelpers.o $(OBJDIR)/starchSha1Digest.o $(OBJDIR)/starchBase64Coding.o ${LIBLOCATION} ${INCLUDES}
 
-DFLAGS               = -g -O0 ${STDFLAGS} $(OBJDIR)/NaN.o $(OBJDIR)/starchConstants.o $(OBJDIR)/starchFileHelpers.o $(OBJDIR)/starchHelpers.o $(OBJDIR)/starchMetadataHelpers.o $(OBJDIR)/unstarchHelpers.o $(OBJDIR)/starchSha1Digest.o $(OBJDIR)/starchBase64Coding.o ${LIBLOCATION} ${INCLUDES}
+DFLAGS               = ${TFLAG} ${MEGAFLAGS} -g -O0 ${STDFLAGS} $(OBJDIR)/NaN.o $(OBJDIR)/starchConstants.o $(OBJDIR)/starchFileHelpers.o $(OBJDIR)/starchHelpers.o $(OBJDIR)/starchMetadataHelpers.o $(OBJDIR)/unstarchHelpers.o $(OBJDIR)/starchSha1Digest.o $(OBJDIR)/starchBase64Coding.o ${LIBLOCATION} ${INCLUDES}
 
-GPROFFLAGS           = -O -pg ${STDFLAGS} $(OBJDIR)/NaN.o $(OBJDIR)/starchConstants.o $(OBJDIR)/starchFileHelpers.o $(OBJDIR)/starchHelpers.o $(OBJDIR)/starchMetadataHelpers.o $(OBJDIR)/unstarchHelpers.o $(OBJDIR)/starchSha1Digest.o $(OBJDIR)/starchBase64Coding.o ${LIBLOCATION} ${INCLUDES}
+GPROFFLAGS           = ${TFLAG} ${MEGAFLAGS} -O -pg ${STDFLAGS} $(OBJDIR)/NaN.o $(OBJDIR)/starchConstants.o $(OBJDIR)/starchFileHelpers.o $(OBJDIR)/starchHelpers.o $(OBJDIR)/starchMetadataHelpers.o $(OBJDIR)/unstarchHelpers.o $(OBJDIR)/starchSha1Digest.o $(OBJDIR)/starchBase64Coding.o ${LIBLOCATION} ${INCLUDES}
 
 SOURCE1             = ClosestFeature.cpp
 BINDIR              = ../bin
-PROG                = closest-features
+PROG                = closest-features-${BINARY_TYPE}
 
 build: dependencies
-	$(CXX) -o $(BINDIR)/$(PROG)_$(ARCH) $(FLAGS) -mmacosx-version-min=$(MIN_OSX_VERSION) -arch $(ARCH) ${LIBRARIES} $(SOURCE1)
+	$(CXX) -o $(BINDIR)/$(PROG) $(FLAGS) -mmacosx-version-min=$(MIN_OSX_VERSION) -arch $(ARCH) ${LIBRARIES} $(SOURCE1)
+	rm -rf $(OBJDIR)
 
 build_debug: dependencies
-	$(CXX) -o $(BINDIR)/debug.$(PROG)_$(ARCH) $(DFLAGS) -mmacosx-version-min=$(MIN_OSX_VERSION) -arch $(ARCH) ${LIBRARIES} $(SOURCE1)
+	$(CXX) -o $(BINDIR)/debug.$(PROG) $(DFLAGS) -mmacosx-version-min=$(MIN_OSX_VERSION) -arch $(ARCH) ${LIBRARIES} $(SOURCE1)
+	rm -rf $(OBJDIR)
 
 build_gprof: dependencies
-	$(CXX) -o $(BINDIR)/gprof.$(PROG)_$(ARCH) $(FLAGS) -mmacosx-version-min=$(MIN_OSX_VERSION) -arch $(ARCH) ${LIBRARIES} $(SOURCE1)
+	$(CXX) -o $(BINDIR)/gprof.$(PROG) $(FLAGS) -mmacosx-version-min=$(MIN_OSX_VERSION) -arch $(ARCH) ${LIBRARIES} $(SOURCE1)
+	rm -rf $(OBJDIR)
 
 dependencies:
 	rm -rf $(OBJDIR)
@@ -63,6 +70,4 @@ dependencies:
 
 clean:
 	rm -rf $(OBJDIR)
-	rm -rf $(BINDIR)/$(PROG)*
-	rm -rf $(BINDIR)/*.$(PROG)*
 	rm -rf ${BINDIR}
diff --git a/applications/bed/conversion/src/Makefile b/applications/bed/conversion/src/Makefile
index eb22afa..7266c43 100644
--- a/applications/bed/conversion/src/Makefile
+++ b/applications/bed/conversion/src/Makefile
@@ -4,30 +4,52 @@ CFLAGS                    = -O3
 CDFLAGS                   = -DDEBUG=1 -g -O0 -fno-inline
 CPFLAGS                   = -pg
 LIBS                      = -lpthread
-INCLUDES                 := -iquote"${CURDIR}"
+MAIN                      = ../../../..
+INTERFACES                = $(MAIN)/interfaces
+HEAD                      = ${INTERFACES}/general-headers
+INCLUDES                 := -iquote"${CURDIR}" -iquote"${HEAD}"
 DISTDIR                   = ../bin
-OBJDIR                    = objects
+OBJDIR                    = objects${POSTFIX}
 WRAPPERDIR                = wrappers
 PROG                      = convert2bed
 SOURCE                    = convert2bed.c
 SFLAGS                    = -static
 
+ifeq ($(BINARY_TYPE),)
+	TFLAG = -DBEDOPS_BINARY_TYPE=0
+else
+	TFLAG = -DBEDOPS_BINARY_TYPE=$(BINARY_TYPE_NUM)
+endif
+
 all: build
 
 .PHONY: build build_debug build_gprof clean
 
-build: $(DISTDIR)/$(PROG)
-build_debug: $(DISTDIR)/debug.$(PROG)
-build_gprof: $(DISTDIR)/gprof.$(PROG)
+build: $(DISTDIR)/$(PROG)-${BINARY_TYPE}
+	rm -rf $(OBJDIR)
+build_debug: $(DISTDIR)/debug.$(PROG)-${BINARY_TYPE}
+	rm -rf $(OBJDIR)
+build_gprof: $(DISTDIR)/gprof.$(PROG)-${BINARY_TYPE}
+	rm -rf $(OBJDIR)
+
+$(DISTDIR)/$(PROG)-${BINARY_TYPE}: $(PROG).c
+	mkdir -p $(DISTDIR) && $(CC) $(TFLAG) $(BLDFLAGS) ${MEGAFLAGS} $(COMMONFLAGS) $(CFLAGS) $(SFLAGS) $(INCLUDES) $^ -o $@ $(LIBS)
 
-$(DISTDIR)/$(PROG): $(PROG).c
-	mkdir -p $(DISTDIR) && $(CC) $(BLDFLAGS) $(COMMONFLAGS) $(CFLAGS) $(SFLAGS) $(INCLUDES) $^ -o $@ $(LIBS)
+$(DISTDIR)/%-${BINARY_TYPE}: %.c
+	mkdir -p $(DISTDIR) && $(CC) $(TFLAG) $(BLDFLAGS) ${MEGAFLAGS} $(COMMONFLAGS) $(CFLAGS) $(SFLAGS) $(INCLUDES) $^ -o $@ $(LIBS)
 
 $(DISTDIR)/debug.$(PROG): $(PROG).c
-	mkdir -p $(DISTDIR) && $(CC) $(BLDFLAGS) $(COMMONFLAGS) $(CDFLAGS) $(SFLAGS) $(INCLUDES) $^ -o $@ $(LIBS)
+	mkdir -p $(DISTDIR) && $(CC) $(TFLAG) $(BLDFLAGS) ${MEGAFLAGS} $(COMMONFLAGS) $(CDFLAGS) $(SFLAGS) $(INCLUDES) $^ -o $@ $(LIBS)
+
+$(DISTDIR)/debug.%-${BINARY_TYPE}: %.c
+	mkdir -p $(DISTDIR) && $(CC) $(TFLAG) $(BLDFLAGS) ${MEGAFLAGS} $(COMMONFLAGS) $(CDFLAGS) $(SFLAGS) $(INCLUDES) $^ -o $@ $(LIBS)
 
 $(DISTDIR)/gprof.$(PROG): $(PROG).c gprof-helper.so
-	mkdir -p $(DISTDIR) && $(CC) $(BLDFLAGS) $(COMMONFLAGS) $(CPFLAGS) $(SFLAGS) $(INCLUDES) $< -o $@ $(LIBS)
+	mkdir -p $(DISTDIR) && $(CC) $(TFLAG) $(BLDFLAGS) ${MEGAFLAGS} $(COMMONFLAGS) $(CPFLAGS) $(SFLAGS) $(INCLUDES) $< -o $@ $(LIBS)
+	@echo -e "\nNote: To profile convert2bed with gprof/pthreads, run:\n\t$$ LD_PRELOAD=/path/to/gprof-helper.so convert2bed"
+
+$(DISTDIR)/gprof.%-${BINARY_TYPE}: %.c gprof-helper.so
+	mkdir -p $(DISTDIR) && $(CC) $(TFLAG) $(BLDFLAGS) ${MEGAFLAGS} $(COMMONFLAGS) $(CPFLAGS) $(SFLAGS) $(INCLUDES) $< -o $@ $(LIBS)
 	@echo -e "\nNote: To profile convert2bed with gprof/pthreads, run:\n\t$$ LD_PRELOAD=/path/to/gprof-helper.so convert2bed"
 
 %.so: %.c
@@ -36,4 +58,4 @@ $(DISTDIR)/gprof.$(PROG): $(PROG).c gprof-helper.so
 clean:
 	rm -rf $(DISTDIR)
 	rm -rf $(OBJDIR)
-	rm -rf  *.so *~
+	rm -rf  *.so *~
\ No newline at end of file
diff --git a/applications/bed/conversion/src/Makefile.darwin b/applications/bed/conversion/src/Makefile.darwin
index 4fee388..7d31835 100644
--- a/applications/bed/conversion/src/Makefile.darwin
+++ b/applications/bed/conversion/src/Makefile.darwin
@@ -1,38 +1,50 @@
-MIN_OSX_VERSION           = 10.7
 BLDFLAGS                  = -Wall -Wextra -pedantic -std=c99
-COMMONFLAGS               = -D__STDC_CONSTANT_MACROS -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE=1
+COMMONFLAGS               = -D__STDC_CONSTANT_MACROS -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE=1 ${MEGAFLAGS}
 CFLAGS                    = -O3
 CDFLAGS                   = -DDEBUG=1 -g -O0 -fno-inline
 CPFLAGS                   = -pg
 LIBS                      = -lpthread
-INCLUDES                 := -iquote"${CURDIR}"
+MAIN                      = ../../../..
+INTERFACES                = $(MAIN)/interfaces
+HEAD                      = ${INTERFACES}/general-headers
+INCLUDES                 := -iquote"${CURDIR}" -iquote"${HEAD}"
 DISTDIR                   = ../bin
-OBJDIR                    = objects
+OBJDIR                    = objects_${BINARY_TYPE}
 WRAPPERDIR                = wrappers
 PROG                      = convert2bed
 SOURCE                    = convert2bed.c
 
+ifeq ($(BINARY_TYPE),)
+	TFLAG = -DBEDOPS_BINARY_TYPE=0
+else
+	TFLAG = -DBEDOPS_BINARY_TYPE=$(BINARY_TYPE_NUM)
+endif
+
 all: setup build
 
 .PHONY: setup build build_debug build_gprof clean
 
 setup:
+	rm -rf $(OBJDIR)
 	mkdir -p $(DISTDIR)
 	mkdir -p $(OBJDIR)
 
 build: setup
-	$(CC) -mmacosx-version-min=$(MIN_OSX_VERSION) -arch $(ARCH) $(BLDFLAGS) $(COMMONFLAGS) $(CFLAGS) -c $(SOURCE) -o $(OBJDIR)/$(PROG).o $(INCLUDES)
-	$(CC) -mmacosx-version-min=$(MIN_OSX_VERSION) -arch $(ARCH) $(BLDFLAGS) $(COMMONFLAGS) $(CFLAGS) $(OBJDIR)/$(PROG).o -o $(DISTDIR)/$(PROG)_$(ARCH) $(LIBS)
+	$(CC) -mmacosx-version-min=$(MIN_OSX_VERSION) -arch $(ARCH) $(TFLAG) $(BLDFLAGS) $(COMMONFLAGS) $(CFLAGS) -c $(SOURCE) -o $(OBJDIR)/$(PROG).o $(INCLUDES)
+	$(CC) -mmacosx-version-min=$(MIN_OSX_VERSION) -arch $(ARCH) $(TFLAG) $(BLDFLAGS) $(COMMONFLAGS) $(CFLAGS) $(OBJDIR)/$(PROG).o -o $(DISTDIR)/$(PROG)-${BINARY_TYPE} $(LIBS)
+	rm -rf $(OBJDIR)
 
 build_debug: setup
-	$(CC) -mmacosx-version-min=$(MIN_OSX_VERSION) -arch $(ARCH) $(BLDFLAGS) $(COMMONFLAGS) $(CDFLAGS) -c $(SOURCE) -o $(OBJDIR)/$(PROG).o $(INCLUDES)
-	$(CC) -mmacosx-version-min=$(MIN_OSX_VERSION) -arch $(ARCH) $(BLDFLAGS) $(COMMONFLAGS) $(CDFLAGS) $(OBJDIR)/$(PROG).o -o $(DISTDIR)/debug.$(PROG)_$(ARCH) $(LIBS)
+	$(CC) -mmacosx-version-min=$(MIN_OSX_VERSION) -arch $(ARCH) $(TFLAG) $(BLDFLAGS) $(COMMONFLAGS) $(CDFLAGS) -c $(SOURCE) -o $(OBJDIR)/$(PROG).o $(INCLUDES)
+	$(CC) -mmacosx-version-min=$(MIN_OSX_VERSION) -arch $(ARCH) $(TFLAG) $(BLDFLAGS) $(COMMONFLAGS) $(CDFLAGS) $(OBJDIR)/$(PROG).o -o $(DISTDIR)/debug.$(PROG)-${BINARY_TYPE} $(LIBS)
+	rm -rf $(OBJDIR)
 
 build_gprof: setup
 	$(CC) -mmacosx-version-min=$(MIN_OSX_VERSION) -arch $(ARCH) -shared -fPIC gprof-helper.c -o gprof-helper.so $(LIBS) -ldl
-	$(CC) -mmacosx-version-min=$(MIN_OSX_VERSION) -arch $(ARCH) $(BLDFLAGS) $(COMMONFLAGS) $(CPFLAGS) -c $(SOURCE) -o $(OBJDIR)/$(PROG).o $(INCLUDES)
-	$(CC) -mmacosx-version-min=$(MIN_OSX_VERSION) -arch $(ARCH) $(BLDFLAGS) $(COMMONFLAGS) $(CPFLAGS) $(OBJDIR)/$(PROG).o -o $(DISTDIR)/$(PROG)_$(ARCH) $(LIBS)
+	$(CC) -mmacosx-version-min=$(MIN_OSX_VERSION) -arch $(ARCH) $(TFLAG) $(BLDFLAGS) $(COMMONFLAGS) $(CPFLAGS) -c $(SOURCE) -o $(OBJDIR)/$(PROG).o $(INCLUDES)
+	$(CC) -mmacosx-version-min=$(MIN_OSX_VERSION) -arch $(ARCH) $(TFLAG) $(BLDFLAGS) $(COMMONFLAGS) $(CPFLAGS) $(OBJDIR)/$(PROG).o -o $(DISTDIR)/$(PROG)-${BINARY_TYPE} $(LIBS)
 	@echo "\nNote: To profile convert2bed with gprof/pthreads, run:\n\t$$ LD_PRELOAD=/path/to/gprof-helper.so convert2bed"
+	rm -rf $(OBJDIR)
 
 clean:
 	rm -rf $(OBJDIR)
diff --git a/applications/bed/conversion/src/convert2bed.c b/applications/bed/conversion/src/convert2bed.c
index b3d7bfe..45ec5be 100644
--- a/applications/bed/conversion/src/convert2bed.c
+++ b/applications/bed/conversion/src/convert2bed.c
@@ -23,7 +23,7 @@
 #include "convert2bed.h"
 
 int
-main(int argc, char **argv)
+main(int argc, char** argv)
 {
 #ifdef DEBUG
     fprintf (stderr, "--- convert2bed main() - enter ---\n");
@@ -65,7 +65,7 @@ main(int argc, char **argv)
 }
 
 static void
-c2b_init_conversion(c2b_pipeset_t *p)
+c2b_init_conversion(c2b_pipeset_t* p)
 {
 #ifdef DEBUG
     fprintf(stderr, "--- c2b_init_conversion() - enter ---\n");
@@ -112,38 +112,38 @@ c2b_init_conversion(c2b_pipeset_t *p)
 }
 
 static void
-c2b_init_gff_conversion(c2b_pipeset_t *p)
+c2b_init_gff_conversion(c2b_pipeset_t* p)
 {
     c2b_init_generic_conversion(p, &c2b_line_convert_gff_to_bed_unsorted);
 }
 
 static void
-c2b_init_gtf_conversion(c2b_pipeset_t *p)
+c2b_init_gtf_conversion(c2b_pipeset_t* p)
 {
     c2b_init_generic_conversion(p, &c2b_line_convert_gtf_to_bed_unsorted);
 }
 
 static void
-c2b_init_gvf_conversion(c2b_pipeset_t *p)
+c2b_init_gvf_conversion(c2b_pipeset_t* p)
 {
     /* GVF format conversion uses the GFF functor */
     c2b_init_generic_conversion(p, &c2b_line_convert_gff_to_bed_unsorted);
 }
 
 static void
-c2b_init_psl_conversion(c2b_pipeset_t *p)
+c2b_init_psl_conversion(c2b_pipeset_t* p)
 {
     c2b_init_generic_conversion(p, &c2b_line_convert_psl_to_bed_unsorted);
 }
 
 static void
-c2b_init_rmsk_conversion(c2b_pipeset_t *p)
+c2b_init_rmsk_conversion(c2b_pipeset_t* p)
 {
     c2b_init_generic_conversion(p, &c2b_line_convert_rmsk_to_bed_unsorted);
 }
 
 static void
-c2b_init_sam_conversion(c2b_pipeset_t *p)
+c2b_init_sam_conversion(c2b_pipeset_t* p)
 {
     c2b_init_generic_conversion(p, (!c2b_globals.split_flag ?
                                     &c2b_line_convert_sam_to_bed_unsorted_without_split_operation :
@@ -151,19 +151,19 @@ c2b_init_sam_conversion(c2b_pipeset_t *p)
 }
 
 static void
-c2b_init_vcf_conversion(c2b_pipeset_t *p)
+c2b_init_vcf_conversion(c2b_pipeset_t* p)
 {
     c2b_init_generic_conversion(p, &c2b_line_convert_vcf_to_bed_unsorted);
 }
 
 static void
-c2b_init_wig_conversion(c2b_pipeset_t *p)
+c2b_init_wig_conversion(c2b_pipeset_t* p)
 {
     c2b_init_generic_conversion(p, &c2b_line_convert_wig_to_bed_unsorted);
 }
 
 static void
-c2b_init_generic_conversion(c2b_pipeset_t *p, void(*to_bed_line_functor)(char *, ssize_t *, char *, ssize_t))
+c2b_init_generic_conversion(c2b_pipeset_t* p, void(*to_bed_line_functor)(char **, ssize_t *, ssize_t *, char *, ssize_t))
 {
 #ifdef DEBUG
     fprintf(stderr, "--- c2b_init_generic_conversion() - enter ---\n");
@@ -183,10 +183,10 @@ c2b_init_generic_conversion(c2b_pipeset_t *p, void(*to_bed_line_functor)(char *,
     c2b_pipeline_stage_t bed_sorted2stdout_stage;
     c2b_pipeline_stage_t bed_sorted2starch_stage;
     c2b_pipeline_stage_t starch2stdout_stage;
-    char cat2generic_cmd[C2B_MAX_LINE_LENGTH_VALUE];
-    char bed_unsorted2bed_sorted_cmd[C2B_MAX_LINE_LENGTH_VALUE];
-    char bed_sorted2starch_cmd[C2B_MAX_LINE_LENGTH_VALUE];
-    void (*generic2bed_unsorted_line_functor)(char *, ssize_t *, char *, ssize_t) = to_bed_line_functor;
+    char cat2generic_cmd[C2B_MAX_COMMAND_LINE_LENGTH_VALUE];
+    char bed_unsorted2bed_sorted_cmd[C2B_MAX_COMMAND_LINE_LENGTH_VALUE];
+    char bed_sorted2starch_cmd[C2B_MAX_COMMAND_LINE_LENGTH_VALUE];
+    void (*generic2bed_unsorted_line_functor)(char **, ssize_t *, ssize_t *, char *, ssize_t) = to_bed_line_functor;
     ssize_t buffer_size = C2B_THREAD_IO_BUFFER_SIZE;
     int errsv = 0;
 
@@ -461,7 +461,7 @@ c2b_init_generic_conversion(c2b_pipeset_t *p, void(*to_bed_line_functor)(char *,
 }
 
 static void
-c2b_init_bam_conversion(c2b_pipeset_t *p)
+c2b_init_bam_conversion(c2b_pipeset_t* p)
 {
 #ifdef DEBUG
     fprintf(stderr, "--- c2b_init_bam_conversion() - enter ---\n");
@@ -481,10 +481,10 @@ c2b_init_bam_conversion(c2b_pipeset_t *p)
     c2b_pipeline_stage_t bed_sorted2stdout_stage;
     c2b_pipeline_stage_t bed_sorted2starch_stage;
     c2b_pipeline_stage_t starch2stdout_stage;
-    char bam2sam_cmd[C2B_MAX_LINE_LENGTH_VALUE];
-    char bed_unsorted2bed_sorted_cmd[C2B_MAX_LINE_LENGTH_VALUE];
-    char bed_sorted2starch_cmd[C2B_MAX_LINE_LENGTH_VALUE];
-    void (*sam2bed_unsorted_line_functor)(char *, ssize_t *, char *, ssize_t) = NULL;
+    char bam2sam_cmd[C2B_MAX_COMMAND_LINE_LENGTH_VALUE];
+    char bed_unsorted2bed_sorted_cmd[C2B_MAX_COMMAND_LINE_LENGTH_VALUE];
+    char bed_sorted2starch_cmd[C2B_MAX_COMMAND_LINE_LENGTH_VALUE];
+    void (*sam2bed_unsorted_line_functor)(char **, ssize_t *, ssize_t *, char *, ssize_t) = NULL;
     ssize_t buffer_size = C2B_THREAD_IO_BUFFER_SIZE;
     int errsv = errno;
 
@@ -763,9 +763,9 @@ c2b_init_bam_conversion(c2b_pipeset_t *p)
 }
 
 static inline void
-c2b_cmd_cat_stdin(char *cmd)
+c2b_cmd_cat_stdin(char* cmd)
 {
-    const char *cat_args = " - ";
+    const char* cat_args = " - ";
     
     /* /path/to/cat - */
     memcpy(cmd,
@@ -778,9 +778,9 @@ c2b_cmd_cat_stdin(char *cmd)
 }
 
 static inline void
-c2b_cmd_bam_to_sam(char *cmd)
+c2b_cmd_bam_to_sam(char* cmd)
 {
-    const char *bam2sam_args = " view -h -";
+    const char* bam2sam_args = " view -h -";
 
     /* /path/to/samtools view -h - */
     memcpy(cmd, 
@@ -793,10 +793,10 @@ c2b_cmd_bam_to_sam(char *cmd)
 }
 
 static inline void
-c2b_cmd_sort_bed(char *cmd)
+c2b_cmd_sort_bed(char* cmd)
 {
-    char sort_bed_args[C2B_MAX_LINE_LENGTH_VALUE];
-    memset(sort_bed_args, 0, C2B_MAX_LINE_LENGTH_VALUE);
+    char sort_bed_args[C2B_MAX_COMMAND_LINE_LENGTH_VALUE];
+    memset(sort_bed_args, 0, C2B_MAX_COMMAND_LINE_LENGTH_VALUE);
 
     /* /path/to/sort-bed [--max-mem <val>] [--tmpdir <path>] - */
     if (c2b_globals.sort->max_mem_value) {
@@ -839,10 +839,10 @@ c2b_cmd_sort_bed(char *cmd)
 }
 
 static inline void
-c2b_cmd_starch_bed(char *cmd) 
+c2b_cmd_starch_bed(char* cmd) 
 {
-    char starch_args[C2B_MAX_LINE_LENGTH_VALUE];
-    memset(starch_args, 0, C2B_MAX_LINE_LENGTH_VALUE);
+    char starch_args[C2B_MAX_COMMAND_LINE_LENGTH_VALUE];
+    memset(starch_args, 0, C2B_MAX_COMMAND_LINE_LENGTH_VALUE);
 
     /* /path/to/starch [--bzip2 | --gzip] [--note="xyz..."] - */
     if (c2b_globals.starch->bzip2) {
@@ -896,7 +896,7 @@ c2b_cmd_starch_bed(char *cmd)
 }
 
 static void
-c2b_gtf_init_element(c2b_gtf_t **e)
+c2b_gtf_init_element(c2b_gtf_t** e)
 {
     *e = malloc(sizeof(c2b_gtf_t));
     if (!*e) {
@@ -982,7 +982,7 @@ c2b_gtf_init_element(c2b_gtf_t **e)
 }
 
 static void
-c2b_gtf_delete_element(c2b_gtf_t *e)
+c2b_gtf_delete_element(c2b_gtf_t* e)
 {
     if (e->seqname)         { free(e->seqname),         e->seqname = NULL;         }
     if (e->source)          { free(e->source),          e->source = NULL;          }
@@ -997,7 +997,7 @@ c2b_gtf_delete_element(c2b_gtf_t *e)
 }
 
 static void
-c2b_line_convert_gtf_to_bed_unsorted(char *dest, ssize_t *dest_size, char *src, ssize_t src_size)
+c2b_line_convert_gtf_to_bed_unsorted(char** dest, ssize_t* dest_size, ssize_t* dest_capacity, char* src, ssize_t src_size)
 {
     ssize_t gtf_field_offsets[C2B_MAX_FIELD_COUNT_VALUE];
     int gtf_field_idx = 0;
@@ -1027,14 +1027,27 @@ c2b_line_convert_gtf_to_bed_unsorted(char *dest, ssize_t *dest_size, char *src,
                     return;
                 }
                 else {
+                    /* set up temporary header stream buffers */
+                    if (!c2b_globals.src_line_str) {
+                        c2b_globals.src_line_str = malloc(C2B_MAX_LINE_LENGTH_VALUE + 1);
+                        if (!c2b_globals.src_line_str) {
+                            fprintf(stderr, "Error: Could not allocate space for globals source line buffer\n");
+                            exit(ENOMEM);
+                        }
+                    }
+                    if (!c2b_globals.dest_line_str) {
+                        c2b_globals.dest_line_str = malloc(C2B_MAX_LINE_LENGTH_VALUE + 1);
+                        if (!c2b_globals.dest_line_str) {
+                            fprintf(stderr, "Error: Could not allocate space for globals destination line buffer\n");
+                            exit(ENOMEM);
+                        }
+                    }
                     /* copy header line to destination stream buffer */
-                    char src_header_line_str[C2B_MAX_LINE_LENGTH_VALUE];
-                    char dest_header_line_str[C2B_MAX_LINE_LENGTH_VALUE];
-                    memcpy(src_header_line_str, src, src_size);
-                    src_header_line_str[src_size] = '\0';
-                    sprintf(dest_header_line_str, "%s\t%u\t%u\t%s\n", c2b_header_chr_name, c2b_globals.header_line_idx, (c2b_globals.header_line_idx + 1), src_header_line_str);
-                    memcpy(dest + *dest_size, dest_header_line_str, strlen(dest_header_line_str));
-                    *dest_size += strlen(dest_header_line_str);
+                    memcpy(c2b_globals.src_line_str, src, src_size);
+                    c2b_globals.src_line_str[src_size] = '\0';
+                    sprintf(c2b_globals.dest_line_str, "%s\t%u\t%u\t%s\n", c2b_header_chr_name, c2b_globals.header_line_idx, (c2b_globals.header_line_idx + 1), c2b_globals.src_line_str);
+                    memcpy(*dest + *dest_size, c2b_globals.dest_line_str, strlen(c2b_globals.dest_line_str));
+                    *dest_size += strlen(c2b_globals.dest_line_str);
                     c2b_globals.header_line_idx++;
                     return;
                 }
@@ -1294,12 +1307,12 @@ c2b_line_convert_gtf_to_bed_unsorted(char *dest, ssize_t *dest_size, char *src,
        Convert GTF struct to BED string and copy it to destination
     */
 
-    c2b_line_convert_gtf_ptr_to_bed(c2b_globals.gtf->element, dest, dest_size);
+    c2b_line_convert_gtf_ptr_to_bed(c2b_globals.gtf->element, dest, dest_size, dest_capacity);
     c2b_globals.gtf->line_count++;
 }
 
 static inline void
-c2b_line_convert_gtf_ptr_to_bed(c2b_gtf_t *g, char *dest_line, ssize_t *dest_size)
+c2b_line_convert_gtf_ptr_to_bed(c2b_gtf_t* g, char** dest_line_ptr, ssize_t* dest_size, ssize_t* dest_capacity)
 {
     /* 
        For GTF-formatted data, we use the mapping provided by BEDOPS convention described at:
@@ -1331,8 +1344,21 @@ c2b_line_convert_gtf_ptr_to_bed(c2b_gtf_t *g, char *dest_line, ssize_t *dest_siz
        comments                  11                     -
     */
 
+    if ((ssize_t)(*dest_size + C2B_MAX_LINE_LENGTH_VALUE) > *dest_capacity) {
+        char *dest_line_resized = NULL;
+        dest_line_resized = realloc(*dest_line_ptr, *dest_capacity * 2);
+        if (dest_line_resized) {
+            *dest_capacity *= 2;
+            *dest_line_ptr = dest_line_resized;
+        }
+        else {
+            fprintf(stderr, "Error: Could not resize dest_line_ptr string in GTF pointer conversion fn\n");
+            exit(ENOMEM);
+        }
+    }
+
     if (strlen(g->comments) == 0) {
-        *dest_size += sprintf(dest_line + *dest_size,
+        *dest_size += sprintf(*dest_line_ptr + *dest_size,
                               "%s\t"            \
                               "%" PRIu64 "\t"   \
                               "%" PRIu64 "\t"   \
@@ -1355,7 +1381,7 @@ c2b_line_convert_gtf_ptr_to_bed(c2b_gtf_t *g, char *dest_line, ssize_t *dest_siz
                               g->attributes);
     }
     else {
-        *dest_size += sprintf(dest_line + *dest_size,
+        *dest_size += sprintf(*dest_line_ptr + *dest_size,
                               "%s\t"            \
                               "%" PRIu64 "\t"   \
                               "%" PRIu64 "\t"   \
@@ -1382,7 +1408,7 @@ c2b_line_convert_gtf_ptr_to_bed(c2b_gtf_t *g, char *dest_line, ssize_t *dest_siz
 }
 
 static void
-c2b_gff_init_element(c2b_gff_t **e)
+c2b_gff_init_element(c2b_gff_t** e)
 {
     *e = malloc(sizeof(c2b_gff_t));
     if (!*e) {
@@ -1460,7 +1486,7 @@ c2b_gff_init_element(c2b_gff_t **e)
 }
 
 static void
-c2b_gff_delete_element(c2b_gff_t *e)
+c2b_gff_delete_element(c2b_gff_t* e)
 {
     if (e->seqid)           { free(e->seqid),           e->seqid = NULL;           }
     if (e->source)          { free(e->source),          e->source = NULL;          }
@@ -1474,7 +1500,7 @@ c2b_gff_delete_element(c2b_gff_t *e)
 }
 
 static void
-c2b_line_convert_gff_to_bed_unsorted(char *dest, ssize_t *dest_size, char *src, ssize_t src_size)
+c2b_line_convert_gff_to_bed_unsorted(char** dest, ssize_t* dest_size, ssize_t* dest_capacity, char* src, ssize_t src_size)
 {
     ssize_t gff_field_offsets[C2B_MAX_FIELD_COUNT_VALUE];
     int gff_field_idx = 0;
@@ -1498,44 +1524,48 @@ c2b_line_convert_gff_to_bed_unsorted(char *dest, ssize_t *dest_size, char *src,
     */
 
     if (((gff_field_idx + 1) < c2b_gff_field_min) || ((gff_field_idx + 1) > c2b_gff_field_max)) {
-        if (gff_field_idx == 0) {
-            char non_interval_str[C2B_MAX_FIELD_LENGTH_VALUE];
-            memcpy(non_interval_str, src, current_src_posn);
-            non_interval_str[current_src_posn] = '\0';
-            char non_int_prefix[C2B_MAX_FIELD_LENGTH_VALUE];
-            strncpy(non_int_prefix, non_interval_str, 2);
-            non_int_prefix[2] = '\0';
-            /* We compare against either of two standard GFF3 or GVF header pragmas */
-            if ((strcmp(non_interval_str, c2b_gff_header) == 0) || 
-                (strcmp(non_interval_str, c2b_gvf_header) == 0) || 
-                (strcmp(non_int_prefix, c2b_gvf_generic_header) == 0)) {
-                if (!c2b_globals.keep_header_flag) {
-                    return;
-                }
-                else {
-                    /* copy header line to destination stream buffer */
-                    char src_header_line_str[C2B_MAX_LINE_LENGTH_VALUE];
-                    char dest_header_line_str[C2B_MAX_LINE_LENGTH_VALUE];
-                    memcpy(src_header_line_str, src, src_size);
-                    src_header_line_str[src_size] = '\0';
-                    sprintf(dest_header_line_str, "%s\t%u\t%u\t%s\n", c2b_header_chr_name, c2b_globals.header_line_idx, (c2b_globals.header_line_idx + 1), src_header_line_str);
-                    memcpy(dest + *dest_size, dest_header_line_str, strlen(dest_header_line_str));
-                    *dest_size += strlen(dest_header_line_str);
-                    c2b_globals.header_line_idx++;
-                    return;                    
-                }
-            }
-            else if (strcmp(non_interval_str, c2b_gff_fasta) == 0) {
+        char header_str[C2B_MAX_FIELD_LENGTH_VALUE];
+        memcpy(header_str, src, gff_field_offsets[0]);
+        header_str[gff_field_offsets[0]] = '\0';
+        char non_int_prefix[C2B_MAX_FIELD_LENGTH_VALUE];
+        strncpy(non_int_prefix, header_str, 2);
+        non_int_prefix[2] = '\0';
+        /* We compare against either of two standard GFF3 or GVF header pragmas */
+        if ((strcmp(header_str, c2b_gff_header) == 0) ||
+            (strcmp(header_str, c2b_gff_fasta) == 0) ||
+            (strcmp(header_str, c2b_gvf_header) == 0) ||
+            (strcmp(non_int_prefix, c2b_gvf_generic_header) == 0)) {
+            if (!c2b_globals.keep_header_flag) {
                 return;
             }
             else {
+                /* set up temporary header stream buffers */
+                if (!c2b_globals.src_line_str) {
+                    c2b_globals.src_line_str = malloc(C2B_MAX_LINE_LENGTH_VALUE + 1);
+                    if (!c2b_globals.src_line_str) {
+                        fprintf(stderr, "Error: Could not allocate space for globals source line buffer\n");
+                        exit(ENOMEM);
+                    }
+                }
+                if (!c2b_globals.dest_line_str) {
+                    c2b_globals.dest_line_str = malloc(C2B_MAX_LINE_LENGTH_VALUE + 1);
+                    if (!c2b_globals.dest_line_str) {
+                        fprintf(stderr, "Error: Could not allocate space for globals destination line buffer\n");
+                        exit(ENOMEM);
+                    }
+                }
+                /* copy header line to destination stream buffer */
+                memcpy(c2b_globals.src_line_str, src, src_size);
+                c2b_globals.src_line_str[src_size] = '\0';
+                sprintf(c2b_globals.dest_line_str, "%s\t%u\t%u\t%s\n", c2b_header_chr_name, c2b_globals.header_line_idx, (c2b_globals.header_line_idx + 1), c2b_globals.src_line_str);
+                memcpy(*dest + *dest_size, c2b_globals.dest_line_str, strlen(c2b_globals.dest_line_str));
+                *dest_size += strlen(c2b_globals.dest_line_str);
+                c2b_globals.header_line_idx++;
                 return;
             }
         }
         else {
-            fprintf(stderr, "Error: Invalid field count (%d) -- input file may not match input format\n", gff_field_idx);
-            c2b_print_usage(stderr);
-            exit(EINVAL); /* Invalid argument (POSIX.1) */
+            return;
         }
     }
 
@@ -1744,11 +1774,11 @@ c2b_line_convert_gff_to_bed_unsorted(char *dest, ssize_t *dest_size, char *src,
        Convert GFF struct to BED string and copy it to destination
     */
 
-    c2b_line_convert_gff_ptr_to_bed(c2b_globals.gff->element, dest, dest_size);
+    c2b_line_convert_gff_ptr_to_bed(c2b_globals.gff->element, dest, dest_size, dest_capacity);
 }
 
 static inline void
-c2b_line_convert_gff_ptr_to_bed(c2b_gff_t *g, char *dest_line, ssize_t *dest_size)
+c2b_line_convert_gff_ptr_to_bed(c2b_gff_t* g, char** dest_line_ptr, ssize_t* dest_size, ssize_t* dest_capacity)
 {
     /* 
        For GFF- and GVF-formatted data, we use the mapping provided by BEDOPS convention described at:
@@ -1774,7 +1804,20 @@ c2b_line_convert_gff_ptr_to_bed(c2b_gff_t *g, char *dest_line, ssize_t *dest_siz
        attributes                10                     -
     */
 
-    *dest_size += sprintf(dest_line + *dest_size,
+    if ((ssize_t)(*dest_size + C2B_MAX_LINE_LENGTH_VALUE) > *dest_capacity) {
+        char *dest_line_resized = NULL;
+        dest_line_resized = realloc(*dest_line_ptr, *dest_capacity * 2);
+        if (dest_line_resized) {
+            *dest_capacity *= 2;
+            *dest_line_ptr = dest_line_resized;
+        }
+        else {
+            fprintf(stderr, "Error: Could not resize dest_line_ptr string in GFF pointer conversion fn\n");
+            exit(ENOMEM);
+        }
+    }
+
+    *dest_size += sprintf(*dest_line_ptr + *dest_size,
                           "%s\t"                \
                           "%" PRIu64 "\t"       \
                           "%" PRIu64 "\t"       \
@@ -1798,7 +1841,229 @@ c2b_line_convert_gff_ptr_to_bed(c2b_gff_t *g, char *dest_line, ssize_t *dest_siz
 }
 
 static void
-c2b_line_convert_psl_to_bed_unsorted(char *dest, ssize_t *dest_size, char *src, ssize_t src_size)
+c2b_psl_init_element(c2b_psl_t** e)
+{
+    *e = malloc(sizeof(c2b_psl_t));
+    if (!*e) {
+        fprintf(stderr, "Error: Could not allocate space for PSL element pointer\n");
+        c2b_print_usage(stderr);
+        exit(ENOMEM); /* Not enough space (POSIX.1) */
+    }
+
+    (*e)->matchesStr = NULL, (*e)->matchesStr = malloc(C2B_PSL_ELEMENT_FIELD_LENGTH_VALUE_INITIAL * sizeof(*((*e)->matchesStr)));
+    if (!(*e)->matchesStr) { 
+        fprintf(stderr, "Error: Could not allocate space for PSL element matchesStr malloc operation\n");
+        c2b_print_usage(stderr);
+        exit(ENOMEM); /* Not enough space (POSIX.1) */
+    }
+    (*e)->matchesStr_capacity = C2B_PSL_ELEMENT_FIELD_LENGTH_VALUE_INITIAL;
+
+    (*e)->misMatchesStr = NULL, (*e)->misMatchesStr = malloc(C2B_PSL_ELEMENT_FIELD_LENGTH_VALUE_INITIAL * sizeof(*((*e)->misMatchesStr)));
+    if (!(*e)->misMatchesStr) { 
+        fprintf(stderr, "Error: Could not allocate space for PSL element misMatchesStr malloc operation\n");
+        c2b_print_usage(stderr);
+        exit(ENOMEM); /* Not enough space (POSIX.1) */
+    }
+    (*e)->misMatchesStr_capacity = C2B_PSL_ELEMENT_FIELD_LENGTH_VALUE_INITIAL;
+
+    (*e)->repMatchesStr = NULL, (*e)->repMatchesStr = malloc(C2B_PSL_ELEMENT_FIELD_LENGTH_VALUE_INITIAL * sizeof(*((*e)->repMatchesStr)));
+    if (!(*e)->repMatchesStr) { 
+        fprintf(stderr, "Error: Could not allocate space for PSL element repMatchesStr malloc operation\n");
+        c2b_print_usage(stderr);
+        exit(ENOMEM); /* Not enough space (POSIX.1) */
+    }
+    (*e)->repMatchesStr_capacity = C2B_PSL_ELEMENT_FIELD_LENGTH_VALUE_INITIAL;
+
+    (*e)->nCountStr = NULL, (*e)->nCountStr = malloc(C2B_PSL_ELEMENT_FIELD_LENGTH_VALUE_INITIAL * sizeof(*((*e)->nCountStr)));
+    if (!(*e)->nCountStr) { 
+        fprintf(stderr, "Error: Could not allocate space for PSL element nCountStr malloc operation\n");
+        c2b_print_usage(stderr);
+        exit(ENOMEM); /* Not enough space (POSIX.1) */
+    }
+    (*e)->nCountStr_capacity = C2B_PSL_ELEMENT_FIELD_LENGTH_VALUE_INITIAL;
+
+    (*e)->qNumInsertStr = NULL, (*e)->qNumInsertStr = malloc(C2B_PSL_ELEMENT_FIELD_LENGTH_VALUE_INITIAL * sizeof(*((*e)->qNumInsertStr)));
+    if (!(*e)->qNumInsertStr) { 
+        fprintf(stderr, "Error: Could not allocate space for PSL element qNumInsertStr malloc operation\n");
+        c2b_print_usage(stderr);
+        exit(ENOMEM); /* Not enough space (POSIX.1) */
+    }
+    (*e)->qNumInsertStr_capacity = C2B_PSL_ELEMENT_FIELD_LENGTH_VALUE_INITIAL;
+
+    (*e)->qBaseInsertStr = NULL, (*e)->qBaseInsertStr = malloc(C2B_PSL_ELEMENT_FIELD_LENGTH_VALUE_INITIAL * sizeof(*((*e)->qBaseInsertStr)));
+    if (!(*e)->qBaseInsertStr) { 
+        fprintf(stderr, "Error: Could not allocate space for PSL element qBaseInsertStr malloc operation\n");
+        c2b_print_usage(stderr);
+        exit(ENOMEM); /* Not enough space (POSIX.1) */
+    }
+    (*e)->qBaseInsertStr_capacity = C2B_PSL_ELEMENT_FIELD_LENGTH_VALUE_INITIAL;
+
+    (*e)->tNumInsertStr = NULL, (*e)->tNumInsertStr = malloc(C2B_PSL_ELEMENT_FIELD_LENGTH_VALUE_INITIAL * sizeof(*((*e)->tNumInsertStr)));
+    if (!(*e)->tNumInsertStr) { 
+        fprintf(stderr, "Error: Could not allocate space for PSL element tNumInsertStr malloc operation\n");
+        c2b_print_usage(stderr);
+        exit(ENOMEM); /* Not enough space (POSIX.1) */
+    }
+    (*e)->tNumInsertStr_capacity = C2B_PSL_ELEMENT_FIELD_LENGTH_VALUE_INITIAL;
+
+    (*e)->tBaseInsertStr = NULL, (*e)->tBaseInsertStr = malloc(C2B_PSL_ELEMENT_FIELD_LENGTH_VALUE_INITIAL * sizeof(*((*e)->tBaseInsertStr)));
+    if (!(*e)->tBaseInsertStr) { 
+        fprintf(stderr, "Error: Could not allocate space for PSL element tBaseInsertStr malloc operation\n");
+        c2b_print_usage(stderr);
+        exit(ENOMEM); /* Not enough space (POSIX.1) */
+    }
+    (*e)->tBaseInsertStr_capacity = C2B_PSL_ELEMENT_FIELD_LENGTH_VALUE_INITIAL;
+
+    (*e)->strand = NULL, (*e)->strand = malloc(C2B_PSL_ELEMENT_FIELD_LENGTH_VALUE_INITIAL * sizeof(*((*e)->strand)));
+    if (!(*e)->strand) { 
+        fprintf(stderr, "Error: Could not allocate space for PSL element strand malloc operation\n");
+        c2b_print_usage(stderr);
+        exit(ENOMEM); /* Not enough space (POSIX.1) */
+    }
+    (*e)->strand_capacity = C2B_PSL_ELEMENT_FIELD_LENGTH_VALUE_INITIAL;
+
+    (*e)->qName = NULL, (*e)->qName = malloc(C2B_PSL_ELEMENT_FIELD_LENGTH_VALUE_INITIAL * sizeof(*((*e)->qName)));
+    if (!(*e)->qName) { 
+        fprintf(stderr, "Error: Could not allocate space for PSL element qName malloc operation\n");
+        c2b_print_usage(stderr);
+        exit(ENOMEM); /* Not enough space (POSIX.1) */
+    }
+    (*e)->qName_capacity = C2B_PSL_ELEMENT_FIELD_LENGTH_VALUE_INITIAL;
+
+    (*e)->qSizeStr = NULL, (*e)->qSizeStr = malloc(C2B_PSL_ELEMENT_FIELD_LENGTH_VALUE_INITIAL * sizeof(*((*e)->qSizeStr)));
+    if (!(*e)->qSizeStr) { 
+        fprintf(stderr, "Error: Could not allocate space for PSL element qSizeStr malloc operation\n");
+        c2b_print_usage(stderr);
+        exit(ENOMEM); /* Not enough space (POSIX.1) */
+    }
+    (*e)->qSizeStr_capacity = C2B_PSL_ELEMENT_FIELD_LENGTH_VALUE_INITIAL;
+
+    (*e)->qStartStr = NULL, (*e)->qStartStr = malloc(C2B_PSL_ELEMENT_FIELD_LENGTH_VALUE_INITIAL * sizeof(*((*e)->qStartStr)));
+    if (!(*e)->qStartStr) { 
+        fprintf(stderr, "Error: Could not allocate space for PSL element qStartStr malloc operation\n");
+        c2b_print_usage(stderr);
+        exit(ENOMEM); /* Not enough space (POSIX.1) */
+    }
+    (*e)->qStartStr_capacity = C2B_PSL_ELEMENT_FIELD_LENGTH_VALUE_INITIAL;
+
+    (*e)->qEndStr = NULL, (*e)->qEndStr = malloc(C2B_PSL_ELEMENT_FIELD_LENGTH_VALUE_INITIAL * sizeof(*((*e)->qEndStr)));
+    if (!(*e)->qEndStr) { 
+        fprintf(stderr, "Error: Could not allocate space for PSL element qEndStr malloc operation\n");
+        c2b_print_usage(stderr);
+        exit(ENOMEM); /* Not enough space (POSIX.1) */
+    }
+    (*e)->qEndStr_capacity = C2B_PSL_ELEMENT_FIELD_LENGTH_VALUE_INITIAL;
+
+    (*e)->tName = NULL, (*e)->tName = malloc(C2B_PSL_ELEMENT_FIELD_LENGTH_VALUE_INITIAL * sizeof(*((*e)->tName)));
+    if (!(*e)->tName) { 
+        fprintf(stderr, "Error: Could not allocate space for PSL element tName malloc operation\n");
+        c2b_print_usage(stderr);
+        exit(ENOMEM); /* Not enough space (POSIX.1) */
+    }
+    (*e)->tName_capacity = C2B_PSL_ELEMENT_FIELD_LENGTH_VALUE_INITIAL;
+
+    (*e)->tSizeStr = NULL, (*e)->tSizeStr = malloc(C2B_PSL_ELEMENT_FIELD_LENGTH_VALUE_INITIAL * sizeof(*((*e)->tSizeStr)));
+    if (!(*e)->tSizeStr) { 
+        fprintf(stderr, "Error: Could not allocate space for PSL element tSizeStr malloc operation\n");
+        c2b_print_usage(stderr);
+        exit(ENOMEM); /* Not enough space (POSIX.1) */
+    }
+    (*e)->tSizeStr_capacity = C2B_PSL_ELEMENT_FIELD_LENGTH_VALUE_INITIAL;
+
+    (*e)->tStartStr = NULL, (*e)->tStartStr = malloc(C2B_PSL_ELEMENT_FIELD_LENGTH_VALUE_INITIAL * sizeof(*((*e)->tStartStr)));
+    if (!(*e)->tStartStr) { 
+        fprintf(stderr, "Error: Could not allocate space for PSL element tStartStr malloc operation\n");
+        c2b_print_usage(stderr);
+        exit(ENOMEM); /* Not enough space (POSIX.1) */
+    }
+    (*e)->tStartStr_capacity = C2B_PSL_ELEMENT_FIELD_LENGTH_VALUE_INITIAL;
+
+    (*e)->tEndStr = NULL, (*e)->tEndStr = malloc(C2B_PSL_ELEMENT_FIELD_LENGTH_VALUE_INITIAL * sizeof(*((*e)->tEndStr)));
+    if (!(*e)->tEndStr) { 
+        fprintf(stderr, "Error: Could not allocate space for PSL element tEndStr malloc operation\n");
+        c2b_print_usage(stderr);
+        exit(ENOMEM); /* Not enough space (POSIX.1) */
+    }
+    (*e)->tEndStr_capacity = C2B_PSL_ELEMENT_FIELD_LENGTH_VALUE_INITIAL;
+
+    (*e)->blockCountStr = NULL, (*e)->blockCountStr = malloc(C2B_PSL_ELEMENT_FIELD_LENGTH_VALUE_INITIAL * sizeof(*((*e)->blockCountStr)));
+    if (!(*e)->blockCountStr) { 
+        fprintf(stderr, "Error: Could not allocate space for PSL element blockCountStr malloc operation\n");
+        c2b_print_usage(stderr);
+        exit(ENOMEM); /* Not enough space (POSIX.1) */
+    }
+    (*e)->blockCountStr_capacity = C2B_PSL_ELEMENT_FIELD_LENGTH_VALUE_INITIAL;
+
+    (*e)->blockSizes = NULL, (*e)->blockSizes = malloc(C2B_PSL_ELEMENT_FIELD_LENGTH_VALUE_INITIAL * sizeof(*((*e)->blockSizes)));
+    if (!(*e)->blockSizes) { 
+        fprintf(stderr, "Error: Could not allocate space for PSL element blockSizes malloc operation\n");
+        c2b_print_usage(stderr);
+        exit(ENOMEM); /* Not enough space (POSIX.1) */
+    }
+    (*e)->blockSizes_capacity = C2B_PSL_ELEMENT_FIELD_LENGTH_VALUE_INITIAL;
+
+    (*e)->qStarts = NULL, (*e)->qStarts = malloc(C2B_PSL_ELEMENT_FIELD_LENGTH_VALUE_INITIAL * sizeof(*((*e)->qStarts)));
+    if (!(*e)->qStarts) { 
+        fprintf(stderr, "Error: Could not allocate space for PSL element qStarts malloc operation\n");
+        c2b_print_usage(stderr);
+        exit(ENOMEM); /* Not enough space (POSIX.1) */
+    }
+    (*e)->qStarts_capacity = C2B_PSL_ELEMENT_FIELD_LENGTH_VALUE_INITIAL;
+
+    (*e)->tStarts = NULL, (*e)->tStarts = malloc(C2B_PSL_ELEMENT_FIELD_LENGTH_VALUE_INITIAL * sizeof(*((*e)->tStarts)));
+    if (!(*e)->tStarts) { 
+        fprintf(stderr, "Error: Could not allocate space for PSL element tStarts malloc operation\n");
+        c2b_print_usage(stderr);
+        exit(ENOMEM); /* Not enough space (POSIX.1) */
+    }
+    (*e)->tStarts_capacity = C2B_PSL_ELEMENT_FIELD_LENGTH_VALUE_INITIAL;
+
+    (*e)->matches = 0;
+    (*e)->misMatches = 0;
+    (*e)->repMatches = 0;
+    (*e)->nCount = 0;
+    (*e)->qNumInsert = 0;
+    (*e)->qBaseInsert = 0;
+    (*e)->tNumInsert = 0;
+    (*e)->tBaseInsert = 0;
+    (*e)->qSize = 0;
+    (*e)->qStart = 0;
+    (*e)->qEnd = 0;
+    (*e)->tSize = 0;
+    (*e)->tStart = 0;
+    (*e)->tEnd = 0;
+    (*e)->blockCount = 0;
+}
+
+static void
+c2b_psl_delete_element(c2b_psl_t* e)
+{
+    if (e->matchesStr)      { free(e->matchesStr),      e->matchesStr = NULL;      }
+    if (e->misMatchesStr)   { free(e->misMatchesStr),   e->misMatchesStr = NULL;   }
+    if (e->repMatchesStr)   { free(e->repMatchesStr),   e->repMatchesStr = NULL;   }
+    if (e->nCountStr)       { free(e->nCountStr),       e->nCountStr = NULL;       }
+    if (e->qNumInsertStr)   { free(e->qNumInsertStr),   e->qNumInsertStr = NULL;   }
+    if (e->qBaseInsertStr)  { free(e->qBaseInsertStr),  e->qBaseInsertStr = NULL;  }
+    if (e->tNumInsertStr)   { free(e->tNumInsertStr),   e->tNumInsertStr = NULL;   }
+    if (e->tBaseInsertStr)  { free(e->tBaseInsertStr),  e->tBaseInsertStr = NULL;  }
+    if (e->strand)          { free(e->strand),          e->strand = NULL;          }
+    if (e->qName)           { free(e->qName),           e->qName = NULL;           }
+    if (e->qSizeStr)        { free(e->qSizeStr),        e->qSizeStr = NULL;        }
+    if (e->qStartStr)       { free(e->qStartStr),       e->qStartStr = NULL;       }
+    if (e->qEndStr)         { free(e->qEndStr),         e->qEndStr = NULL;         }
+    if (e->tName)           { free(e->tName),           e->tName = NULL;           }
+    if (e->tSizeStr)        { free(e->tSizeStr),        e->tSizeStr = NULL;        }
+    if (e->tStartStr)       { free(e->tStartStr),       e->tStartStr = NULL;       }
+    if (e->tEndStr)         { free(e->tEndStr),         e->tEndStr = NULL;         }
+    if (e->blockCountStr)   { free(e->blockCountStr),   e->blockCountStr = NULL;   }
+    if (e->blockSizes)      { free(e->blockSizes),      e->blockSizes = NULL;      }
+    if (e->qStarts)         { free(e->qStarts),         e->qStarts = NULL;         }
+    if (e->tStarts)         { free(e->tStarts),         e->tStarts = NULL;         }
+    if (e)                  { free(e),                  e = NULL;                  }
+}
+
+static void
+c2b_line_convert_psl_to_bed_unsorted(char** dest, ssize_t* dest_size, ssize_t* dest_capacity, char* src, ssize_t src_size)
 {
     ssize_t psl_field_offsets[C2B_MAX_FIELD_COUNT_VALUE];
     int psl_field_idx = 0;
@@ -1824,14 +2089,27 @@ c2b_line_convert_psl_to_bed_unsorted(char *dest, ssize_t *dest_size, char *src,
     if (((psl_field_idx + 1) < c2b_psl_field_min) || ((psl_field_idx + 1) > c2b_psl_field_max)) {
         if ((psl_field_idx == 0) || (psl_field_idx == 17)) {
             if ((c2b_globals.psl->is_headered) && (c2b_globals.keep_header_flag) && (c2b_globals.header_line_idx <= 5)) {
+                /* set up temporary header stream buffers */
+                if (!c2b_globals.src_line_str) {
+                    c2b_globals.src_line_str = malloc(C2B_MAX_LINE_LENGTH_VALUE + 1);
+                    if (!c2b_globals.src_line_str) {
+                        fprintf(stderr, "Error: Could not allocate space for globals source line buffer\n");
+                        exit(ENOMEM);
+                    }
+                }
+                if (!c2b_globals.dest_line_str) {
+                    c2b_globals.dest_line_str = malloc(C2B_MAX_LINE_LENGTH_VALUE + 1);
+                    if (!c2b_globals.dest_line_str) {
+                        fprintf(stderr, "Error: Could not allocate space for globals destination line buffer\n");
+                        exit(ENOMEM);
+                    }
+                }
                 /* copy header line to destination stream buffer */
-                char src_header_line_str[C2B_MAX_LINE_LENGTH_VALUE];
-                char dest_header_line_str[C2B_MAX_LINE_LENGTH_VALUE];
-                memcpy(src_header_line_str, src, src_size);
-                src_header_line_str[src_size] = '\0';
-                sprintf(dest_header_line_str, "%s\t%u\t%u\t%s\n", c2b_header_chr_name, c2b_globals.header_line_idx, (c2b_globals.header_line_idx + 1), src_header_line_str);
-                memcpy(dest + *dest_size, dest_header_line_str, strlen(dest_header_line_str));
-                *dest_size += strlen(dest_header_line_str);
+                memcpy(c2b_globals.src_line_str, src, src_size);
+                c2b_globals.src_line_str[src_size] = '\0';
+                sprintf(c2b_globals.dest_line_str, "%s\t%u\t%u\t%s\n", c2b_header_chr_name, c2b_globals.header_line_idx, (c2b_globals.header_line_idx + 1), c2b_globals.src_line_str);
+                memcpy(*dest + *dest_size, c2b_globals.dest_line_str, strlen(c2b_globals.dest_line_str));
+                *dest_size += strlen(c2b_globals.dest_line_str);
                 c2b_globals.header_line_idx++;
                 return;                    
             }
@@ -1853,14 +2131,25 @@ c2b_line_convert_psl_to_bed_unsorted(char *dest, ssize_t *dest_size, char *src,
     }
 
     /* 0 - matches */
-    char matches_str[C2B_MAX_FIELD_LENGTH_VALUE];
-    ssize_t matches_size = psl_field_offsets[0];
-    memcpy(matches_str, src, matches_size);
-    matches_str[matches_size] = '\0';
-    uint64_t matches_val = strtoull(matches_str, NULL, 10);
+    ssize_t matchesStr_size = psl_field_offsets[0];
+    if (matchesStr_size >= c2b_globals.psl->element->matchesStr_capacity) {
+        char *matchesStr_resized = NULL;
+        matchesStr_resized = realloc(c2b_globals.psl->element->matchesStr, matchesStr_size + 1);
+        if (matchesStr_resized) {
+            c2b_globals.psl->element->matchesStr = matchesStr_resized;
+            c2b_globals.psl->element->matchesStr_capacity = matchesStr_size + 1;
+        }
+        else {
+            fprintf(stderr, "Error: Could not resize matchesStr in PSL element struct\n");
+            exit(ENOMEM);
+        }
+    }
+    memcpy(c2b_globals.psl->element->matchesStr, src, matchesStr_size);
+    c2b_globals.psl->element->matchesStr[matchesStr_size] = '\0';
+    c2b_globals.psl->element->matches = strtoull(c2b_globals.psl->element->matchesStr, NULL, 10);
 
 #ifdef DEBUG
-    fprintf(stderr, "matches_str: [%s]\n", matches_str);
+    fprintf(stderr, "matchesStr: [%s]\n", c2b_globals.psl->element->matchesStr);
 #endif
 
     /* 
@@ -1868,278 +2157,488 @@ c2b_line_convert_psl_to_bed_unsorted(char *dest, ssize_t *dest_size, char *src,
        lines can mimic a genomic element
     */
 
-    if ((matches_val == 0) && (!isdigit(matches_str[0]))) {
+    if ((c2b_globals.psl->element->matches == 0) && (!isdigit(c2b_globals.psl->element->matchesStr[0]))) {
         if ((c2b_globals.psl->is_headered) && (c2b_globals.keep_header_flag) && (c2b_globals.header_line_idx <= 5)) {
+            /* set up temporary header stream buffers */
+            if (!c2b_globals.src_line_str) {
+                c2b_globals.src_line_str = malloc(C2B_MAX_LINE_LENGTH_VALUE + 1);
+                if (!c2b_globals.src_line_str) {
+                    fprintf(stderr, "Error: Could not allocate space for globals source line buffer\n");
+                    exit(ENOMEM);
+                }
+            }
+            if (!c2b_globals.dest_line_str) {
+                c2b_globals.dest_line_str = malloc(C2B_MAX_LINE_LENGTH_VALUE + 1);
+                if (!c2b_globals.dest_line_str) {
+                    fprintf(stderr, "Error: Could not allocate space for globals destination line buffer\n");
+                    exit(ENOMEM);
+                }
+            }
             /* copy header line to destination stream buffer */
-            char src_header_line_str[C2B_MAX_LINE_LENGTH_VALUE];
-            char dest_header_line_str[C2B_MAX_LINE_LENGTH_VALUE];
-            memcpy(src_header_line_str, src, src_size);
-            src_header_line_str[src_size] = '\0';
-            sprintf(dest_header_line_str, "%s\t%u\t%u\t%s\n", c2b_header_chr_name, c2b_globals.header_line_idx, (c2b_globals.header_line_idx + 1), src_header_line_str);
-            memcpy(dest + *dest_size, dest_header_line_str, strlen(dest_header_line_str));
-            *dest_size += strlen(dest_header_line_str);
+            memcpy(c2b_globals.src_line_str, src, src_size);
+            c2b_globals.src_line_str[src_size] = '\0';
+            sprintf(c2b_globals.dest_line_str, "%s\t%u\t%u\t%s\n", c2b_header_chr_name, c2b_globals.header_line_idx, (c2b_globals.header_line_idx + 1), c2b_globals.src_line_str);
+            memcpy(*dest + *dest_size, c2b_globals.dest_line_str, strlen(c2b_globals.dest_line_str));
+            *dest_size += strlen(c2b_globals.dest_line_str);
             c2b_globals.header_line_idx++;
         }
         return;
     }
 
     /* 1 - misMatches */
-    char misMatches_str[C2B_MAX_FIELD_LENGTH_VALUE];
-    ssize_t misMatches_size = psl_field_offsets[1] - psl_field_offsets[0] - 1;
-    memcpy(misMatches_str, src + psl_field_offsets[0] + 1, misMatches_size);
-    misMatches_str[misMatches_size] = '\0';
-    uint64_t misMatches_val = strtoull(misMatches_str, NULL, 10);
+    ssize_t misMatchesStr_size = psl_field_offsets[1] - psl_field_offsets[0] - 1;
+    if (misMatchesStr_size >= c2b_globals.psl->element->misMatchesStr_capacity) {
+        char *misMatchesStr_resized = NULL;
+        misMatchesStr_resized = realloc(c2b_globals.psl->element->misMatchesStr, misMatchesStr_size + 1);
+        if (misMatchesStr_resized) {
+            c2b_globals.psl->element->misMatchesStr = misMatchesStr_resized;
+            c2b_globals.psl->element->misMatchesStr_capacity = misMatchesStr_size + 1;
+        }
+        else {
+            fprintf(stderr, "Error: Could not resize misMatchesStr in PSL element struct\n");
+            exit(ENOMEM);
+        }
+    }
+    memcpy(c2b_globals.psl->element->misMatchesStr, src + psl_field_offsets[0] + 1, misMatchesStr_size);
+    c2b_globals.psl->element->misMatchesStr[misMatchesStr_size] = '\0';
+    c2b_globals.psl->element->misMatches = strtoull(c2b_globals.psl->element->misMatchesStr, NULL, 10);
     
 #ifdef DEBUG
-    fprintf(stderr, "misMatches_str: [%s]\n", misMatches_str);
+    fprintf(stderr, "misMatchesStr: [%s]\n", c2b_globals.psl->element->misMatchesStr);
 #endif
 
     /* 2 - repMatches */
-    char repMatches_str[C2B_MAX_FIELD_LENGTH_VALUE];
-    ssize_t repMatches_size = psl_field_offsets[2] - psl_field_offsets[1] - 1;
-    memcpy(repMatches_str, src + psl_field_offsets[1] + 1, repMatches_size);
-    repMatches_str[repMatches_size] = '\0';
-    uint64_t repMatches_val = strtoull(repMatches_str, NULL, 10);
+    ssize_t repMatchesStr_size = psl_field_offsets[2] - psl_field_offsets[1] - 1;
+    if (repMatchesStr_size >= c2b_globals.psl->element->repMatchesStr_capacity) {
+        char *repMatchesStr_resized = NULL;
+        repMatchesStr_resized = realloc(c2b_globals.psl->element->repMatchesStr, repMatchesStr_size + 1);
+        if (repMatchesStr_resized) {
+            c2b_globals.psl->element->repMatchesStr = repMatchesStr_resized;
+            c2b_globals.psl->element->repMatchesStr_capacity = repMatchesStr_size + 1;
+        }
+        else {
+            fprintf(stderr, "Error: Could not resize repMatchesStr in PSL element struct\n");
+            exit(ENOMEM);
+        }
+    }
+    memcpy(c2b_globals.psl->element->repMatchesStr, src + psl_field_offsets[1] + 1, repMatchesStr_size);
+    c2b_globals.psl->element->repMatchesStr[repMatchesStr_size] = '\0';
+    c2b_globals.psl->element->repMatches = strtoull(c2b_globals.psl->element->repMatchesStr, NULL, 10);
 
 #ifdef DEBUG
-    fprintf(stderr, "repMatches_str: [%s]\n", repMatches_str);
+    fprintf(stderr, "repMatchesStr: [%s]\n", c2b_globals.psl->element->repMatchesStr);
 #endif
 
     /* 3 - nCount */
-    char nCount_str[C2B_MAX_FIELD_LENGTH_VALUE];
-    ssize_t nCount_size = psl_field_offsets[3] - psl_field_offsets[2] - 1;
-    memcpy(nCount_str, src + psl_field_offsets[2] + 1, nCount_size);
-    nCount_str[nCount_size] = '\0';
-    uint64_t nCount_val = strtoull(nCount_str, NULL, 10);
+    ssize_t nCountStr_size = psl_field_offsets[3] - psl_field_offsets[2] - 1;
+    if (nCountStr_size >= c2b_globals.psl->element->nCountStr_capacity) {
+        char *nCountStr_resized = NULL;
+        nCountStr_resized = realloc(c2b_globals.psl->element->nCountStr, nCountStr_size + 1);
+        if (nCountStr_resized) {
+            c2b_globals.psl->element->nCountStr = nCountStr_resized;
+            c2b_globals.psl->element->nCountStr_capacity = nCountStr_size + 1;
+        }
+        else {
+            fprintf(stderr, "Error: Could not resize nCountStr in PSL element struct\n");
+            exit(ENOMEM);
+        }
+    }
+    memcpy(c2b_globals.psl->element->nCountStr, src + psl_field_offsets[2] + 1, nCountStr_size);
+    c2b_globals.psl->element->nCountStr[nCountStr_size] = '\0';
+    c2b_globals.psl->element->nCount = strtoull(c2b_globals.psl->element->nCountStr, NULL, 10);
 
 #ifdef DEBUG
-    fprintf(stderr, "nCount_str: [%s]\n", nCount_str);
+    fprintf(stderr, "nCountStr: [%s]\n", c2b_globals.psl->element->nCountStr);
 #endif
 
     /* 4 - qNumInsert */
-    char qNumInsert_str[C2B_MAX_FIELD_LENGTH_VALUE];
-    ssize_t qNumInsert_size = psl_field_offsets[4] - psl_field_offsets[3] - 1;
-    memcpy(qNumInsert_str, src + psl_field_offsets[3] + 1, qNumInsert_size);
-    qNumInsert_str[qNumInsert_size] = '\0';
-    uint64_t qNumInsert_val = strtoull(qNumInsert_str, NULL, 10);
+    ssize_t qNumInsertStr_size = psl_field_offsets[4] - psl_field_offsets[3] - 1;
+    if (qNumInsertStr_size >= c2b_globals.psl->element->qNumInsertStr_capacity) {
+        char *qNumInsertStr_resized = NULL;
+        qNumInsertStr_resized = realloc(c2b_globals.psl->element->qNumInsertStr, qNumInsertStr_size + 1);
+        if (qNumInsertStr_resized) {
+            c2b_globals.psl->element->qNumInsertStr = qNumInsertStr_resized;
+            c2b_globals.psl->element->qNumInsertStr_capacity = qNumInsertStr_size + 1;
+        }
+        else {
+            fprintf(stderr, "Error: Could not resize qNumInsertStr in PSL element struct\n");
+            exit(ENOMEM);
+        }
+    }
+    memcpy(c2b_globals.psl->element->qNumInsertStr, src + psl_field_offsets[3] + 1, qNumInsertStr_size);
+    c2b_globals.psl->element->qNumInsertStr[qNumInsertStr_size] = '\0';
+    c2b_globals.psl->element->qNumInsert = strtoull(c2b_globals.psl->element->qNumInsertStr, NULL, 10);
 
 #ifdef DEBUG
-    fprintf(stderr, "qNumInsert_str: [%s]\n", qNumInsert_str);
+    fprintf(stderr, "qNumInsertStr: [%s]\n", c2b_globals.psl->element->qNumInsertStr);
 #endif
 
     /* 5 - qBaseInsert */
-    char qBaseInsert_str[C2B_MAX_FIELD_LENGTH_VALUE];
-    ssize_t qBaseInsert_size = psl_field_offsets[5] - psl_field_offsets[4] - 1;
-    memcpy(qBaseInsert_str, src + psl_field_offsets[4] + 1, qBaseInsert_size);
-    qBaseInsert_str[qBaseInsert_size] = '\0';
-    uint64_t qBaseInsert_val = strtoull(qBaseInsert_str, NULL, 10);
+    ssize_t qBaseInsertStr_size = psl_field_offsets[5] - psl_field_offsets[4] - 1;
+    if (qBaseInsertStr_size >= c2b_globals.psl->element->qBaseInsertStr_capacity) {
+        char *qBaseInsertStr_resized = NULL;
+        qBaseInsertStr_resized = realloc(c2b_globals.psl->element->qBaseInsertStr, qBaseInsertStr_size + 1);
+        if (qBaseInsertStr_resized) {
+            c2b_globals.psl->element->qBaseInsertStr = qBaseInsertStr_resized;
+            c2b_globals.psl->element->qBaseInsertStr_capacity = qBaseInsertStr_size + 1;
+        }
+        else {
+            fprintf(stderr, "Error: Could not resize qBaseInsertStr in PSL element struct\n");
+            exit(ENOMEM);
+        }
+    }
+    memcpy(c2b_globals.psl->element->qBaseInsertStr, src + psl_field_offsets[4] + 1, qBaseInsertStr_size);
+    c2b_globals.psl->element->qBaseInsertStr[qBaseInsertStr_size] = '\0';
+    c2b_globals.psl->element->qBaseInsert = strtoull(c2b_globals.psl->element->qBaseInsertStr, NULL, 10);
 
 #ifdef DEBUG
-    fprintf(stderr, "qBaseInsert_str: [%s]\n", qBaseInsert_str);
+    fprintf(stderr, "qBaseInsertStr: [%s]\n", c2b_globals.psl->element->qBaseInsertStr);
 #endif
 
     /* 6 - tNumInsert */
-    char tNumInsert_str[C2B_MAX_FIELD_LENGTH_VALUE];
-    ssize_t tNumInsert_size = psl_field_offsets[6] - psl_field_offsets[5] - 1;
-    memcpy(tNumInsert_str, src + psl_field_offsets[5] + 1, tNumInsert_size);
-    tNumInsert_str[tNumInsert_size] = '\0';
-    uint64_t tNumInsert_val = strtoull(tNumInsert_str, NULL, 10);
+    ssize_t tNumInsertStr_size = psl_field_offsets[6] - psl_field_offsets[5] - 1;
+    if (tNumInsertStr_size >= c2b_globals.psl->element->tNumInsertStr_capacity) {
+        char *tNumInsertStr_resized = NULL;
+        tNumInsertStr_resized = realloc(c2b_globals.psl->element->tNumInsertStr, tNumInsertStr_size + 1);
+        if (tNumInsertStr_resized) {
+            c2b_globals.psl->element->tNumInsertStr = tNumInsertStr_resized;
+            c2b_globals.psl->element->tNumInsertStr_capacity = tNumInsertStr_size + 1;
+        }
+        else {
+            fprintf(stderr, "Error: Could not resize tNumInsertStr in PSL element struct\n");
+            exit(ENOMEM);
+        }
+    }
+    memcpy(c2b_globals.psl->element->tNumInsertStr, src + psl_field_offsets[5] + 1, tNumInsertStr_size);
+    c2b_globals.psl->element->tNumInsertStr[tNumInsertStr_size] = '\0';
+    c2b_globals.psl->element->tNumInsert = strtoull(c2b_globals.psl->element->tNumInsertStr, NULL, 10);
 
 #ifdef DEBUG
-    fprintf(stderr, "tNumInsert_str: [%s]\n", tNumInsert_str);
+    fprintf(stderr, "tNumInsertStr: [%s]\n", c2b_globals.psl->element->tNumInsertStr);
 #endif
 
     /* 7 - tBaseInsert */
-    char tBaseInsert_str[C2B_MAX_FIELD_LENGTH_VALUE];
-    ssize_t tBaseInsert_size = psl_field_offsets[7] - psl_field_offsets[6] - 1;
-    memcpy(tBaseInsert_str, src + psl_field_offsets[6] + 1, tBaseInsert_size);
-    tBaseInsert_str[tBaseInsert_size] = '\0';
-    uint64_t tBaseInsert_val = strtoull(tBaseInsert_str, NULL, 10);
+    ssize_t tBaseInsertStr_size = psl_field_offsets[7] - psl_field_offsets[6] - 1;
+    if (tBaseInsertStr_size >= c2b_globals.psl->element->tBaseInsertStr_capacity) {
+        char *tBaseInsertStr_resized = NULL;
+        tBaseInsertStr_resized = realloc(c2b_globals.psl->element->tBaseInsertStr, tBaseInsertStr_size + 1);
+        if (tBaseInsertStr_resized) {
+            c2b_globals.psl->element->tBaseInsertStr = tBaseInsertStr_resized;
+            c2b_globals.psl->element->tBaseInsertStr_capacity = tBaseInsertStr_size + 1;
+        }
+        else {
+            fprintf(stderr, "Error: Could not resize tBaseInsertStr in PSL element struct\n");
+            exit(ENOMEM);
+        }
+    }
+    memcpy(c2b_globals.psl->element->tBaseInsertStr, src + psl_field_offsets[6] + 1, tBaseInsertStr_size);
+    c2b_globals.psl->element->tBaseInsertStr[tBaseInsertStr_size] = '\0';
+    c2b_globals.psl->element->tBaseInsert = strtoull(c2b_globals.psl->element->tBaseInsertStr, NULL, 10);
 
 #ifdef DEBUG
-    fprintf(stderr, "tBaseInsert_str: [%s]\n", tBaseInsert_str);
+    fprintf(stderr, "tBaseInsertStr: [%s]\n", c2b_globals.psl->element->tBaseInsertStr);
 #endif
 
     /* 8 - strand */
-    char strand_str[C2B_MAX_FIELD_LENGTH_VALUE];
     ssize_t strand_size = psl_field_offsets[8] - psl_field_offsets[7] - 1;
-    memcpy(strand_str, src + psl_field_offsets[7] + 1, strand_size);
-    strand_str[strand_size] = '\0';
+    if (strand_size >= c2b_globals.psl->element->strand_capacity) {
+        char *strand_resized = NULL;
+        strand_resized = realloc(c2b_globals.psl->element->strand, strand_size + 1);
+        if (strand_resized) {
+            c2b_globals.psl->element->strand = strand_resized;
+            c2b_globals.psl->element->strand_capacity = strand_size + 1;
+        }
+        else {
+            fprintf(stderr, "Error: Could not resize strand in PSL element struct\n");
+            exit(ENOMEM);
+        }
+    }
+    memcpy(c2b_globals.psl->element->strand, src + psl_field_offsets[7] + 1, strand_size);
+    c2b_globals.psl->element->strand[strand_size] = '\0';
 
 #ifdef DEBUG
-    fprintf(stderr, "strand_str: [%s]\n", strand_str);
+    fprintf(stderr, "strand: [%s]\n", c2b_globals.psl->element->strand);
 #endif
 
     /* 9 - qName */
-    char qName_str[C2B_MAX_FIELD_LENGTH_VALUE];
     ssize_t qName_size = psl_field_offsets[9] - psl_field_offsets[8] - 1;
-    memcpy(qName_str, src + psl_field_offsets[8] + 1, qName_size);
-    qName_str[qName_size] = '\0';
+    if (qName_size >= c2b_globals.psl->element->qName_capacity) {
+        char *qName_resized = NULL;
+        qName_resized = realloc(c2b_globals.psl->element->qName, qName_size + 1);
+        if (qName_resized) {
+            c2b_globals.psl->element->qName = qName_resized;
+            c2b_globals.psl->element->qName_capacity = qName_size + 1;
+        }
+        else {
+            fprintf(stderr, "Error: Could not resize qName in PSL element struct\n");
+            exit(ENOMEM);
+        }
+    }
+    memcpy(c2b_globals.psl->element->qName, src + psl_field_offsets[8] + 1, qName_size);
+    c2b_globals.psl->element->qName[qName_size] = '\0';
 
 #ifdef DEBUG
-    fprintf(stderr, "qName_str: [%s]\n", qName_str);
+    fprintf(stderr, "qName: [%s]\n", c2b_globals.psl->element->qName);
 #endif
 
     /* 10 - qSize */
-    char qSize_str[C2B_MAX_FIELD_LENGTH_VALUE];
-    ssize_t qSize_size = psl_field_offsets[10] - psl_field_offsets[9] - 1;
-    memcpy(qSize_str, src + psl_field_offsets[9] + 1, qSize_size);
-    qSize_str[qSize_size] = '\0';
-    uint64_t qSize_val = strtoull(qSize_str, NULL, 10);
+    ssize_t qSizeStr_size = psl_field_offsets[10] - psl_field_offsets[9] - 1;
+    if (qSizeStr_size >= c2b_globals.psl->element->qSizeStr_capacity) {
+        char *qSizeStr_resized = NULL;
+        qSizeStr_resized = realloc(c2b_globals.psl->element->qSizeStr, qSizeStr_size + 1);
+        if (qSizeStr_resized) {
+            c2b_globals.psl->element->qSizeStr = qSizeStr_resized;
+            c2b_globals.psl->element->qSizeStr_capacity = qSizeStr_size + 1;
+        }
+        else {
+            fprintf(stderr, "Error: Could not resize qSizeStr in PSL element struct\n");
+            exit(ENOMEM);
+        }
+    }
+    memcpy(c2b_globals.psl->element->qSizeStr, src + psl_field_offsets[9] + 1, qSizeStr_size);
+    c2b_globals.psl->element->qSizeStr[qSizeStr_size] = '\0';
+    c2b_globals.psl->element->qSize = strtoull(c2b_globals.psl->element->qSizeStr, NULL, 10);
 
 #ifdef DEBUG
-    fprintf(stderr, "qSize_str: [%s]\n", qSize_str);
+    fprintf(stderr, "qSizeStr: [%s]\n", c2b_globals.psl->element->qSizeStr);
 #endif
 
     /* 11 - qStart */
-    char qStart_str[C2B_MAX_FIELD_LENGTH_VALUE];
-    ssize_t qStart_size = psl_field_offsets[11] - psl_field_offsets[10] - 1;
-    memcpy(qStart_str, src + psl_field_offsets[10] + 1, qStart_size);
-    qStart_str[qStart_size] = '\0';
-    uint64_t qStart_val = strtoull(qStart_str, NULL, 10);
+    ssize_t qStartStr_size = psl_field_offsets[11] - psl_field_offsets[10] - 1;
+    if (qStartStr_size >= c2b_globals.psl->element->qStartStr_capacity) {
+        char *qStartStr_resized = NULL;
+        qStartStr_resized = realloc(c2b_globals.psl->element->qStartStr, qStartStr_size + 1);
+        if (qStartStr_resized) {
+            c2b_globals.psl->element->qStartStr = qStartStr_resized;
+            c2b_globals.psl->element->qStartStr_capacity = qStartStr_size + 1;
+        }
+        else {
+            fprintf(stderr, "Error: Could not resize qStartStr in PSL element struct\n");
+            exit(ENOMEM);
+        }
+    }
+    memcpy(c2b_globals.psl->element->qStartStr, src + psl_field_offsets[10] + 1, qStartStr_size);
+    c2b_globals.psl->element->qStartStr[qStartStr_size] = '\0';
+    c2b_globals.psl->element->qStart = strtoull(c2b_globals.psl->element->qStartStr, NULL, 10);
 
 #ifdef DEBUG
-    fprintf(stderr, "qStart_str: [%s]\n", qStart_str);
+    fprintf(stderr, "qStartStr: [%s]\n", c2b_globals.psl->element->qStartStr);
 #endif
 
     /* 12 - qEnd */
-    char qEnd_str[C2B_MAX_FIELD_LENGTH_VALUE];
-    ssize_t qEnd_size = psl_field_offsets[12] - psl_field_offsets[11] - 1;
-    memcpy(qEnd_str, src + psl_field_offsets[11] + 1, qEnd_size);
-    qEnd_str[qEnd_size] = '\0';
-    uint64_t qEnd_val = strtoull(qEnd_str, NULL, 10);
+    ssize_t qEndStr_size = psl_field_offsets[12] - psl_field_offsets[11] - 1;
+    if (qEndStr_size >= c2b_globals.psl->element->qEndStr_capacity) {
+        char *qEndStr_resized = NULL;
+        qEndStr_resized = realloc(c2b_globals.psl->element->qEndStr, qEndStr_size + 1);
+        if (qEndStr_resized) {
+            c2b_globals.psl->element->qEndStr = qEndStr_resized;
+            c2b_globals.psl->element->qEndStr_capacity = qEndStr_size + 1;
+        }
+        else {
+            fprintf(stderr, "Error: Could not resize qEndStr in PSL element struct\n");
+            exit(ENOMEM);
+        }
+    }
+    memcpy(c2b_globals.psl->element->qEndStr, src + psl_field_offsets[11] + 1, qEndStr_size);
+    c2b_globals.psl->element->qEndStr[qEndStr_size] = '\0';
+    c2b_globals.psl->element->qEnd = strtoull(c2b_globals.psl->element->qEndStr, NULL, 10);
 
 #ifdef DEBUG
-    fprintf(stderr, "qEnd_str: [%s]\n", qEnd_str);
+    fprintf(stderr, "qEndStr: [%s]\n", c2b_globals.psl->element->qEndStr);
 #endif
 
     /* 13 - tName */
-    char tName_str[C2B_MAX_FIELD_LENGTH_VALUE];
     ssize_t tName_size = psl_field_offsets[13] - psl_field_offsets[12] - 1;
-    memcpy(tName_str, src + psl_field_offsets[12] + 1, tName_size);
-    tName_str[tName_size] = '\0';
+    if (tName_size >= c2b_globals.psl->element->tName_capacity) {
+        char *tName_resized = NULL;
+        tName_resized = realloc(c2b_globals.psl->element->tName, tName_size + 1);
+        if (tName_resized) {
+            c2b_globals.psl->element->tName = tName_resized;
+            c2b_globals.psl->element->tName_capacity = tName_size + 1;
+        }
+        else {
+            fprintf(stderr, "Error: Could not resize tName in PSL element struct\n");
+            exit(ENOMEM);
+        }
+    }
+    memcpy(c2b_globals.psl->element->tName, src + psl_field_offsets[12] + 1, tName_size);
+    c2b_globals.psl->element->tName[tName_size] = '\0';
 
 #ifdef DEBUG
-    fprintf(stderr, "tName_str: [%s]\n", tName_str);
+    fprintf(stderr, "tName: [%s]\n", c2b_globals.psl->element->tName);
 #endif
 
     /* 14 - tSize */
-    char tSize_str[C2B_MAX_FIELD_LENGTH_VALUE];
-    ssize_t tSize_size = psl_field_offsets[14] - psl_field_offsets[13] - 1;
-    memcpy(tSize_str, src + psl_field_offsets[13] + 1, tSize_size);
-    tSize_str[tSize_size] = '\0';
-    uint64_t tSize_val = strtoull(tSize_str, NULL, 10);
+    ssize_t tSizeStr_size = psl_field_offsets[14] - psl_field_offsets[13] - 1;
+    if (tSizeStr_size >= c2b_globals.psl->element->tSizeStr_capacity) {
+        char *tSizeStr_resized = NULL;
+        tSizeStr_resized = realloc(c2b_globals.psl->element->tSizeStr, tSizeStr_size + 1);
+        if (tSizeStr_resized) {
+            c2b_globals.psl->element->tSizeStr = tSizeStr_resized;
+            c2b_globals.psl->element->tSizeStr_capacity = tSizeStr_size + 1;
+        }
+        else {
+            fprintf(stderr, "Error: Could not resize tSizeStr in PSL element struct\n");
+            exit(ENOMEM);
+        }
+    }
+    memcpy(c2b_globals.psl->element->tSizeStr, src + psl_field_offsets[13] + 1, tSizeStr_size);
+    c2b_globals.psl->element->tSizeStr[tSizeStr_size] = '\0';
+    c2b_globals.psl->element->tSize = strtoull(c2b_globals.psl->element->tSizeStr, NULL, 10);
 
 #ifdef DEBUG
-    fprintf(stderr, "tSize_str: [%s]\n", tSize_str);
+    fprintf(stderr, "tSizeStr: [%s]\n", c2b_globals.psl->element->tSizeStr);
 #endif
 
     /* 15 - tStart */
-    char tStart_str[C2B_MAX_FIELD_LENGTH_VALUE];
-    ssize_t tStart_size = psl_field_offsets[15] - psl_field_offsets[14] - 1;
-    memcpy(tStart_str, src + psl_field_offsets[14] + 1, tStart_size);
-    tStart_str[tStart_size] = '\0';
-    uint64_t tStart_val = strtoull(tStart_str, NULL, 10);
+    ssize_t tStartStr_size = psl_field_offsets[15] - psl_field_offsets[14] - 1;
+    if (tStartStr_size >= c2b_globals.psl->element->tStartStr_capacity) {
+        char *tStartStr_resized = NULL;
+        tStartStr_resized = realloc(c2b_globals.psl->element->tStartStr, tStartStr_size + 1);
+        if (tStartStr_resized) {
+            c2b_globals.psl->element->tStartStr = tStartStr_resized;
+            c2b_globals.psl->element->tStartStr_capacity = tStartStr_size + 1;
+        }
+        else {
+            fprintf(stderr, "Error: Could not resize tStartStr in PSL element struct\n");
+            exit(ENOMEM);
+        }
+    }
+    memcpy(c2b_globals.psl->element->tStartStr, src + psl_field_offsets[14] + 1, tStartStr_size);
+    c2b_globals.psl->element->tStartStr[tStartStr_size] = '\0';
+    c2b_globals.psl->element->tStart = strtoull(c2b_globals.psl->element->tStartStr, NULL, 10);
 
 #ifdef DEBUG
-    fprintf(stderr, "tStart_str: [%s]\n", tStart_str);
+    fprintf(stderr, "tStartStr: [%s]\n", c2b_globals.psl->element->tStartStr);
 #endif
 
     /* 16 - tEnd */
-    char tEnd_str[C2B_MAX_FIELD_LENGTH_VALUE];
-    ssize_t tEnd_size = psl_field_offsets[16] - psl_field_offsets[15] - 1;
-    memcpy(tEnd_str, src + psl_field_offsets[15] + 1, tEnd_size);
-    tEnd_str[tEnd_size] = '\0';
-    uint64_t tEnd_val = strtoull(tEnd_str, NULL, 10);
+    ssize_t tEndStr_size = psl_field_offsets[16] - psl_field_offsets[15] - 1;
+    if (tEndStr_size >= c2b_globals.psl->element->tEndStr_capacity) {
+        char *tEndStr_resized = NULL;
+        tEndStr_resized = realloc(c2b_globals.psl->element->tEndStr, tEndStr_size + 1);
+        if (tEndStr_resized) {
+            c2b_globals.psl->element->tEndStr = tEndStr_resized;
+            c2b_globals.psl->element->tEndStr_capacity = tEndStr_size + 1;
+        }
+        else {
+            fprintf(stderr, "Error: Could not resize tEndStr in PSL element struct\n");
+            exit(ENOMEM);
+        }
+    }
+    memcpy(c2b_globals.psl->element->tEndStr, src + psl_field_offsets[15] + 1, tEndStr_size);
+    c2b_globals.psl->element->tEndStr[tEndStr_size] = '\0';
+    c2b_globals.psl->element->tEnd = strtoull(c2b_globals.psl->element->tEndStr, NULL, 10);
 
 #ifdef DEBUG
-    fprintf(stderr, "tEnd_str: [%s]\n", tEnd_str);
+    fprintf(stderr, "tEndStr: [%s]\n", c2b_globals.psl->element->tEndStr);
 #endif
 
     /* 17 - blockCount */
-    char blockCount_str[C2B_MAX_FIELD_LENGTH_VALUE];
-    ssize_t blockCount_size = psl_field_offsets[17] - psl_field_offsets[16] - 1;
-    memcpy(blockCount_str, src + psl_field_offsets[16] + 1, blockCount_size);
-    blockCount_str[blockCount_size] = '\0';
-    uint64_t blockCount_val = strtoull(blockCount_str, NULL, 10);
+    ssize_t blockCountStr_size = psl_field_offsets[17] - psl_field_offsets[16] - 1;
+    if (blockCountStr_size >= c2b_globals.psl->element->blockCountStr_capacity) {
+        char *blockCountStr_resized = NULL;
+        blockCountStr_resized = realloc(c2b_globals.psl->element->blockCountStr, blockCountStr_size + 1);
+        if (blockCountStr_resized) {
+            c2b_globals.psl->element->blockCountStr = blockCountStr_resized;
+            c2b_globals.psl->element->blockCountStr_capacity = blockCountStr_size + 1;
+        }
+        else {
+            fprintf(stderr, "Error: Could not resize blockCountStr in PSL element struct\n");
+            exit(ENOMEM);
+        }
+    }
+    memcpy(c2b_globals.psl->element->blockCountStr, src + psl_field_offsets[16] + 1, blockCountStr_size);
+    c2b_globals.psl->element->blockCountStr[blockCountStr_size] = '\0';
+    c2b_globals.psl->element->blockCount = strtoull(c2b_globals.psl->element->blockCountStr, NULL, 10);
 
 #ifdef DEBUG
-    fprintf(stderr, "blockCount_str: [%s]\n", blockCount_str);
+    fprintf(stderr, "blockCountStr: [%s]\n", c2b_globals.psl->element->blockCountStr);
 #endif
 
     /* 18 - blockSizes */
-    char blockSizes_str[C2B_MAX_FIELD_LENGTH_VALUE];
     ssize_t blockSizes_size = psl_field_offsets[18] - psl_field_offsets[17] - 1;
-    memcpy(blockSizes_str, src + psl_field_offsets[17] + 1, blockSizes_size);
-    blockSizes_str[blockSizes_size] = '\0';
+    if (blockSizes_size >= c2b_globals.psl->element->blockSizes_capacity) {
+        char *blockSizes_resized = NULL;
+        blockSizes_resized = realloc(c2b_globals.psl->element->blockSizes, blockSizes_size + 1);
+        if (blockSizes_resized) {
+            c2b_globals.psl->element->blockSizes = blockSizes_resized;
+            c2b_globals.psl->element->blockSizes_capacity = blockSizes_size + 1;
+        }
+        else {
+            fprintf(stderr, "Error: Could not resize blockSizes in PSL element struct\n");
+            exit(ENOMEM);
+        }
+    }
+    memcpy(c2b_globals.psl->element->blockSizes, src + psl_field_offsets[17] + 1, blockSizes_size);
+    c2b_globals.psl->element->blockSizes[blockSizes_size] = '\0';
 
 #ifdef DEBUG
-    fprintf(stderr, "blockSizes_str: [%s]\n", blockSizes_str);
+    fprintf(stderr, "blockSizes: [%s]\n", c2b_globals.psl->element->blockSizes);
 #endif
 
     /* 19 - qStarts */
-    char qStarts_str[C2B_MAX_FIELD_LENGTH_VALUE];
     ssize_t qStarts_size = psl_field_offsets[19] - psl_field_offsets[18] - 1;
-    memcpy(qStarts_str, src + psl_field_offsets[18] + 1, qStarts_size);
-    qStarts_str[qStarts_size] = '\0';
+    if (qStarts_size >= c2b_globals.psl->element->qStarts_capacity) {
+        char *qStarts_resized = NULL;
+        qStarts_resized = realloc(c2b_globals.psl->element->qStarts, qStarts_size + 1);
+        if (qStarts_resized) {
+            c2b_globals.psl->element->qStarts = qStarts_resized;
+            c2b_globals.psl->element->qStarts_capacity = qStarts_size + 1;
+        }
+        else {
+            fprintf(stderr, "Error: Could not resize qStarts in PSL element struct\n");
+            exit(ENOMEM);
+        }
+    }
+    memcpy(c2b_globals.psl->element->qStarts, src + psl_field_offsets[18] + 1, qStarts_size);
+    c2b_globals.psl->element->qStarts[qStarts_size] = '\0';
 
 #ifdef DEBUG
-    fprintf(stderr, "qStarts_str: [%s]\n", qStarts_str);
+    fprintf(stderr, "qStarts: [%s]\n", c2b_globals.psl->element->qStarts);
 #endif
 
     /* 20 - tStarts */
-    char tStarts_str[C2B_MAX_FIELD_LENGTH_VALUE];
     ssize_t tStarts_size = psl_field_offsets[20] - psl_field_offsets[19] - 1;
-    memcpy(tStarts_str, src + psl_field_offsets[19] + 1, tStarts_size);
-    tStarts_str[tStarts_size] = '\0';
-
-#ifdef DEBUG
-    fprintf(stderr, "tStarts_str: [%s]\n", tStarts_str);
-#endif
-
-    c2b_psl_t psl;
-    psl.matches = matches_val;
-    psl.misMatches = misMatches_val;
-    psl.repMatches = repMatches_val;
-    psl.nCount = nCount_val;
-    psl.qNumInsert = qNumInsert_val;
-    psl.qBaseInsert = qBaseInsert_val;
-    psl.tNumInsert = tNumInsert_val;
-    psl.tBaseInsert = tBaseInsert_val;
-    psl.strand = strand_str;
-    psl.qName = qName_str;
-    psl.qSize = qSize_val;
-    psl.qStart = qStart_val;
-    psl.qEnd = qEnd_val;
-    psl.tName = tName_str;
-    psl.tSize = tSize_val;
-    psl.tStart = tStart_val;
-    psl.tEnd = tEnd_val;
-    psl.blockCount = blockCount_val;
-    psl.blockSizes = blockSizes_str;
-    psl.qStarts = qStarts_str;
-    psl.tStarts = tStarts_str;
+    if (tStarts_size >= c2b_globals.psl->element->tStarts_capacity) {
+        char *tStarts_resized = NULL;
+        tStarts_resized = realloc(c2b_globals.psl->element->tStarts, tStarts_size + 1);
+        if (tStarts_resized) {
+            c2b_globals.psl->element->tStarts = tStarts_resized;
+            c2b_globals.psl->element->tStarts_capacity = tStarts_size + 1;
+        }
+        else {
+            fprintf(stderr, "Error: Could not resize tStarts in PSL element struct\n");
+            exit(ENOMEM);
+        }
+    }
+    memcpy(c2b_globals.psl->element->tStarts, src + psl_field_offsets[19] + 1, tStarts_size);
+    c2b_globals.psl->element->tStarts[tStarts_size] = '\0';
+
+#ifdef DEBUG
+    fprintf(stderr, "tStarts: [%s]\n", c2b_globals.psl->element->tStarts);
+#endif
 
     /* 
        Convert PSL struct to BED string and copy it to destination
     */
 
-    if ((c2b_globals.split_flag) && (blockCount_val > 1)) {
-        if (c2b_globals.psl->block->max_count < blockCount_val) {
+    if ((c2b_globals.split_flag) && (c2b_globals.psl->element->blockCount > 1)) {
+        if (c2b_globals.psl->block->max_count < c2b_globals.psl->element->blockCount) {
             fprintf(stderr, "Error: Insufficent PSL block state global size\n");
             exit(ENOMEM); /* Not enough space (POSIX.1) */
         }
-        /* parse tStarts_str and blockSizes_str to write per-block elements */
-        c2b_psl_blockSizes_to_ptr(blockSizes_str, blockCount_val);
-        c2b_psl_tStarts_to_ptr(tStarts_str, blockCount_val);
-        for (uint64_t bc_idx = 0; bc_idx < blockCount_val; bc_idx++) {
-            psl.tStart = c2b_globals.psl->block->starts[bc_idx];
-            psl.tEnd = c2b_globals.psl->block->starts[bc_idx] + c2b_globals.psl->block->sizes[bc_idx];
-            c2b_line_convert_psl_to_bed(psl, dest, dest_size);
+        /* parse tStarts and blockSizes strings to write per-block elements */
+        c2b_psl_blockSizes_to_ptr(c2b_globals.psl->element->blockSizes, c2b_globals.psl->element->blockCount);
+        c2b_psl_tStarts_to_ptr(c2b_globals.psl->element->tStarts, c2b_globals.psl->element->blockCount);
+        for (uint64_t bc_idx = 0; bc_idx < c2b_globals.psl->element->blockCount; bc_idx++) {
+            c2b_globals.psl->element->tStart = c2b_globals.psl->block->starts[bc_idx];
+            c2b_globals.psl->element->tEnd = c2b_globals.psl->block->starts[bc_idx] + c2b_globals.psl->block->sizes[bc_idx];
+            c2b_line_convert_psl_ptr_to_bed(c2b_globals.psl->element, dest, dest_size, dest_capacity);
         }
     }
     else {
-        c2b_line_convert_psl_to_bed(psl, dest, dest_size);
+        c2b_line_convert_psl_ptr_to_bed(c2b_globals.psl->element, dest, dest_size, dest_capacity);
     }
 }
 
@@ -2220,7 +2719,7 @@ c2b_psl_tStarts_to_ptr(char *s, uint64_t bc)
 }
 
 static inline void
-c2b_line_convert_psl_to_bed(c2b_psl_t p, char *dest_line, ssize_t *dest_size)
+c2b_line_convert_psl_ptr_to_bed(c2b_psl_t* p, char** dest_line_ptr, ssize_t* dest_size, ssize_t* dest_capacity)
 {
     /* 
        For PSL-formatted data, we use the mapping provided by BEDOPS convention described at:
@@ -2257,7 +2756,20 @@ c2b_line_convert_psl_to_bed(c2b_psl_t p, char *dest_line, ssize_t *dest_size)
        tStarts                   21                     -
     */
 
-    *dest_size += sprintf(dest_line + *dest_size,
+    if ((ssize_t)(*dest_size + C2B_MAX_LINE_LENGTH_VALUE) > *dest_capacity) {
+        char *dest_line_resized = NULL;
+        dest_line_resized = realloc(*dest_line_ptr, *dest_capacity * 2);
+        if (dest_line_resized) {
+            *dest_capacity *= 2;
+            *dest_line_ptr = dest_line_resized;
+        }
+        else {
+            fprintf(stderr, "Error: Could not resize dest_line_ptr string in PSL pointer conversion fn\n");
+            exit(ENOMEM);
+        }
+    }
+
+    *dest_size += sprintf(*dest_line_ptr + *dest_size,
                           "%s\t"                \
                           "%" PRIu64 "\t"       \
                           "%" PRIu64 "\t"       \
@@ -2279,31 +2791,31 @@ c2b_line_convert_psl_to_bed(c2b_psl_t p, char *dest_line, ssize_t *dest_size)
                           "%s\t"                \
                           "%s\t"                \
                           "%s\n",
-                          p.tName,
-                          p.tStart,
-                          p.tEnd,
-                          p.qName,
-                          p.matches,
-                          p.strand,
-                          p.qSize,
-                          p.misMatches,
-                          p.repMatches,
-                          p.nCount,
-                          p.qNumInsert,
-                          p.qBaseInsert,
-                          p.tNumInsert,
-                          p.tBaseInsert,
-                          p.qStart,
-                          p.qEnd,
-                          p.tSize,
-                          p.blockCount,
-                          p.blockSizes,
-                          p.qStarts,
-                          p.tStarts);
+                          p->tName,
+                          p->tStart,
+                          p->tEnd,
+                          p->qName,
+                          p->matches,
+                          p->strand,
+                          p->qSize,
+                          p->misMatches,
+                          p->repMatches,
+                          p->nCount,
+                          p->qNumInsert,
+                          p->qBaseInsert,
+                          p->tNumInsert,
+                          p->tBaseInsert,
+                          p->qStart,
+                          p->qEnd,
+                          p->tSize,
+                          p->blockCount,
+                          p->blockSizes,
+                          p->qStarts,
+                          p->tStarts);
 }
 
 static void
-c2b_rmsk_init_element(c2b_rmsk_t **e)
+c2b_rmsk_init_element(c2b_rmsk_t** e)
 {
     *e = malloc(sizeof(c2b_rmsk_t));
     if (!*e) {
@@ -2426,7 +2938,7 @@ c2b_rmsk_init_element(c2b_rmsk_t **e)
 }
 
 static void
-c2b_rmsk_delete_element(c2b_rmsk_t *e)
+c2b_rmsk_delete_element(c2b_rmsk_t* e)
 {
     if (e->sw_score)                     { free(e->sw_score),                     e->sw_score = NULL;                     }
     if (e->perc_div)                     { free(e->perc_div),                     e->perc_div = NULL;                     }
@@ -2446,7 +2958,7 @@ c2b_rmsk_delete_element(c2b_rmsk_t *e)
 }
 
 static void
-c2b_line_convert_rmsk_to_bed_unsorted(char *dest, ssize_t *dest_size, char *src, ssize_t src_size)
+c2b_line_convert_rmsk_to_bed_unsorted(char** dest, ssize_t* dest_size, ssize_t* dest_capacity, char* src, ssize_t src_size)
 {
     /* 
        RepeatMasker annotation output is space-delimited and can have multiple spaces. We also need to walk
@@ -2517,13 +3029,26 @@ c2b_line_convert_rmsk_to_bed_unsorted(char *dest, ssize_t *dest_size, char *src,
                 c2b_globals.rmsk->is_start_of_gap = kFalse;
                 if (c2b_globals.rmsk->line <= c2b_rmsk_header_line_count) {
                     if (c2b_globals.keep_header_flag) {
-                        char src_header_line_str[C2B_MAX_LINE_LENGTH_VALUE];
-                        char dest_header_line_str[C2B_MAX_LINE_LENGTH_VALUE];
-                        memcpy(src_header_line_str, src, src_size);
-                        src_header_line_str[src_size] = '\0';
-                        sprintf(dest_header_line_str, "%s\t%u\t%u\t%s\n", c2b_header_chr_name, c2b_globals.header_line_idx, (c2b_globals.header_line_idx + 1), src_header_line_str);
-                        memcpy(dest + *dest_size, dest_header_line_str, strlen(dest_header_line_str));
-                        *dest_size += strlen(dest_header_line_str);
+                        /* set up temporary header stream buffers */
+                        if (!c2b_globals.src_line_str) {
+                            c2b_globals.src_line_str = malloc(C2B_MAX_LINE_LENGTH_VALUE + 1);
+                            if (!c2b_globals.src_line_str) {
+                                fprintf(stderr, "Error: Could not allocate space for globals source line buffer\n");
+                                exit(ENOMEM);
+                            }
+                        }
+                        if (!c2b_globals.dest_line_str) {
+                            c2b_globals.dest_line_str = malloc(C2B_MAX_LINE_LENGTH_VALUE + 1);
+                            if (!c2b_globals.dest_line_str) {
+                                fprintf(stderr, "Error: Could not allocate space for globals destination line buffer\n");
+                                exit(ENOMEM);
+                            }
+                        }
+                        memcpy(c2b_globals.src_line_str, src, src_size);
+                        c2b_globals.src_line_str[src_size] = '\0';
+                        sprintf(c2b_globals.dest_line_str, "%s\t%u\t%u\t%s\n", c2b_header_chr_name, c2b_globals.header_line_idx, (c2b_globals.header_line_idx + 1), c2b_globals.src_line_str);
+                        memcpy(*dest + *dest_size, c2b_globals.dest_line_str, strlen(c2b_globals.dest_line_str));
+                        *dest_size += strlen(c2b_globals.dest_line_str);
                         c2b_globals.header_line_idx++;
                     }
                     return;
@@ -2924,14 +3449,14 @@ c2b_line_convert_rmsk_to_bed_unsorted(char *dest, ssize_t *dest_size, char *src,
 #endif
     }
 
-    c2b_line_convert_rmsk_ptr_to_bed(c2b_globals.rmsk->element, dest, dest_size);
+    c2b_line_convert_rmsk_ptr_to_bed(c2b_globals.rmsk->element, dest, dest_size, dest_capacity);
 
     /* after writing a line, reset length of element higher_score_match string */
     c2b_globals.rmsk->element->higher_score_match[0] = '\0';
 }
 
 static inline void
-c2b_line_convert_rmsk_ptr_to_bed(c2b_rmsk_t *r, char *dest_line, ssize_t *dest_size)
+c2b_line_convert_rmsk_ptr_to_bed(c2b_rmsk_t* r, char** dest_line_ptr, ssize_t* dest_size, ssize_t* dest_capacity)
 {
     /* 
        For RepeatMasker annotation-formatted data, we use the mapping provided by BEDOPS
@@ -2964,8 +3489,21 @@ c2b_line_convert_rmsk_ptr_to_bed(c2b_rmsk_t *r, char *dest_line, ssize_t *dest_s
        higher_score_match        16                     -       
     */
 
+    if ((ssize_t)(*dest_size + C2B_MAX_LINE_LENGTH_VALUE) > *dest_capacity) {
+        char *dest_line_resized = NULL;
+        dest_line_resized = realloc(*dest_line_ptr, *dest_capacity * 2);
+        if (dest_line_resized) {
+            *dest_capacity *= 2;
+            *dest_line_ptr = dest_line_resized;
+        }
+        else {
+            fprintf(stderr, "Error: Could not resize dest_line_ptr string in RMSK pointer conversion fn\n");
+            exit(ENOMEM);
+        }
+    }
+
     if (strlen(r->higher_score_match) == 0) {
-        *dest_size += sprintf(dest_line + *dest_size,
+        *dest_size += sprintf(*dest_line_ptr + *dest_size,
                               "%s\t"            \
                               "%" PRIu64 "\t"   \
                               "%" PRIu64 "\t"   \
@@ -2998,7 +3536,7 @@ c2b_line_convert_rmsk_ptr_to_bed(c2b_rmsk_t *r, char *dest_line, ssize_t *dest_s
                               r->unique_id);
     }
     else {
-        *dest_size += sprintf(dest_line + *dest_size,
+        *dest_size += sprintf(*dest_line_ptr + *dest_size,
                               "%s\t"            \
                               "%" PRIu64 "\t"   \
                               "%" PRIu64 "\t"   \
@@ -3035,7 +3573,7 @@ c2b_line_convert_rmsk_ptr_to_bed(c2b_rmsk_t *r, char *dest_line, ssize_t *dest_s
 }
 
 static void
-c2b_line_convert_sam_to_bed_unsorted_without_split_operation(char *dest, ssize_t *dest_size, char *src, ssize_t src_size)
+c2b_line_convert_sam_to_bed_unsorted_without_split_operation(char** dest, ssize_t* dest_size, ssize_t* dest_capacity, char* src, ssize_t src_size)
 {
     /* 
        This functor builds a list of tab delimiters, but first reads in the CIGAR string (6th field) and
@@ -3056,14 +3594,27 @@ c2b_line_convert_sam_to_bed_unsorted_without_split_operation(char *dest, ssize_t
             return;
         }
         else {
+            /* set up temporary header stream buffers */
+            if (!c2b_globals.src_line_str) {
+                c2b_globals.src_line_str = malloc(C2B_MAX_LINE_LENGTH_VALUE + 1);
+                if (!c2b_globals.src_line_str) {
+                    fprintf(stderr, "Error: Could not allocate space for globals source line buffer\n");
+                    exit(ENOMEM);
+                }
+            }
+            if (!c2b_globals.dest_line_str) {
+                c2b_globals.dest_line_str = malloc(C2B_MAX_LINE_LENGTH_VALUE + 1);
+                if (!c2b_globals.dest_line_str) {
+                    fprintf(stderr, "Error: Could not allocate space for globals destination line buffer\n");
+                    exit(ENOMEM);
+                }
+            }
             /* copy header line to destination stream buffer */
-            char src_header_line_str[C2B_MAX_LINE_LENGTH_VALUE] = {0};
-            char dest_header_line_str[C2B_MAX_LINE_LENGTH_VALUE] = {0};
-            memcpy(src_header_line_str, src, src_size);
-            src_header_line_str[src_size] = '\0';
-            sprintf(dest_header_line_str, "%s\t%u\t%u\t%s\n", c2b_header_chr_name, c2b_globals.header_line_idx, (c2b_globals.header_line_idx + 1), src_header_line_str);
-            memcpy(dest + *dest_size, dest_header_line_str, strlen(dest_header_line_str));
-            *dest_size += strlen(dest_header_line_str);
+            memcpy(c2b_globals.src_line_str, src, src_size);
+            c2b_globals.src_line_str[src_size] = '\0';
+            sprintf(c2b_globals.dest_line_str, "%s\t%u\t%u\t%s\n", c2b_header_chr_name, c2b_globals.header_line_idx, (c2b_globals.header_line_idx + 1), c2b_globals.src_line_str);
+            memcpy(*dest + *dest_size, c2b_globals.dest_line_str, strlen(c2b_globals.dest_line_str));
+            *dest_size += strlen(c2b_globals.dest_line_str);
             c2b_globals.header_line_idx++;
             return;
         }
@@ -3373,11 +3924,11 @@ c2b_line_convert_sam_to_bed_unsorted_without_split_operation(char *dest, ssize_t
             }
     }
 
-    c2b_line_convert_sam_ptr_to_bed(c2b_globals.sam->element, dest, dest_size, kFalse);
+    c2b_line_convert_sam_ptr_to_bed(c2b_globals.sam->element, dest, dest_size, dest_capacity, kFalse);
 }
 
 static void
-c2b_line_convert_sam_to_bed_unsorted_with_split_operation(char *dest, ssize_t *dest_size, char *src, ssize_t src_size)
+c2b_line_convert_sam_to_bed_unsorted_with_split_operation(char** dest, ssize_t* dest_size, ssize_t* dest_capacity, char* src, ssize_t src_size)
 {
     /* 
        This functor builds a list of tab delimiters, but first reads in the CIGAR string (6th field) and
@@ -3398,14 +3949,27 @@ c2b_line_convert_sam_to_bed_unsorted_with_split_operation(char *dest, ssize_t *d
             return;
         }
         else {
+            /* set up temporary header stream buffers */
+            if (!c2b_globals.src_line_str) {
+                c2b_globals.src_line_str = malloc(C2B_MAX_LINE_LENGTH_VALUE + 1);
+                if (!c2b_globals.src_line_str) {
+                    fprintf(stderr, "Error: Could not allocate space for globals source line buffer\n");
+                    exit(ENOMEM);
+                }
+            }
+            if (!c2b_globals.dest_line_str) {
+                c2b_globals.dest_line_str = malloc(C2B_MAX_LINE_LENGTH_VALUE + 1);
+                if (!c2b_globals.dest_line_str) {
+                    fprintf(stderr, "Error: Could not allocate space for globals destination line buffer\n");
+                    exit(ENOMEM);
+                }
+            }
             /* copy header line to destination stream buffer */
-            char src_header_line_str[C2B_MAX_LINE_LENGTH_VALUE] = {0};
-            char dest_header_line_str[C2B_MAX_LINE_LENGTH_VALUE] = {0};
-            memcpy(src_header_line_str, src, src_size);
+            memcpy(c2b_globals.src_line_str, src, src_size);
             //src_header_line_str[src_size] = '\0';
-            sprintf(dest_header_line_str, "%s\t%u\t%u\t%s\n", c2b_header_chr_name, c2b_globals.header_line_idx, (c2b_globals.header_line_idx + 1), src_header_line_str);
-            memcpy(dest + *dest_size, dest_header_line_str, strlen(dest_header_line_str));
-            *dest_size += strlen(dest_header_line_str);
+            sprintf(c2b_globals.dest_line_str, "%s\t%u\t%u\t%s\n", c2b_header_chr_name, c2b_globals.header_line_idx, (c2b_globals.header_line_idx + 1), c2b_globals.src_line_str);
+            memcpy(*dest + *dest_size, c2b_globals.dest_line_str, strlen(c2b_globals.dest_line_str));
+            *dest_size += strlen(c2b_globals.dest_line_str);
             c2b_globals.header_line_idx++;
             return;
         }
@@ -3698,44 +4262,94 @@ c2b_line_convert_sam_to_bed_unsorted_with_split_operation(char *dest, ssize_t *d
 
     for (op_idx = 0, block_idx = 1; op_idx < c2b_globals.sam->cigar->length; ++op_idx) {
         char current_op = c2b_globals.sam->cigar->ops[op_idx].operation;
+        char next_op = '\0';
+        if (op_idx != (c2b_globals.sam->cigar->length - 1)) {
+            next_op = c2b_globals.sam->cigar->ops[op_idx + 1].operation;
+        }
         unsigned int bases = c2b_globals.sam->cigar->ops[op_idx].bases;
-        switch (current_op) 
-            {
-            case 'M':
-                c2b_globals.sam->element->stop += bases;
-                if ((previous_op == default_cigar_op_operation) || (previous_op == 'D') || (previous_op == 'N')) {
-                    ssize_t desired_modified_qname_capacity = c2b_globals.sam->element->qname_capacity + C2B_SAM_ELEMENT_FIELD_LENGTH_VALUE_EXTENSION;
-                    if (c2b_globals.sam->element->modified_qname_capacity <= desired_modified_qname_capacity) {
-                        // resize modified qname capacity to fit
-                        char *modified_qname_resized = NULL;
-                        modified_qname_resized = realloc(c2b_globals.sam->element->modified_qname, desired_modified_qname_capacity + 1);
-                        if (modified_qname_resized) {
-                            c2b_globals.sam->element->modified_qname = modified_qname_resized;
-                            c2b_globals.sam->element->modified_qname_capacity = desired_modified_qname_capacity + 1;
+        if (c2b_globals.split_with_deletions_flag) {
+            switch (current_op) 
+                {
+                case 'M':
+                    c2b_globals.sam->element->stop += bases;
+                    if ((previous_op == default_cigar_op_operation) || (previous_op == 'D') || (previous_op == 'N')) {
+                        ssize_t desired_modified_qname_capacity = c2b_globals.sam->element->qname_capacity + C2B_SAM_ELEMENT_FIELD_LENGTH_VALUE_EXTENSION;
+                        if (c2b_globals.sam->element->modified_qname_capacity <= desired_modified_qname_capacity) {
+                            // resize modified qname capacity to fit
+                            char *modified_qname_resized = NULL;
+                            modified_qname_resized = realloc(c2b_globals.sam->element->modified_qname, desired_modified_qname_capacity + 1);
+                            if (modified_qname_resized) {
+                                c2b_globals.sam->element->modified_qname = modified_qname_resized;
+                                c2b_globals.sam->element->modified_qname_capacity = desired_modified_qname_capacity + 1;
+                            }
+                            else {
+                                fprintf(stderr, "Error: Could not resize modified QNAME string in SAM element struct\n");
+                                exit(ENOMEM);
+                            }
                         }
-                        else {
-                            fprintf(stderr, "Error: Could not resize modified QNAME string in SAM element struct\n");
-                            exit(ENOMEM);
+                        // block_idx string can be up to (C2B_SAM_ELEMENT_FIELD_LENGTH_VALUE_EXTENSION-1) characters long
+                        sprintf(c2b_globals.sam->element->modified_qname, "%s/%zu", c2b_globals.sam->element->qname, block_idx++);
+                        c2b_line_convert_sam_ptr_to_bed(c2b_globals.sam->element, dest, dest_size, dest_capacity, kTrue);
+                        c2b_globals.sam->element->start = c2b_globals.sam->element->stop;
+                    }
+                    break;
+                case 'N':
+                case 'D':
+                    c2b_globals.sam->element->stop += bases;
+                    c2b_globals.sam->element->start = c2b_globals.sam->element->stop;
+                case 'H':
+                case 'I':
+                case 'P':
+                case 'S':
+                    break;
+                default:
+                    break;
+                }
+        }
+        else {
+            switch (current_op) 
+                {
+                case 'M':
+                    c2b_globals.sam->element->stop += bases;
+                    if ((previous_op == default_cigar_op_operation) || (previous_op == 'D') || (previous_op == 'N')) {
+                        ssize_t desired_modified_qname_capacity = c2b_globals.sam->element->qname_capacity + C2B_SAM_ELEMENT_FIELD_LENGTH_VALUE_EXTENSION;
+                        if (c2b_globals.sam->element->modified_qname_capacity <= desired_modified_qname_capacity) {
+                            // resize modified qname capacity to fit
+                            char *modified_qname_resized = NULL;
+                            modified_qname_resized = realloc(c2b_globals.sam->element->modified_qname, desired_modified_qname_capacity + 1);
+                            if (modified_qname_resized) {
+                                c2b_globals.sam->element->modified_qname = modified_qname_resized;
+                                c2b_globals.sam->element->modified_qname_capacity = desired_modified_qname_capacity + 1;
+                            }
+                            else {
+                                fprintf(stderr, "Error: Could not resize modified QNAME string in SAM element struct\n");
+                                exit(ENOMEM);
+                            }
+                        }
+                        if ((next_op == 'N') || (next_op == '\0')) {
+                            // block_idx string can be up to (C2B_SAM_ELEMENT_FIELD_LENGTH_VALUE_EXTENSION-1) characters long
+                            sprintf(c2b_globals.sam->element->modified_qname, "%s/%zu", c2b_globals.sam->element->qname, block_idx++);
+                            c2b_line_convert_sam_ptr_to_bed(c2b_globals.sam->element, dest, dest_size, dest_capacity, kTrue);
+                            c2b_globals.sam->element->start = c2b_globals.sam->element->stop;
                         }
                     }
-                    // block_idx string can be up to (C2B_SAM_ELEMENT_FIELD_LENGTH_VALUE_EXTENSION-1) characters long
-                    sprintf(c2b_globals.sam->element->modified_qname, "%s/%zu", c2b_globals.sam->element->qname, block_idx++);
-                    c2b_line_convert_sam_ptr_to_bed(c2b_globals.sam->element, dest, dest_size, kTrue);
+                    break;
+                case 'N':
+                    c2b_globals.sam->element->stop += bases;
                     c2b_globals.sam->element->start = c2b_globals.sam->element->stop;
+                    break;
+                case 'D':
+                    c2b_globals.sam->element->stop += bases;
+                    break;
+                case 'H':
+                case 'I':
+                case 'P':
+                case 'S':
+                    break;
+                default:
+                    break;
                 }
-                break;
-            case 'N':
-            case 'D':
-                c2b_globals.sam->element->stop += bases;
-                c2b_globals.sam->element->start = c2b_globals.sam->element->stop;
-            case 'H':
-            case 'I':
-            case 'P':
-            case 'S':
-                break;
-            default:
-                break;
-            }
+        }
         previous_op = current_op;
     }
 
@@ -3746,19 +4360,19 @@ c2b_line_convert_sam_to_bed_unsorted_with_split_operation(char *dest, ssize_t *d
     */
 
     if (block_idx == 1) {
-        c2b_line_convert_sam_ptr_to_bed(c2b_globals.sam->element, dest, dest_size, kFalse);
+        c2b_line_convert_sam_ptr_to_bed(c2b_globals.sam->element, dest, dest_size, dest_capacity, kFalse);
     }
 }
 
 static inline void
-c2b_sam_cigar_str_to_ops(char *s)
+c2b_sam_cigar_str_to_ops(char* s)
 {
     size_t s_idx;
     size_t s_len = strlen(s);
     size_t bases_idx = 0;
     boolean bases_flag = kTrue;
     boolean operation_flag = kFalse;
-    char curr_bases_field[C2B_MAX_OPERATION_FIELD_LENGTH_VALUE];
+    char curr_bases_field[C2B_MAX_OPERATION_FIELD_LENGTH_VALUE + 1];
     char curr_char = default_cigar_op_operation;
     unsigned int curr_bases = 0;
     ssize_t op_idx = 0;
@@ -3801,7 +4415,7 @@ c2b_sam_cigar_str_to_ops(char *s)
 }
 
 static void
-c2b_sam_init_element(c2b_sam_t **e)
+c2b_sam_init_element(c2b_sam_t** e)
 {
     *e = malloc(sizeof(c2b_sam_t));
     if (!*e) {
@@ -3913,7 +4527,7 @@ c2b_sam_init_element(c2b_sam_t **e)
 }
 
 static void
-c2b_sam_delete_element(c2b_sam_t *e) 
+c2b_sam_delete_element(c2b_sam_t* e) 
 {
     if (e->qname)           { free(e->qname),           e->qname = NULL;           }
     if (e->modified_qname)  { free(e->modified_qname),  e->modified_qname = NULL;  }
@@ -3931,7 +4545,7 @@ c2b_sam_delete_element(c2b_sam_t *e)
 }
 
 static void
-c2b_sam_init_cigar_ops(c2b_cigar_t **c, const ssize_t size)
+c2b_sam_init_cigar_ops(c2b_cigar_t** c, const ssize_t size)
 {
     *c = malloc(sizeof(c2b_cigar_t));
     if (!*c) {
@@ -3954,7 +4568,7 @@ c2b_sam_init_cigar_ops(c2b_cigar_t **c, const ssize_t size)
 }
 
 static void
-c2b_sam_resize_cigar_ops(c2b_cigar_t **new_c, c2b_cigar_t *old_c)
+c2b_sam_resize_cigar_ops(c2b_cigar_t** new_c, c2b_cigar_t* old_c)
 {
     *new_c = malloc(sizeof(c2b_cigar_t));
     if (!*new_c) {
@@ -3994,7 +4608,7 @@ static void c2b_sam_debug_cigar_ops() __attribute__ ((unused));
 #endif
 
 static void
-c2b_sam_debug_cigar_ops(c2b_cigar_t *c)
+c2b_sam_debug_cigar_ops(c2b_cigar_t* c)
 {
     ssize_t idx = 0;
     ssize_t length = c->length;
@@ -4004,7 +4618,7 @@ c2b_sam_debug_cigar_ops(c2b_cigar_t *c)
 }
 
 static void
-c2b_sam_delete_cigar_ops(c2b_cigar_t *c)
+c2b_sam_delete_cigar_ops(c2b_cigar_t* c)
 {
     if (c) {
         if (c->ops) {
@@ -4017,8 +4631,9 @@ c2b_sam_delete_cigar_ops(c2b_cigar_t *c)
 }
 
 static inline void
-c2b_line_convert_sam_ptr_to_bed(c2b_sam_t *s, char *dest_line, ssize_t *dest_size, boolean print_modified_qname)
+c2b_line_convert_sam_ptr_to_bed(c2b_sam_t* s, char** dest_line_ptr, ssize_t* dest_size, ssize_t* dest_capacity, boolean print_modified_qname)
 {
+    
     /*
        For SAM-formatted data, we use the mapping provided by BEDOPS convention described at: 
 
@@ -4035,7 +4650,8 @@ c2b_line_convert_sam_ptr_to_bed(c2b_sam_t *s, char *dest_line, ssize_t *dest_siz
 
        If NOT (4 & FLAG) is true, then the read is mapped.
 
-       The remaining SAM columns are mapped as-is, in same order, to adjacent BED columns:
+       If the --reduced option is not specified, the remaining SAM columns are mapped as-is, 
+       in same order, to adjacent BED columns:
 
        SAM field                 BED column index       BED field
        -------------------------------------------------------------------------
@@ -4052,10 +4668,25 @@ c2b_line_convert_sam_ptr_to_bed(c2b_sam_t *s, char *dest_line, ssize_t *dest_siz
        SAM field                 BED column index       BED field
        -------------------------------------------------------------------------
        Alignment fields          14+                    -
+
+       If the --reduced option is specified, only the first six columns are printed.
     */
 
-    if (s->opt_length > 0) {
-        *dest_size += sprintf(dest_line + *dest_size,
+    if ((ssize_t)(*dest_size + C2B_MAX_LINE_LENGTH_VALUE) > *dest_capacity) {
+        char *dest_line_resized = NULL;
+        dest_line_resized = realloc(*dest_line_ptr, *dest_capacity * 2);
+        if (dest_line_resized) {
+            *dest_capacity *= 2;
+            *dest_line_ptr = dest_line_resized;
+        }
+        else {
+            fprintf(stderr, "Error: Could not resize dest_line_ptr string in SAM pointer conversion fn\n");
+            exit(ENOMEM);
+        }
+    }
+
+    if ((!c2b_globals.reduced_flag) && (s->opt_length > 0)) {
+        *dest_size += sprintf(*dest_line_ptr + *dest_size,
                               "%s\t"            \
                               "%" PRIu64 "\t"   \
                               "%" PRIu64 "\t"   \
@@ -4085,8 +4716,8 @@ c2b_line_convert_sam_ptr_to_bed(c2b_sam_t *s, char *dest_line, ssize_t *dest_siz
                               s->qual,
                               s->opt);
     } 
-    else {
-        *dest_size += sprintf(dest_line + *dest_size,
+    else if ((!c2b_globals.reduced_flag) && (s->opt_length == 0)) {
+        *dest_size += sprintf(*dest_line_ptr + *dest_size,
                               "%s\t"            \
                               "%" PRIu64 "\t"   \
                               "%" PRIu64 "\t"   \
@@ -4114,10 +4745,25 @@ c2b_line_convert_sam_ptr_to_bed(c2b_sam_t *s, char *dest_line, ssize_t *dest_siz
                               s->seq,
                               s->qual);
     }
+    else if (c2b_globals.reduced_flag) {
+        *dest_size += sprintf(*dest_line_ptr + *dest_size,
+                              "%s\t"            \
+                              "%" PRIu64 "\t"   \
+                              "%" PRIu64 "\t"   \
+                              "%s\t"            \
+                              "%s\t"            \
+                              "%s\n",
+                              s->rname,
+                              s->start,
+                              s->stop,
+                              (print_modified_qname ? s->modified_qname : s->qname),
+                              s->mapq,
+                              s->strand);
+    }
 }
 
 static void
-c2b_line_convert_vcf_to_bed_unsorted(char *dest, ssize_t *dest_size, char *src, ssize_t src_size)
+c2b_line_convert_vcf_to_bed_unsorted(char** dest, ssize_t* dest_size, ssize_t* dest_capacity, char* src, ssize_t src_size)
 {
     ssize_t vcf_field_offsets[C2B_MAX_VCF_FIELD_COUNT_VALUE];
     int vcf_field_idx = 0;
@@ -4158,27 +4804,26 @@ c2b_line_convert_vcf_to_bed_unsorted(char *dest, ssize_t *dest_size, char *src,
     c2b_globals.vcf->element->chrom[chrom_size] = '\0';
 
     if ((c2b_globals.vcf->element->chrom[0] == c2b_vcf_header_prefix) && (c2b_globals.keep_header_flag)) {
-        char *src_header_line_str = NULL; 
-        src_header_line_str = malloc(C2B_MAX_LONGER_LINE_LENGTH_VALUE);
-        if (!src_header_line_str) {
-            fprintf(stderr, "Error: Could not allocate space for VCF source header line string\n");
-            exit(ENOMEM); /* Not enough space (POSIX.1) */        
-        }
-
-        char *dest_header_line_str = NULL;
-        dest_header_line_str = malloc(C2B_MAX_LONGER_LINE_LENGTH_VALUE);
-        if (!dest_header_line_str) {
-            fprintf(stderr, "Error: Could not allocate space for VCF destination header line string\n");
-            exit(ENOMEM); /* Not enough space (POSIX.1) */        
-        }
-        memcpy(src_header_line_str, src, src_size);
-        src_header_line_str[src_size] = '\0';
-        sprintf(dest_header_line_str, "%s\t%u\t%u\t%s\n", c2b_header_chr_name, c2b_globals.header_line_idx, (c2b_globals.header_line_idx + 1), src_header_line_str);
-        memcpy(dest + *dest_size, dest_header_line_str, strlen(dest_header_line_str));
-        *dest_size += strlen(dest_header_line_str);
+        if (!c2b_globals.src_line_str) {
+            c2b_globals.src_line_str = malloc(C2B_MAX_LINE_LENGTH_VALUE + 1);
+            if (!c2b_globals.src_line_str) {
+                fprintf(stderr, "Error: Could not allocate space for globals source line buffer\n");
+                exit(ENOMEM);
+            }
+        }
+        if (!c2b_globals.dest_line_str) {
+            c2b_globals.dest_line_str = malloc(C2B_MAX_LINE_LENGTH_VALUE + 1);
+            if (!c2b_globals.dest_line_str) {
+                fprintf(stderr, "Error: Could not allocate space for globals destination line buffer\n");
+                exit(ENOMEM);
+            }
+        }
+        memcpy(c2b_globals.src_line_str, src, src_size);
+        c2b_globals.src_line_str[src_size] = '\0';
+        sprintf(c2b_globals.dest_line_str, "%s\t%u\t%u\t%s\n", c2b_header_chr_name, c2b_globals.header_line_idx, (c2b_globals.header_line_idx + 1), c2b_globals.src_line_str);
+        memcpy(*dest + *dest_size, c2b_globals.dest_line_str, strlen(c2b_globals.dest_line_str));
+        *dest_size += strlen(c2b_globals.dest_line_str);
         c2b_globals.header_line_idx++;
-        free(src_header_line_str);
-        free(dest_header_line_str);
         return;
     }
     else if (c2b_globals.vcf->element->chrom[0] == c2b_vcf_header_prefix) {
@@ -4188,7 +4833,7 @@ c2b_line_convert_vcf_to_bed_unsorted(char *dest, ssize_t *dest_size, char *src,
     /* 1 - POS */
     char pos_str[C2B_MAX_FIELD_LENGTH_VALUE];
     ssize_t pos_size = vcf_field_offsets[1] - vcf_field_offsets[0] - 1;
-    if (pos_size >= C2B_MAX_FIELD_LENGTH_VALUE) {
+    if (pos_size >= (ssize_t)(C2B_MAX_FIELD_LENGTH_VALUE)) {
         fprintf(stderr, "Error: Intermediate POS string too long to store in stack variable\n");
         exit(ENOMEM);
     }
@@ -4359,7 +5004,7 @@ c2b_line_convert_vcf_to_bed_unsorted(char *dest, ssize_t *dest_size, char *src,
                  ((c2b_globals.vcf->only_insertions) && (c2b_vcf_record_is_insertion(c2b_globals.vcf->element->ref, c2b_globals.vcf->element->alt))) ||
                  ((c2b_globals.vcf->only_deletions) && (c2b_vcf_record_is_deletion(c2b_globals.vcf->element->ref, c2b_globals.vcf->element->alt))) ) 
                 {
-                    c2b_line_convert_vcf_ptr_to_bed(c2b_globals.vcf->element, dest, dest_size);
+                    c2b_line_convert_vcf_ptr_to_bed(c2b_globals.vcf->element, dest, dest_size, dest_capacity);
                 }
         }
         free(alt_alleles_copy), alt_alleles_copy = NULL;
@@ -4376,37 +5021,37 @@ c2b_line_convert_vcf_to_bed_unsorted(char *dest, ssize_t *dest_size, char *src,
              ((c2b_globals.vcf->only_insertions) && (c2b_vcf_record_is_insertion(c2b_globals.vcf->element->ref, c2b_globals.vcf->element->alt))) ||
              ((c2b_globals.vcf->only_deletions) && (c2b_vcf_record_is_deletion(c2b_globals.vcf->element->ref, c2b_globals.vcf->element->alt))) ) 
             {
-                c2b_line_convert_vcf_ptr_to_bed(c2b_globals.vcf->element, dest, dest_size);
+                c2b_line_convert_vcf_ptr_to_bed(c2b_globals.vcf->element, dest, dest_size, dest_capacity);
             }
     }
 }
 
 static inline boolean
-c2b_vcf_allele_is_id(char *s)
+c2b_vcf_allele_is_id(char* s)
 {
     return ((s[0] == c2b_vcf_id_prefix) && (s[strlen(s)-1] == c2b_vcf_id_suffix)) ? kTrue : kFalse;
 }
 
 static inline boolean
-c2b_vcf_record_is_snv(char *ref, char *alt) 
+c2b_vcf_record_is_snv(char* ref, char* alt) 
 {
     return ((!c2b_vcf_allele_is_id(alt)) && (((int) strlen(ref) - (int) strlen(alt)) == 0)) ? kTrue : kFalse;
 }
 
 static inline boolean
-c2b_vcf_record_is_insertion(char *ref, char *alt) 
+c2b_vcf_record_is_insertion(char* ref, char* alt) 
 {
     return ((!c2b_vcf_allele_is_id(alt)) && (((int) strlen(ref) - (int) strlen(alt)) < 0)) ? kTrue : kFalse;
 }
 
 static inline boolean
-c2b_vcf_record_is_deletion(char *ref, char *alt) 
+c2b_vcf_record_is_deletion(char* ref, char* alt) 
 {
     return ((!c2b_vcf_allele_is_id(alt)) && (((int) strlen(ref) - (int) strlen(alt)) > 0)) ? kTrue : kFalse;
 }
 
 static void
-c2b_vcf_init_element(c2b_vcf_t **e)
+c2b_vcf_init_element(c2b_vcf_t** e)
 {
     *e = malloc(sizeof(c2b_vcf_t));
     if (!*e) {
@@ -4493,7 +5138,7 @@ c2b_vcf_init_element(c2b_vcf_t **e)
 }
 
 static void
-c2b_vcf_delete_element(c2b_vcf_t *e)
+c2b_vcf_delete_element(c2b_vcf_t* e)
 {
     if (e->chrom)           { free(e->chrom),           e->chrom = NULL;           }
     if (e->id)              { free(e->id),              e->id = NULL;              }
@@ -4508,7 +5153,7 @@ c2b_vcf_delete_element(c2b_vcf_t *e)
 }
 
 static inline void
-c2b_line_convert_vcf_ptr_to_bed(c2b_vcf_t *v, char *dest_line, ssize_t *dest_size) 
+c2b_line_convert_vcf_ptr_to_bed(c2b_vcf_t* v, char** dest_line_ptr, ssize_t* dest_size, ssize_t* dest_capacity) 
 {
     /* 
        For VCF v4.2-formatted data, we use the mapping provided by BEDOPS convention described at:
@@ -4545,8 +5190,21 @@ c2b_line_convert_vcf_ptr_to_bed(c2b_vcf_t *v, char *dest_line, ssize_t *dest_siz
        ...
     */
 
+    if ((ssize_t)(*dest_size + C2B_MAX_LINE_LENGTH_VALUE) > *dest_capacity) {
+        char *dest_line_resized = NULL;
+        dest_line_resized = realloc(*dest_line_ptr, *dest_capacity * 2);
+        if (dest_line_resized) {
+            *dest_capacity *= 2;
+            *dest_line_ptr = dest_line_resized;
+        }
+        else {
+            fprintf(stderr, "Error: Could not resize dest_line_ptr string in VCF pointer conversion fn\n");
+            exit(ENOMEM);
+        }
+    }
+
     if (strlen(v->format) > 0) {
-        *dest_size += sprintf(dest_line + *dest_size,
+        *dest_size += sprintf(*dest_line_ptr + *dest_size,
                               "%s\t"            \
                               "%" PRIu64 "\t"   \
                               "%" PRIu64 "\t"   \
@@ -4571,7 +5229,7 @@ c2b_line_convert_vcf_ptr_to_bed(c2b_vcf_t *v, char *dest_line, ssize_t *dest_siz
                               v->samples);
     }
     else {
-        *dest_size += sprintf(dest_line + *dest_size,
+        *dest_size += sprintf(*dest_line_ptr + *dest_size,
                               "%s\t"            \
                               "%" PRIu64 "\t"   \
                               "%" PRIu64 "\t"   \
@@ -4594,10 +5252,22 @@ c2b_line_convert_vcf_ptr_to_bed(c2b_vcf_t *v, char *dest_line, ssize_t *dest_siz
 }
 
 static void
-c2b_line_convert_wig_to_bed_unsorted(char *dest, ssize_t *dest_size, char *src, ssize_t src_size)
+c2b_line_convert_wig_to_bed_unsorted(char** dest, ssize_t* dest_size, ssize_t* dest_capacity, char* src, ssize_t src_size)
 {
-    char src_line_str[C2B_MAX_LINE_LENGTH_VALUE];
-    char dest_line_str[C2B_MAX_LINE_LENGTH_VALUE];
+    if (!c2b_globals.src_line_str) {
+        c2b_globals.src_line_str = malloc(C2B_MAX_LINE_LENGTH_VALUE + 1);
+        if (!c2b_globals.src_line_str) {
+            fprintf(stderr, "Error: Could not allocate space for globals source line buffer\n");
+            exit(ENOMEM);
+        }
+    }
+    if (!c2b_globals.dest_line_str) {
+        c2b_globals.dest_line_str = malloc(C2B_MAX_LINE_LENGTH_VALUE + 1);
+        if (!c2b_globals.dest_line_str) {
+            fprintf(stderr, "Error: Could not allocate space for globals destination line buffer\n");
+            exit(ENOMEM);
+        }
+    }
 
     /* 
        Initialize and increment parameters
@@ -4623,29 +5293,42 @@ c2b_line_convert_wig_to_bed_unsorted(char *dest, ssize_t *dest_size, char *src,
                     c2b_globals.wig->basename, 
                     ++c2b_globals.wig->section);
         }
-        if (c2b_globals.keep_header_flag) { 
+        if (c2b_globals.keep_header_flag) {
             /* copy header line to destination stream buffer */
-            memcpy(src_line_str, src, src_size);
-            src_line_str[src_size] = '\0';
+            memcpy(c2b_globals.src_line_str, src, src_size);
+            c2b_globals.src_line_str[src_size] = '\0';
             if (!c2b_globals.wig->basename) {
-                sprintf(dest_line_str, 
+                sprintf(c2b_globals.dest_line_str, 
                         "%s\t%u\t%u\t%s\n", 
                         c2b_header_chr_name, 
                         c2b_globals.header_line_idx, 
                         c2b_globals.header_line_idx + 1, 
-                        src_line_str);
+                        c2b_globals.src_line_str);
             }
             else {
-                sprintf(dest_line_str, 
+                sprintf(c2b_globals.dest_line_str, 
                         "%s\t%u\t%u\t%s\t%s\n", 
                         c2b_header_chr_name, 
                         c2b_globals.header_line_idx, 
                         c2b_globals.header_line_idx + 1, 
                         c2b_globals.wig->id,
-                        src_line_str);
+                        c2b_globals.src_line_str);
             }
-            memcpy(dest + *dest_size, dest_line_str, strlen(dest_line_str));
-            *dest_size += strlen(dest_line_str);
+            /* resize destination buffer, if necessary */
+            if ((ssize_t)(*dest_size + C2B_MAX_LINE_LENGTH_VALUE) > *dest_capacity) {
+                char *dest_line_resized = NULL;
+                dest_line_resized = realloc(*dest, *dest_capacity * 2);
+                if (dest_line_resized) {
+                    *dest_capacity *= 2;
+                    *dest = dest_line_resized;
+                }
+                else {
+                    fprintf(stderr, "Error: Could not resize dest string in WIG pointer conversion fn\n");
+                    exit(ENOMEM);
+                }
+            }
+            memcpy(*dest + *dest_size, c2b_globals.dest_line_str, strlen(c2b_globals.dest_line_str));
+            *dest_size += strlen(c2b_globals.dest_line_str);
             c2b_globals.header_line_idx++;
             return;
         }
@@ -4664,27 +5347,40 @@ c2b_line_convert_wig_to_bed_unsorted(char *dest, ssize_t *dest_size, char *src,
         }
         if (c2b_globals.keep_header_flag) { 
             /* copy header line to destination stream buffer */
-            memcpy(src_line_str, src, src_size);
-            src_line_str[src_size] = '\0';
+            memcpy(c2b_globals.src_line_str, src, src_size);
+            c2b_globals.src_line_str[src_size] = '\0';
             if (!c2b_globals.wig->basename) {
-                sprintf(dest_line_str, 
+                sprintf(c2b_globals.dest_line_str, 
                         "%s\t%u\t%u\t%s\n", 
                         c2b_header_chr_name, 
                         c2b_globals.header_line_idx, 
                         c2b_globals.header_line_idx + 1, 
-                        src_line_str);
+                        c2b_globals.src_line_str);
             }
             else {
-                sprintf(dest_line_str, 
+                sprintf(c2b_globals.dest_line_str, 
                         "%s\t%u\t%u\t%s\t%s\n", 
                         c2b_header_chr_name, 
                         c2b_globals.header_line_idx, 
                         c2b_globals.header_line_idx + 1, 
                         c2b_globals.wig->id,
-                        src_line_str);
+                        c2b_globals.src_line_str);
             }
-            memcpy(dest + *dest_size, dest_line_str, strlen(dest_line_str));
-            *dest_size += strlen(dest_line_str);
+            /* resize destination buffer, if necessary */
+            if ((ssize_t)(*dest_size + C2B_MAX_LINE_LENGTH_VALUE) > *dest_capacity) {
+                char *dest_line_resized = NULL;
+                dest_line_resized = realloc(*dest, *dest_capacity * 2);
+                if (dest_line_resized) {
+                    *dest_capacity *= 2;
+                    *dest = dest_line_resized;
+                }
+                else {
+                    fprintf(stderr, "Error: Could not resize dest string in WIG pointer conversion fn\n");
+                    exit(ENOMEM);
+                }
+            }
+            memcpy(*dest + *dest_size, c2b_globals.dest_line_str, strlen(c2b_globals.dest_line_str));
+            *dest_size += strlen(c2b_globals.dest_line_str);
             c2b_globals.header_line_idx++;
             return;
         }
@@ -4693,9 +5389,9 @@ c2b_line_convert_wig_to_bed_unsorted(char *dest, ssize_t *dest_size, char *src,
         }        
     }
     else if (strncmp(src, c2b_wig_variable_step_prefix, strlen(c2b_wig_variable_step_prefix)) == 0) {
-        memcpy(src_line_str, src, src_size);
-        src_line_str[src_size] = '\0';
-        int variable_step_fields = sscanf(src_line_str, 
+        memcpy(c2b_globals.src_line_str, src, src_size);
+        c2b_globals.src_line_str[src_size] = '\0';
+        int variable_step_fields = sscanf(c2b_globals.src_line_str, 
                                           "variableStep chrom=%s span=%" SCNu64 "\n", 
                                           c2b_globals.wig->chr, 
                                           &(c2b_globals.wig->span));
@@ -4716,24 +5412,37 @@ c2b_line_convert_wig_to_bed_unsorted(char *dest, ssize_t *dest_size, char *src,
         if (c2b_globals.keep_header_flag) { 
             /* copy header line to destination stream buffer */
             if (!c2b_globals.wig->basename) {
-                sprintf(dest_line_str, 
+                sprintf(c2b_globals.dest_line_str, 
                         "%s\t%u\t%u\t%s\n", 
                         c2b_header_chr_name, 
                         c2b_globals.header_line_idx, 
                         c2b_globals.header_line_idx + 1, 
-                        src_line_str);
+                        c2b_globals.src_line_str);
             }
             else {
-                sprintf(dest_line_str, 
+                sprintf(c2b_globals.dest_line_str, 
                         "%s\t%u\t%u\t%s\t%s\n", 
                         c2b_header_chr_name, 
                         c2b_globals.header_line_idx, 
                         c2b_globals.header_line_idx + 1, 
                         c2b_globals.wig->id,
-                        src_line_str);
+                        c2b_globals.src_line_str);
+            }
+            /* resize destination buffer, if necessary */
+            if ((ssize_t)(*dest_size + C2B_MAX_LINE_LENGTH_VALUE) > *dest_capacity) {
+                char *dest_line_resized = NULL;
+                dest_line_resized = realloc(*dest, *dest_capacity * 2);
+                if (dest_line_resized) {
+                    *dest_capacity *= 2;
+                    *dest = dest_line_resized;
+                }
+                else {
+                    fprintf(stderr, "Error: Could not resize dest string in WIG pointer conversion fn\n");
+                    exit(ENOMEM);
+                }
             }
-            memcpy(dest + *dest_size, dest_line_str, strlen(dest_line_str));
-            *dest_size += strlen(dest_line_str);
+            memcpy(*dest + *dest_size, c2b_globals.dest_line_str, strlen(c2b_globals.dest_line_str));
+            *dest_size += strlen(c2b_globals.dest_line_str);
             c2b_globals.header_line_idx++;
             return;
         }
@@ -4742,9 +5451,9 @@ c2b_line_convert_wig_to_bed_unsorted(char *dest, ssize_t *dest_size, char *src,
         }                
     }
     else if (strncmp(src, c2b_wig_fixed_step_prefix, strlen(c2b_wig_fixed_step_prefix)) == 0) {
-        memcpy(src_line_str, src, src_size);
-        src_line_str[src_size] = '\0';
-        int fixed_step_fields = sscanf(src_line_str, 
+        memcpy(c2b_globals.src_line_str, src, src_size);
+        c2b_globals.src_line_str[src_size] = '\0';
+        int fixed_step_fields = sscanf(c2b_globals.src_line_str, 
                                        "fixedStep chrom=%s start=%" SCNu64 " step=%" SCNu64 " span=%" SCNu64 "\n", 
                                        c2b_globals.wig->chr, 
                                        &(c2b_globals.wig->start_pos), 
@@ -4761,24 +5470,37 @@ c2b_line_convert_wig_to_bed_unsorted(char *dest, ssize_t *dest_size, char *src,
         if (c2b_globals.keep_header_flag) { 
             /* copy header line to destination stream buffer */
             if (!c2b_globals.wig->basename) {
-                sprintf(dest_line_str, 
+                sprintf(c2b_globals.dest_line_str, 
                         "%s\t%u\t%u\t%s\n", 
                         c2b_header_chr_name, 
                         c2b_globals.header_line_idx, 
                         c2b_globals.header_line_idx + 1, 
-                        src_line_str);
+                        c2b_globals.src_line_str);
             }
             else {
-                sprintf(dest_line_str, 
+                sprintf(c2b_globals.dest_line_str, 
                         "%s\t%u\t%u\t%s\t%s\n", 
                         c2b_header_chr_name, 
                         c2b_globals.header_line_idx, 
                         c2b_globals.header_line_idx + 1, 
                         c2b_globals.wig->id,
-                        src_line_str);
+                        c2b_globals.src_line_str);
+            }
+            /* resize destination buffer, if necessary */
+            if ((ssize_t)(*dest_size + C2B_MAX_LINE_LENGTH_VALUE) > *dest_capacity) {
+                char *dest_line_resized = NULL;
+                dest_line_resized = realloc(*dest, *dest_capacity * 2);
+                if (dest_line_resized) {
+                    *dest_capacity *= 2;
+                    *dest = dest_line_resized;
+                }
+                else {
+                    fprintf(stderr, "Error: Could not resize dest string in WIG pointer conversion fn\n");
+                    exit(ENOMEM);
+                }
             }
-            memcpy(dest + *dest_size, dest_line_str, strlen(dest_line_str));
-            *dest_size += strlen(dest_line_str);
+            memcpy(*dest + *dest_size, c2b_globals.dest_line_str, strlen(c2b_globals.dest_line_str));
+            *dest_size += strlen(c2b_globals.dest_line_str);
             c2b_globals.header_line_idx++;
             return;
         }
@@ -4787,9 +5509,9 @@ c2b_line_convert_wig_to_bed_unsorted(char *dest, ssize_t *dest_size, char *src,
         }        
     }
     else if (strncmp(src, c2b_wig_chr_prefix, strlen(c2b_wig_chr_prefix)) == 0) {
-        memcpy(src_line_str, src, src_size);
-        src_line_str[src_size] = '\0';
-        int bed_fields = sscanf(src_line_str, 
+        memcpy(c2b_globals.src_line_str, src, src_size);
+        c2b_globals.src_line_str[src_size] = '\0';
+        int bed_fields = sscanf(c2b_globals.src_line_str, 
                                 "%s\t%" SCNu64 "\t%" SCNu64 "\t%lf\n", 
                                 c2b_globals.wig->chr,
                                 &(c2b_globals.wig->start_pos), 
@@ -4806,7 +5528,7 @@ c2b_line_convert_wig_to_bed_unsorted(char *dest, ssize_t *dest_size, char *src,
             exit(EINVAL); /* Invalid argument (POSIX.1) */
         }
         if (!c2b_globals.wig->basename) {
-            sprintf(dest_line_str,
+            sprintf(c2b_globals.dest_line_str,
                     "%s\t"                      \
                     "%" PRIu64 "\t"             \
                     "%" PRIu64 "\t"             \
@@ -4819,7 +5541,7 @@ c2b_line_convert_wig_to_bed_unsorted(char *dest, ssize_t *dest_size, char *src,
                     c2b_globals.wig->score);
         }
         else {
-            sprintf(dest_line_str,
+            sprintf(c2b_globals.dest_line_str,
                     "%s\t"                      \
                     "%" PRIu64 "\t"             \
                     "%" PRIu64 "\t"             \
@@ -4833,16 +5555,29 @@ c2b_line_convert_wig_to_bed_unsorted(char *dest, ssize_t *dest_size, char *src,
                     c2b_globals.wig->score);
         }
         c2b_globals.wig->start_write = kTrue;
-        memcpy(dest + *dest_size, dest_line_str, strlen(dest_line_str));
-        *dest_size += strlen(dest_line_str);
+        /* resize destination buffer, if necessary */
+        if ((ssize_t)(*dest_size + C2B_MAX_LINE_LENGTH_VALUE) > *dest_capacity) {
+            char *dest_line_resized = NULL;
+            dest_line_resized = realloc(*dest, *dest_capacity * 2);
+            if (dest_line_resized) {
+                *dest_capacity *= 2;
+                *dest = dest_line_resized;
+            }
+            else {
+                fprintf(stderr, "Error: Could not resize dest string in WIG pointer conversion fn\n");
+                exit(ENOMEM);
+            }
+        }
+        memcpy(*dest + *dest_size, c2b_globals.dest_line_str, strlen(c2b_globals.dest_line_str));
+        *dest_size += strlen(c2b_globals.dest_line_str);
     }
     else {
-        memcpy(src_line_str, src, src_size);
-        src_line_str[src_size] = '\0';
+        memcpy(c2b_globals.src_line_str, src, src_size);
+        c2b_globals.src_line_str[src_size] = '\0';
 
         if (c2b_globals.wig->is_fixed_step) {
 
-            int fixed_step_column_fields = sscanf(src_line_str, "%lf\n", &(c2b_globals.wig->score));
+            int fixed_step_column_fields = sscanf(c2b_globals.src_line_str, "%lf\n", &(c2b_globals.wig->score));
             if (fixed_step_column_fields != 1) {
                 fprintf(stderr, "Error: Invalid WIG line %u\n", c2b_globals.wig->line);
                 exit(EINVAL); /* Invalid argument (POSIX.1) */
@@ -4854,7 +5589,7 @@ c2b_line_convert_wig_to_bed_unsorted(char *dest, ssize_t *dest_size, char *src,
                 exit(EINVAL); /* Invalid argument (POSIX.1) */
             }
             if (!c2b_globals.wig->basename) {
-                sprintf(dest_line_str,
+                sprintf(c2b_globals.dest_line_str,
                         "%s\t"                  \
                         "%" PRIu64 "\t"         \
                         "%" PRIu64 "\t"         \
@@ -4867,7 +5602,7 @@ c2b_line_convert_wig_to_bed_unsorted(char *dest, ssize_t *dest_size, char *src,
                         c2b_globals.wig->score);
             }
             else {
-                sprintf(dest_line_str,
+                sprintf(c2b_globals.dest_line_str,
                         "%s\t"                  \
                         "%" PRIu64 "\t"         \
                         "%" PRIu64 "\t"         \
@@ -4882,11 +5617,24 @@ c2b_line_convert_wig_to_bed_unsorted(char *dest, ssize_t *dest_size, char *src,
             }            
             c2b_globals.wig->start_pos += c2b_globals.wig->step;
             c2b_globals.wig->start_write = kTrue;
-            memcpy(dest + *dest_size, dest_line_str, strlen(dest_line_str));
-            *dest_size += strlen(dest_line_str);
+            /* resize destination buffer, if necessary */
+            if ((ssize_t)(*dest_size + C2B_MAX_LINE_LENGTH_VALUE) > *dest_capacity) {
+                char *dest_line_resized = NULL;
+                dest_line_resized = realloc(*dest, *dest_capacity * 2);
+                if (dest_line_resized) {
+                    *dest_capacity *= 2;
+                    *dest = dest_line_resized;
+                }
+                else {
+                    fprintf(stderr, "Error: Could not resize dest string in WIG pointer conversion fn\n");
+                    exit(ENOMEM);
+                }
+            }
+            memcpy(*dest + *dest_size, c2b_globals.dest_line_str, strlen(c2b_globals.dest_line_str));
+            *dest_size += strlen(c2b_globals.dest_line_str);
         }
         else {
-            int variable_step_column_fields = sscanf(src_line_str, 
+            int variable_step_column_fields = sscanf(c2b_globals.src_line_str, 
                                                      "%" SCNu64 "\t%lf\n", 
                                                      &(c2b_globals.wig->start_pos), 
                                                      &(c2b_globals.wig->score));
@@ -4901,7 +5649,7 @@ c2b_line_convert_wig_to_bed_unsorted(char *dest, ssize_t *dest_size, char *src,
                 exit(EINVAL); /* Invalid argument (POSIX.1) */
             }
             if (!c2b_globals.wig->basename) {
-                sprintf(dest_line_str,
+                sprintf(c2b_globals.dest_line_str,
                         "%s\t"                  \
                         "%" PRIu64 "\t"         \
                         "%" PRIu64 "\t"         \
@@ -4914,7 +5662,7 @@ c2b_line_convert_wig_to_bed_unsorted(char *dest, ssize_t *dest_size, char *src,
                         c2b_globals.wig->score);
             }
             else {
-                sprintf(dest_line_str,
+                sprintf(c2b_globals.dest_line_str,
                         "%s\t"                  \
                         "%" PRIu64 "\t"         \
                         "%" PRIu64 "\t"         \
@@ -4929,18 +5677,31 @@ c2b_line_convert_wig_to_bed_unsorted(char *dest, ssize_t *dest_size, char *src,
             }            
             c2b_globals.wig->start_pos += c2b_globals.wig->step;
             c2b_globals.wig->start_write = kTrue;
-            memcpy(dest + *dest_size, dest_line_str, strlen(dest_line_str));
-            *dest_size += strlen(dest_line_str);
+            /* resize destination buffer, if necessary */
+            if ((ssize_t)(*dest_size + C2B_MAX_LINE_LENGTH_VALUE) > *dest_capacity) {
+                char *dest_line_resized = NULL;
+                dest_line_resized = realloc(*dest, *dest_capacity * 2);
+                if (dest_line_resized) {
+                    *dest_capacity *= 2;
+                    *dest = dest_line_resized;
+                }
+                else {
+                    fprintf(stderr, "Error: Could not resize dest string in WIG pointer conversion fn\n");
+                    exit(ENOMEM);
+                }
+            }
+            memcpy(*dest + *dest_size, c2b_globals.dest_line_str, strlen(c2b_globals.dest_line_str));
+            *dest_size += strlen(c2b_globals.dest_line_str);
         }
     }
 }
 
 static void *
-c2b_read_bytes_from_stdin(void *arg)
+c2b_read_bytes_from_stdin(void* arg)
 {
-    c2b_pipeline_stage_t *stage = (c2b_pipeline_stage_t *) arg;
-    c2b_pipeset_t *pipes = stage->pipeset;
-    char *buffer = NULL;
+    c2b_pipeline_stage_t* stage = (c2b_pipeline_stage_t *) arg;
+    c2b_pipeset_t* pipes = stage->pipeset;
+    char* buffer = NULL;
     ssize_t buffer_size = stage->buffer_size;
     ssize_t bytes_read;
     int exit_status = 0;
@@ -4980,12 +5741,12 @@ c2b_read_bytes_from_stdin(void *arg)
 }
 
 static void *
-c2b_process_intermediate_bytes_by_lines(void *arg)
+c2b_process_intermediate_bytes_by_lines(void* arg)
 {
-    c2b_pipeline_stage_t *stage = (c2b_pipeline_stage_t *) arg;
-    c2b_pipeset_t *pipes = stage->pipeset;
-    char *src_buffer = NULL;
-    ssize_t src_buffer_size = C2B_MAX_LONGER_LINE_LENGTH_VALUE;
+    c2b_pipeline_stage_t* stage = (c2b_pipeline_stage_t *) arg;
+    c2b_pipeset_t* pipes = stage->pipeset;
+    char* src_buffer = NULL;
+    ssize_t src_buffer_capacity = C2B_THREAD_IO_BUFFER_SIZE;
     ssize_t src_bytes_read = 0;
     ssize_t remainder_length = 0;
     ssize_t remainder_offset = 0;
@@ -4993,24 +5754,24 @@ c2b_process_intermediate_bytes_by_lines(void *arg)
     ssize_t lines_offset = 0;
     ssize_t start_offset = 0;
     ssize_t end_offset = 0;
-    char *dest_buffer = NULL;
-    ssize_t dest_buffer_size = C2B_MAX_LONGER_LINE_LENGTH_VALUE * C2B_MAX_LINES_VALUE;
+    char* dest_buffer = NULL;
+    ssize_t dest_buffer_capacity = C2B_THREAD_IO_BUFFER_SIZE;
     ssize_t dest_bytes_written = 0;
-    void (*line_functor)(char *, ssize_t *, char *, ssize_t) = stage->line_functor;
+    void (*line_functor)(char **, ssize_t *, ssize_t *, char *, ssize_t) = stage->line_functor;
     int exit_status = 0;
 
     /* 
        We read from the src out pipe, then write to the dest in pipe 
     */
     
-    src_buffer = malloc(src_buffer_size);
+    src_buffer = malloc(src_buffer_capacity);
     if (!src_buffer) {
         fprintf(stderr, "Error: Could not allocate space for intermediate source buffer.\n");
         c2b_print_usage(stderr);
         exit(ENOMEM); /* Not enough space (POSIX.1) */
     }
 
-    dest_buffer = malloc(dest_buffer_size);
+    dest_buffer = malloc(dest_buffer_capacity);
     if (!dest_buffer) {
         fprintf(stderr, "Error: Could not allocate space for intermediate destination buffer.\n");
         c2b_print_usage(stderr);
@@ -5020,7 +5781,7 @@ c2b_process_intermediate_bytes_by_lines(void *arg)
 
     while ((src_bytes_read = read(pipes->out[stage->src][PIPE_READ],
                                   src_buffer + remainder_length,
-                                  src_buffer_size - remainder_length)) > 0) {
+                                  src_buffer_capacity - remainder_length)) > 0) {
 
         /* 
            So here's what src_buffer looks like initially; basically, some stuff separated by
@@ -5074,11 +5835,11 @@ c2b_process_intermediate_bytes_by_lines(void *arg)
            src_buffer_size to something smaller.
         */
 
-        c2b_memrchr_offset(&remainder_offset, src_buffer, src_buffer_size, src_bytes_read + remainder_length, line_delim);
+        c2b_memrchr_offset(&remainder_offset, src_buffer, src_buffer_capacity, src_bytes_read + remainder_length, line_delim);
 
         if (remainder_offset == -1) {
-            if (src_bytes_read + remainder_length == src_buffer_size) {
-                fprintf(stderr, "Error: Could not find newline in intermediate buffer; check input\n");
+            if (src_bytes_read + remainder_length == src_buffer_capacity) {
+                fprintf(stderr, "Error: Could not find newline in intermediate buffer; check input [%zu | %zu | %zu]\n", (unsigned long) src_bytes_read, (unsigned long) remainder_length, (unsigned long) src_buffer_capacity);
                 c2b_print_usage(stderr);
                 exit(EINVAL); /* Invalid argument (POSIX.1) */
             }
@@ -5098,7 +5859,7 @@ c2b_process_intermediate_bytes_by_lines(void *arg)
             if (src_buffer[lines_offset] == line_delim) {
                 end_offset = lines_offset;
                 /* for a given line from src, we write dest_bytes_written number of bytes to dest_buffer (plus written offset) */
-                (*line_functor)(dest_buffer, &dest_bytes_written, src_buffer + start_offset, end_offset - start_offset);
+                (*line_functor)(&dest_buffer, &dest_bytes_written, &dest_buffer_capacity, src_buffer + start_offset, end_offset - start_offset);
                 start_offset = end_offset + 1;
             }
             lines_offset++;            
@@ -5112,7 +5873,7 @@ c2b_process_intermediate_bytes_by_lines(void *arg)
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wunused-result"
         write(pipes->in[stage->dest][PIPE_WRITE], dest_buffer, dest_bytes_written);
-        //fprintf(stderr, "dest_bytes_written [%zu]\n", dest_bytes_written);
+        //fprintf(stderr, "dest_bytes_written [%zu] of dest_buffer_size [%zu] (diff [%zu])\n", dest_bytes_written, dest_buffer_capacity, dest_buffer_capacity - dest_bytes_written);
 #pragma GCC diagnostic pop
 
         remainder_length = src_bytes_read + remainder_length - remainder_offset;
@@ -5142,11 +5903,11 @@ c2b_process_intermediate_bytes_by_lines(void *arg)
 }
 
 static void *
-c2b_write_in_bytes_to_in_process(void *arg)
+c2b_write_in_bytes_to_in_process(void* arg)
 {
-    c2b_pipeline_stage_t *stage = (c2b_pipeline_stage_t *) arg;
-    c2b_pipeset_t *pipes = stage->pipeset;
-    char *buffer = NULL;
+    c2b_pipeline_stage_t* stage = (c2b_pipeline_stage_t *) arg;
+    c2b_pipeset_t* pipes = stage->pipeset;
+    char* buffer = NULL;
     ssize_t buffer_size = stage->buffer_size;
     ssize_t bytes_read;
     int exit_status = 0;
@@ -5184,11 +5945,11 @@ c2b_write_in_bytes_to_in_process(void *arg)
 }
 
 static void *
-c2b_write_out_bytes_to_in_process(void *arg)
+c2b_write_out_bytes_to_in_process(void* arg)
 {
-    c2b_pipeline_stage_t *stage = (c2b_pipeline_stage_t *) arg;
-    c2b_pipeset_t *pipes = stage->pipeset;
-    char *buffer = NULL;
+    c2b_pipeline_stage_t* stage = (c2b_pipeline_stage_t *) arg;
+    c2b_pipeset_t* pipes = stage->pipeset;
+    char* buffer = NULL;
     ssize_t buffer_size = stage->buffer_size;
     ssize_t bytes_read;
     int exit_status = 0;
@@ -5226,11 +5987,11 @@ c2b_write_out_bytes_to_in_process(void *arg)
 }
 
 static void *
-c2b_write_in_bytes_to_stdout(void *arg)
+c2b_write_in_bytes_to_stdout(void* arg)
 {
-    c2b_pipeline_stage_t *stage = (c2b_pipeline_stage_t *) arg;
-    c2b_pipeset_t *pipes = stage->pipeset;
-    char *buffer = NULL;
+    c2b_pipeline_stage_t* stage = (c2b_pipeline_stage_t *) arg;
+    c2b_pipeset_t* pipes = stage->pipeset;
+    char* buffer = NULL;
     ssize_t buffer_size = stage->buffer_size;
     ssize_t bytes_read;
     int exit_status = 0;
@@ -5265,11 +6026,11 @@ c2b_write_in_bytes_to_stdout(void *arg)
 }
 
 static void *
-c2b_write_out_bytes_to_stdout(void *arg)
+c2b_write_out_bytes_to_stdout(void* arg)
 {
-    c2b_pipeline_stage_t *stage = (c2b_pipeline_stage_t *) arg;
-    c2b_pipeset_t *pipes = stage->pipeset;
-    char *buffer = NULL;
+    c2b_pipeline_stage_t* stage = (c2b_pipeline_stage_t *) arg;
+    c2b_pipeset_t* pipes = stage->pipeset;
+    char* buffer = NULL;
     ssize_t buffer_size = stage->buffer_size;
     ssize_t bytes_read;
     int exit_status = 0;
@@ -5304,7 +6065,7 @@ c2b_write_out_bytes_to_stdout(void *arg)
 }
 
 static void
-c2b_memrchr_offset(ssize_t *offset, char *buf, ssize_t buf_size, ssize_t len, char delim)
+c2b_memrchr_offset(ssize_t* offset, char* buf, ssize_t buf_size, ssize_t len, char delim)
 {
     ssize_t left = len;
     
@@ -5322,15 +6083,15 @@ c2b_memrchr_offset(ssize_t *offset, char *buf, ssize_t buf_size, ssize_t len, ch
 }
 
 static void
-c2b_init_pipeset(c2b_pipeset_t *p, const size_t num)
+c2b_init_pipeset(c2b_pipeset_t* p, const size_t num)
 {
 #ifdef DEBUG
     fprintf(stderr, "--- c2b_init_pipeset() - enter ---\n");
 #endif
 
-    int **ins = NULL;
-    int **outs = NULL;
-    int **errs = NULL;
+    int** ins = NULL;
+    int** outs = NULL;
+    int** errs = NULL;
     size_t n;
 
     ins = malloc(num * sizeof(int *));
@@ -5396,7 +6157,7 @@ static void c2b_debug_pipeset() __attribute__ ((unused));
 #endif
 
 static void
-c2b_debug_pipeset(c2b_pipeset_t *p, const size_t num)
+c2b_debug_pipeset(c2b_pipeset_t* p, const size_t num)
 {
     size_t n;
     size_t s;
@@ -5415,7 +6176,7 @@ c2b_debug_pipeset(c2b_pipeset_t *p, const size_t num)
 }
 
 static void
-c2b_delete_pipeset(c2b_pipeset_t *p)
+c2b_delete_pipeset(c2b_pipeset_t* p)
 {
     size_t n;
     size_t s;
@@ -5531,8 +6292,8 @@ c2b_test_dependencies()
     fprintf(stderr, "--- c2b_test_dependencies() - enter ---\n");
 #endif
 
-    char *p = NULL;
-    char *path = NULL;
+    char* p = NULL;
+    char* path = NULL;
 
     if ((p = getenv("PATH")) == NULL) {
         fprintf(stderr, "Error: Cannot retrieve environment PATH variable\n");
@@ -5548,7 +6309,7 @@ c2b_test_dependencies()
     memcpy(path, p, strlen(p) + 1);
 
     if ((c2b_globals.input_format_idx == BAM_FORMAT) || (c2b_globals.input_format_idx == SAM_FORMAT)) {
-        char *samtools = NULL;
+        char* samtools = NULL;
         samtools = malloc(strlen(c2b_samtools) + 1);
         if (!samtools) {
             fprintf(stderr, "Error: Cannot allocate space for samtools variable copy\n");
@@ -5557,7 +6318,7 @@ c2b_test_dependencies()
         }
         memcpy(samtools, c2b_samtools, strlen(c2b_samtools) + 1);
 
-        char *path_samtools = NULL;
+        char* path_samtools = NULL;
         path_samtools = malloc(strlen(path) + 1);
         if (!path_samtools) {
             fprintf(stderr, "Error: Cannot allocate space for path (samtools) copy\n");
@@ -5580,7 +6341,7 @@ c2b_test_dependencies()
     }
 
     if (c2b_globals.sort->is_enabled) {
-        char *sort_bed = NULL;
+        char* sort_bed = NULL;
         sort_bed = malloc(strlen(c2b_sort_bed) + 1);
         if (!sort_bed) {
             fprintf(stderr, "Error: Cannot allocate space for sort-bed variable copy\n");
@@ -5589,7 +6350,7 @@ c2b_test_dependencies()
         }
         memcpy(sort_bed, c2b_sort_bed, strlen(c2b_sort_bed) + 1);
 
-        char *path_sort_bed = NULL;
+        char* path_sort_bed = NULL;
         path_sort_bed = malloc(strlen(path) + 1);
         if (!path_sort_bed) {
             fprintf(stderr, "Error: Cannot allocate space for path (samtools) copy\n");
@@ -5612,7 +6373,7 @@ c2b_test_dependencies()
     }
 
     if (c2b_globals.output_format_idx == STARCH_FORMAT) {
-        char *starch = NULL;
+        char* starch = NULL;
         starch = malloc(strlen(c2b_starch) + 1);
         if (!starch) {
             fprintf(stderr, "Error: Cannot allocate space for starch variable copy\n");
@@ -5621,7 +6382,7 @@ c2b_test_dependencies()
         }
         memcpy(starch, c2b_starch, strlen(c2b_starch) + 1);
 
-        char *path_starch = NULL;
+        char* path_starch = NULL;
         path_starch = malloc(strlen(path) + 1);
         if (!path_starch) {
             fprintf(stderr, "Error: Cannot allocate space for path (starch) copy\n");
@@ -5644,7 +6405,7 @@ c2b_test_dependencies()
     }
 
     if (c2b_globals.input_format_idx != BAM_FORMAT) {
-        char *cat = NULL;
+        char* cat = NULL;
         cat = malloc(strlen(c2b_cat) + 1);
         if (!cat) {
             fprintf(stderr, "Error: Cannot allocate space for cat variable copy\n");
@@ -5653,7 +6414,7 @@ c2b_test_dependencies()
         }
         memcpy(cat, c2b_cat, strlen(c2b_cat) + 1);
         
-        char *path_cat = NULL;
+        char* path_cat = NULL;
         path_cat = malloc(strlen(path) + 1);
         if (!path_cat) {
             fprintf(stderr, "Error: Cannot allocate space for path (cat) copy\n");
@@ -5683,14 +6444,14 @@ c2b_test_dependencies()
 }
 
 static boolean
-c2b_print_matches(char *path, char *fn)
+c2b_print_matches(char* path, char* fn)
 {
 #ifdef DEBUG
     fprintf(stderr, "--- c2b_print_matches() - enter ---\n");
 #endif
 
     char candidate[PATH_MAX];
-    const char *d;
+    const char* d;
     boolean found = kFalse;
 
     if (strchr(fn, '/') != NULL) {
@@ -5756,12 +6517,12 @@ c2b_print_matches(char *path, char *fn)
 }
 
 static char *
-c2b_strsep(char **stringp, const char *delim)
+c2b_strsep(char** stringp, const char* delim)
 {
-    char *s;
-    const char *spanp;
+    char* s;
+    const char* spanp;
     int c, sc;
-    char *tok;
+    char* tok;
 
     if ((s = *stringp) == NULL)
         return NULL;
@@ -5785,7 +6546,7 @@ c2b_strsep(char **stringp, const char *delim)
 }
 
 static boolean
-c2b_is_there(char *candidate)
+c2b_is_there(char* candidate)
 {
 #ifdef DEBUG
     fprintf(stderr, "--- c2b_is_there() - enter ---\n");
@@ -5825,7 +6586,9 @@ c2b_init_globals()
     c2b_globals.all_reads_flag = kFalse;
     c2b_globals.keep_header_flag = kFalse;
     c2b_globals.split_flag = kFalse;
+    c2b_globals.split_with_deletions_flag = kFalse;
     c2b_globals.zero_indexed_flag = kFalse;
+    c2b_globals.reduced_flag = kFalse;
     c2b_globals.header_line_idx = 0U;
     c2b_globals.gff = NULL;
     c2b_init_global_gff_state();
@@ -5847,6 +6610,8 @@ c2b_init_globals()
     c2b_init_global_sort_params();
     c2b_globals.starch = NULL;
     c2b_init_global_starch_params();
+    c2b_globals.src_line_str = NULL;
+    c2b_globals.dest_line_str = NULL;
 
 #ifdef DEBUG
     fprintf(stderr, "--- c2b_init_globals() - exit  ---\n");
@@ -5866,6 +6631,8 @@ c2b_delete_globals()
     c2b_globals.all_reads_flag = kFalse;
     c2b_globals.keep_header_flag = kFalse;
     c2b_globals.split_flag = kFalse;
+    c2b_globals.split_with_deletions_flag = kFalse;
+    c2b_globals.reduced_flag = kFalse;
     c2b_globals.header_line_idx = 0U;
     if (c2b_globals.gff) c2b_delete_global_gff_state();
     if (c2b_globals.gtf) c2b_delete_global_gtf_state();
@@ -5877,6 +6644,8 @@ c2b_delete_globals()
     if (c2b_globals.cat) c2b_delete_global_cat_params();
     if (c2b_globals.sort) c2b_delete_global_sort_params();
     if (c2b_globals.starch) c2b_delete_global_starch_params();
+    if (c2b_globals.src_line_str) free(c2b_globals.src_line_str), c2b_globals.src_line_str = NULL;
+    if (c2b_globals.dest_line_str) free(c2b_globals.dest_line_str), c2b_globals.dest_line_str = NULL;
 
 #ifdef DEBUG
     fprintf(stderr, "--- c2b_delete_globals() - exit  ---\n");
@@ -5976,6 +6745,8 @@ c2b_init_global_psl_state()
         exit(ENOMEM); /* Not enough space (POSIX.1) */
     }
 
+    c2b_globals.psl->element = NULL, c2b_psl_init_element(&(c2b_globals.psl->element));
+
     c2b_globals.psl->is_headered = kTrue;
 
     c2b_globals.psl->block = NULL;
@@ -6015,6 +6786,10 @@ c2b_delete_global_psl_state()
     fprintf(stderr, "--- c2b_delete_global_psl_state() - enter ---\n");
 #endif
 
+    if (c2b_globals.psl->element) {
+        c2b_psl_delete_element(c2b_globals.psl->element);
+        c2b_globals.psl->element = NULL;
+    }
     free(c2b_globals.psl->block->starts), c2b_globals.psl->block->starts = NULL;
     free(c2b_globals.psl->block->sizes), c2b_globals.psl->block->sizes = NULL;
     c2b_globals.psl->block->max_count = 0;
@@ -6435,10 +7210,18 @@ c2b_init_command_line_options(int argc, char **argv)
                 break;
             case 's':
                 c2b_globals.split_flag = kTrue;
+                c2b_globals.split_with_deletions_flag = kFalse;
+                break;
+            case 'S':
+                c2b_globals.split_flag = kTrue;
+                c2b_globals.split_with_deletions_flag = kTrue;
                 break;
             case 'p':
                 c2b_globals.vcf->do_not_split = kTrue;
                 break;
+            case 'R':
+                c2b_globals.reduced_flag = kTrue;
+                break;
             case 'v':
                 c2b_globals.vcf->filter_count++;
                 c2b_globals.vcf->only_snvs = kTrue;
@@ -6569,7 +7352,7 @@ c2b_init_command_line_options(int argc, char **argv)
 }
 
 static void
-c2b_print_version(FILE *stream)
+c2b_print_version(FILE* stream)
 {
 #ifdef DEBUG
     fprintf(stderr, "--- c2b_print_version() - enter ---\n");
@@ -6577,10 +7360,11 @@ c2b_print_version(FILE *stream)
 
     fprintf(stream,
             "%s\n"                              \
-            "  version:  %s\n"                  \
+            "  version:  %s (%s)\n"             \
             "  author:   %s\n",
             application_name,
             application_version,
+            application_type,
             application_authors);
 
 #ifdef DEBUG
@@ -6589,22 +7373,23 @@ c2b_print_version(FILE *stream)
 }
 
 static void
-c2b_print_usage(FILE *stream)
+c2b_print_usage(FILE* stream)
 {
 #ifdef DEBUG
     fprintf(stderr, "--- c2b_print_usage() - enter ---\n");
 #endif
 
     fprintf(stream,
-            "%s\n"             \
-            "  version:  %s\n" \
-            "  author:   %s\n" \
-            "%s\n"             \
-            "%s\n"             \
-            "%s\n"             \
+            "%s\n"                  \
+            "  version:  %s (%s)\n" \
+            "  author:   %s\n"      \
+            "%s\n"                  \
+            "%s\n"                  \
+            "%s\n"                  \
             "%s\n",
             application_name,
             application_version,
+            application_type,
             application_authors,
             general_usage,
             general_description,
@@ -6617,7 +7402,7 @@ c2b_print_usage(FILE *stream)
 }
 
 static void
-c2b_print_format_usage(FILE *stream)
+c2b_print_format_usage(FILE* stream)
 {
 #ifdef DEBUG
     fprintf(stderr, "--- c2b_print_format_usage() - enter ---\n");
@@ -6693,7 +7478,7 @@ c2b_print_format_usage(FILE *stream)
     if (format_options) {
         fprintf(stream,
                 "%s\n"                           \
-                "  version:  %s\n"               \
+                "  version:  %s (%s)\n"          \
                 "  author:   %s\n\n"             \
                 "%s\n"                           \
                 "%s\n"                           \
@@ -6701,6 +7486,7 @@ c2b_print_format_usage(FILE *stream)
                 "%s\n",
                 format_name,
                 application_version,
+                application_type,
                 application_authors,
                 format_usage,
                 format_description,
@@ -6710,13 +7496,14 @@ c2b_print_format_usage(FILE *stream)
     else {
         fprintf(stream,
                 "%s\n"                           \
-                "  version:  %s\n"               \
+                "  version:  %s (%s)\n"          \
                 "  author:   %s\n\n"             \
                 "%s\n"                           \
                 "%s\n"                           \
                 "%s\n",
                 format_name,
                 application_version,
+                application_type,
                 application_authors,
                 format_usage,
                 format_description,
@@ -6729,7 +7516,7 @@ c2b_print_format_usage(FILE *stream)
 }
 
 static char *
-c2b_to_lowercase(const char *src)
+c2b_to_lowercase(const char* src)
 {
 #ifdef DEBUG
     fprintf(stderr, "--- c2b_to_lowercase() - enter ---\n");
@@ -6759,7 +7546,7 @@ c2b_to_lowercase(const char *src)
 }
 
 static c2b_format_t
-c2b_to_input_format(const char *input_format)
+c2b_to_input_format(const char* input_format)
 {
 #ifdef DEBUG
     fprintf(stderr, "--- c2b_to_input_format() - enter ---\n");
@@ -6780,7 +7567,7 @@ c2b_to_input_format(const char *input_format)
 }
 
 static c2b_format_t
-c2b_to_output_format(const char *output_format)
+c2b_to_output_format(const char* output_format)
 {
 #ifdef DEBUG
     fprintf(stderr, "--- c2b_to_output_format() - enter ---\n");
@@ -6792,4 +7579,3 @@ c2b_to_output_format(const char *output_format)
         (strcmp(output_format, "starch") == 0) ? STARCH_FORMAT :
         UNDEFINED_FORMAT;
 }
-
diff --git a/applications/bed/conversion/src/convert2bed.h b/applications/bed/conversion/src/convert2bed.h
index bfd2d22..6237af2 100644
--- a/applications/bed/conversion/src/convert2bed.h
+++ b/applications/bed/conversion/src/convert2bed.h
@@ -51,7 +51,9 @@
 #include <sys/param.h>
 #include <sys/wait.h>
 
-#define C2B_VERSION "2.4.26"
+#include "suite/BEDOPS.Constants.hpp"
+
+#define C2B_VERSION "2.4.28"
 
 typedef int boolean;
 extern const boolean kTrue;
@@ -60,11 +62,11 @@ const boolean kTrue = 1;
 const boolean kFalse = 0;
 
 #define C2B_MAX_FIELD_COUNT_VALUE 64
-#define C2B_MAX_FIELD_LENGTH_VALUE 24576
-#define C2B_MAX_OPERATION_FIELD_LENGTH_VALUE 32
+#define C2B_MAX_FIELD_LENGTH_VALUE TOKEN_REST_MAX_LENGTH
+#define C2B_MAX_OPERATION_FIELD_LENGTH_VALUE MAX_DEC_INTEGERS
 #define C2B_MAX_STRAND_LENGTH_VALUE 4
-#define C2B_MAX_LINE_LENGTH_VALUE 131072
-#define C2B_MAX_LONGER_LINE_LENGTH_VALUE 1048576
+#define C2B_MAX_LINE_LENGTH_VALUE 24 * TOKENS_MAX_LENGTH
+#define C2B_MAX_COMMAND_LINE_LENGTH_VALUE 65536
 #define C2B_MAX_LINES_VALUE 32
 #define C2B_MAX_CHROMOSOME_LENGTH 32
 #define C2B_MAX_PSL_BLOCKS 1024
@@ -79,44 +81,45 @@ const boolean kFalse = 0;
 #define C2B_GFF_ELEMENT_FIELD_LENGTH_VALUE_INITIAL 32
 #define C2B_GTF_ELEMENT_FIELD_LENGTH_VALUE_INITIAL 32
 #define C2B_RMSK_ELEMENT_FIELD_LENGTH_VALUE_INITIAL 32
+#define C2B_PSL_ELEMENT_FIELD_LENGTH_VALUE_INITIAL 32
 #define C2B_THREAD_IO_BUFFER_SIZE 5000000
 
-extern const char *c2b_samtools;
-extern const char *c2b_sort_bed;
-extern const char *c2b_starch;
-extern const char *c2b_cat;
-extern const char *c2b_default_output_format;
-extern const char *c2b_unmapped_read_chr_name;
-extern const char *c2b_header_chr_name;
-extern const char *sort_bed_max_mem_arg;
-extern const char *sort_bed_max_mem_default_arg;
-extern const char *sort_bed_tmpdir_arg;
-extern const char *sort_bed_stdin;
-extern const char *starch_bzip2_arg;
-extern const char *starch_gzip_arg;
-extern const char *starch_note_prefix_arg;
-extern const char *starch_note_suffix_arg;
-extern const char *starch_stdin_arg;
+extern const char* c2b_samtools;
+extern const char* c2b_sort_bed;
+extern const char* c2b_starch;
+extern const char* c2b_cat;
+extern const char* c2b_default_output_format;
+extern const char* c2b_unmapped_read_chr_name;
+extern const char* c2b_header_chr_name;
+extern const char* sort_bed_max_mem_arg;
+extern const char* sort_bed_max_mem_default_arg;
+extern const char* sort_bed_tmpdir_arg;
+extern const char* sort_bed_stdin;
+extern const char* starch_bzip2_arg;
+extern const char* starch_gzip_arg;
+extern const char* starch_note_prefix_arg;
+extern const char* starch_note_suffix_arg;
+extern const char* starch_stdin_arg;
 extern const char c2b_tab_delim;
 extern const char c2b_line_delim;
 extern const char c2b_space_delim;
 extern const char c2b_sam_header_prefix;
-extern const char *c2b_gff_header;
-extern const char *c2b_gff_fasta;
+extern const char* c2b_gff_header;
+extern const char* c2b_gff_fasta;
 extern const int c2b_gff_field_min;
 extern const int c2b_gff_field_max;
-extern const char *c2b_gff_zero_length_insertion_attribute;
+extern const char* c2b_gff_zero_length_insertion_attribute;
 extern const int c2b_gtf_field_min;
 extern const int c2b_gtf_field_max;
-extern const char *c2b_gtf_gene_id_prefix;
-extern const char *c2b_gtf_transcript_id_prefix;
+extern const char* c2b_gtf_gene_id_prefix;
+extern const char* c2b_gtf_transcript_id_prefix;
 extern const char c2b_gtf_id_delimiter;
-extern const char *c2b_gtf_field_delimiter;
-extern const char *c2b_gtf_field_placeholder;
+extern const char* c2b_gtf_field_delimiter;
+extern const char* c2b_gtf_field_placeholder;
 extern const char c2b_gtf_comment;
-extern const char *c2b_gtf_zero_length_insertion_attribute;
-extern const char *c2b_gvf_header;
-extern const char *c2b_gvf_generic_header;
+extern const char* c2b_gtf_zero_length_insertion_attribute;
+extern const char* c2b_gvf_header;
+extern const char* c2b_gvf_generic_header;
 extern const int c2b_psl_field_min;
 extern const int c2b_psl_field_max;
 extern const char c2b_psl_blockSizes_delimiter;
@@ -124,56 +127,56 @@ extern const char c2b_psl_tStarts_delimiter;
 extern const uint64_t c2b_rmsk_header_line_count;
 extern const int c2b_rmsk_field_min;
 extern const int c2b_rmsk_field_max;
-extern const char *c2b_rmsk_strand_complement;
-extern const char *c2b_rmsk_strand_complement_replacement;
+extern const char* c2b_rmsk_strand_complement;
+extern const char* c2b_rmsk_strand_complement_replacement;
 extern const int c2b_vcf_field_min;
 extern const char c2b_vcf_header_prefix;
 extern const char c2b_vcf_alt_allele_delim;
 extern const char c2b_vcf_id_prefix;
 extern const char c2b_vcf_id_suffix;
 extern const char c2b_wig_header_prefix;
-extern const char *c2b_wig_track_prefix;
-extern const char *c2b_wig_browser_prefix;
-extern const char *c2b_wig_variable_step_prefix;
-extern const char *c2b_wig_fixed_step_prefix;
-extern const char *c2b_wig_chr_prefix;
-
-const char *c2b_samtools = "samtools";
-const char *c2b_sort_bed = "sort-bed";
-const char *c2b_starch = "starch";
-const char *c2b_cat = "cat";
-const char *c2b_default_output_format = "bed";
-const char *c2b_unmapped_read_chr_name = "_unmapped";
-const char *c2b_header_chr_name = "_header";
-const char *sort_bed_max_mem_arg = " --max-mem ";
-const char *sort_bed_max_mem_default_arg = " --max-mem 2G ";
-const char *sort_bed_tmpdir_arg = " --tmpdir ";
-const char *sort_bed_stdin = " - ";
-const char *starch_bzip2_arg = " --bzip2 ";
-const char *starch_gzip_arg = " --gzip ";
-const char *starch_note_prefix_arg = " --note=\"";
-const char *starch_note_suffix_arg = "\" ";
-const char *starch_stdin_arg = " - ";
+extern const char* c2b_wig_track_prefix;
+extern const char* c2b_wig_browser_prefix;
+extern const char* c2b_wig_variable_step_prefix;
+extern const char* c2b_wig_fixed_step_prefix;
+extern const char* c2b_wig_chr_prefix;
+
+const char* c2b_samtools = "samtools";
+const char* c2b_sort_bed = "sort-bed";
+const char* c2b_starch = "starch";
+const char* c2b_cat = "cat";
+const char* c2b_default_output_format = "bed";
+const char* c2b_unmapped_read_chr_name = "_unmapped";
+const char* c2b_header_chr_name = "_header";
+const char* sort_bed_max_mem_arg = " --max-mem ";
+const char* sort_bed_max_mem_default_arg = " --max-mem 2G ";
+const char* sort_bed_tmpdir_arg = " --tmpdir ";
+const char* sort_bed_stdin = " - ";
+const char* starch_bzip2_arg = " --bzip2 ";
+const char* starch_gzip_arg = " --gzip ";
+const char* starch_note_prefix_arg = " --note=\"";
+const char* starch_note_suffix_arg = "\" ";
+const char* starch_stdin_arg = " - ";
 const char c2b_tab_delim = '\t';
 const char c2b_line_delim = '\n';
 const char c2b_space_delim = 0x20;
 const char c2b_sam_header_prefix = '@';
-const char *c2b_gff_header = "##gff-version 3";
-const char *c2b_gff_fasta = "##FASTA";
+const char* c2b_gff_header = "##gff-version 3";
+const char* c2b_gff_fasta = "##FASTA";
 const int c2b_gff_field_min = 9;
 const int c2b_gff_field_max = 9;
-const char *c2b_gff_zero_length_insertion_attribute = ";zero_length_insertion=True";
+const char* c2b_gff_zero_length_insertion_attribute = ";zero_length_insertion=True";
 const int c2b_gtf_field_min = 9;
 const int c2b_gtf_field_max = 10;
-const char *c2b_gtf_gene_id_prefix = "gene_id ";
-const char *c2b_gtf_transcript_id_prefix = "transcript_id ";
+const char* c2b_gtf_gene_id_prefix = "gene_id ";
+const char* c2b_gtf_transcript_id_prefix = "transcript_id ";
 const char c2b_gtf_id_delimiter = '"';
-const char *c2b_gtf_field_delimiter = ";";
-const char *c2b_gtf_field_placeholder = ".";
+const char* c2b_gtf_field_delimiter = ";";
+const char* c2b_gtf_field_placeholder = ".";
 const char c2b_gtf_comment = '#';
-const char *c2b_gtf_zero_length_insertion_attribute = "; zero_length_insertion=True"; 
-const char *c2b_gvf_header = "##gvf-version 1.07";
-const char *c2b_gvf_generic_header = "##";
+const char* c2b_gtf_zero_length_insertion_attribute = "; zero_length_insertion=True"; 
+const char* c2b_gvf_header = "##gvf-version 1.07";
+const char* c2b_gvf_generic_header = "##";
 const int c2b_psl_field_min = 21;
 const int c2b_psl_field_max = 21;
 const char c2b_psl_blockSizes_delimiter = ',';
@@ -181,19 +184,19 @@ const char c2b_psl_tStarts_delimiter = ',';
 const uint64_t c2b_rmsk_header_line_count = 3;
 const int c2b_rmsk_field_min = 15;
 const int c2b_rmsk_field_max = 16;
-const char *c2b_rmsk_strand_complement = "C";
-const char *c2b_rmsk_strand_complement_replacement = "-";
+const char* c2b_rmsk_strand_complement = "C";
+const char* c2b_rmsk_strand_complement_replacement = "-";
 const int c2b_vcf_field_min = 8;
 const char c2b_vcf_header_prefix = '#';
 const char c2b_vcf_alt_allele_delim = ',';
 const char c2b_vcf_id_prefix = '<';
 const char c2b_vcf_id_suffix = '>';
 const char c2b_wig_header_prefix = '#';
-const char *c2b_wig_track_prefix = "track";
-const char *c2b_wig_browser_prefix = "browser";
-const char *c2b_wig_variable_step_prefix = "variableStep";
-const char *c2b_wig_fixed_step_prefix = "fixedStep";
-const char *c2b_wig_chr_prefix = "chr";
+const char* c2b_wig_track_prefix = "track";
+const char* c2b_wig_browser_prefix = "browser";
+const char* c2b_wig_variable_step_prefix = "variableStep";
+const char* c2b_wig_fixed_step_prefix = "fixedStep";
+const char* c2b_wig_chr_prefix = "chr";
 
 /* 
    Allowed input and output formats
@@ -261,32 +264,32 @@ const char default_cigar_op_operation = '-';
 */
 
 typedef struct sam {
-    char *qname;
+    char* qname;
     ssize_t qname_capacity;
-    char *modified_qname;
+    char* modified_qname;
     ssize_t modified_qname_capacity;
     int flag;
-    char *strand;
+    char* strand;
     ssize_t strand_capacity;
-    char *rname;
+    char* rname;
     ssize_t rname_capacity;
     uint64_t start;
     uint64_t stop;
-    char *mapq;
+    char* mapq;
     ssize_t mapq_capacity;
-    char *cigar;
+    char* cigar;
     ssize_t cigar_capacity;
-    char *rnext;
+    char* rnext;
     ssize_t rnext_capacity;
-    char *pnext;
+    char* pnext;
     ssize_t pnext_capacity;
-    char *tlen;
+    char* tlen;
     ssize_t tlen_capacity;
-    char *seq;
+    char* seq;
     ssize_t seq_capacity;
-    char *qual;
+    char* qual;
     ssize_t qual_capacity;
-    char *opt;
+    char* opt;
     ssize_t opt_length;
     ssize_t opt_capacity;
 } c2b_sam_t;
@@ -312,23 +315,23 @@ typedef struct sam {
 */
 
 typedef struct gff {
-    char *seqid;
+    char* seqid;
     ssize_t seqid_capacity;
-    char *source;
+    char* source;
     ssize_t source_capacity;
-    char *type;
+    char* type;
     ssize_t type_capacity;
     uint64_t start;
     uint64_t end;
-    char *score;
+    char* score;
     ssize_t score_capacity;
-    char *strand;
+    char* strand;
     ssize_t strand_capacity;
-    char *phase;
+    char* phase;
     ssize_t phase_capacity;
-    char *attributes;
+    char* attributes;
     ssize_t attributes_capacity;
-    char *id;
+    char* id;
     ssize_t id_capacity;
 } c2b_gff_t;
 
@@ -354,25 +357,25 @@ typedef struct gff {
 */
 
 typedef struct gtf {
-    char *seqname;
+    char* seqname;
     ssize_t seqname_capacity;
-    char *source;
+    char* source;
     ssize_t source_capacity;
-    char *feature;
+    char* feature;
     ssize_t feature_capacity;
     uint64_t start;
     uint64_t end;
-    char *score;
+    char* score;
     ssize_t score_capacity;
-    char *strand;
+    char* strand;
     ssize_t strand_capacity;
-    char *frame;
+    char* frame;
     ssize_t frame_capacity;
-    char *attributes;
+    char* attributes;
     ssize_t attributes_capacity;
-    char *id;
+    char* id;
     ssize_t id_capacity;
-    char *comments;
+    char* comments;
     ssize_t comments_capacity;
 } c2b_gtf_t;
 
@@ -409,27 +412,63 @@ typedef struct gtf {
 */
 
 typedef struct psl {
+    char* matchesStr;
+    ssize_t matchesStr_capacity;
     uint64_t matches;
+    char* misMatchesStr;
+    ssize_t misMatchesStr_capacity;
     uint64_t misMatches;
+    char* repMatchesStr;
+    ssize_t repMatchesStr_capacity;
     uint64_t repMatches;
+    char* nCountStr;
+    ssize_t nCountStr_capacity;
     uint64_t nCount;
+    char* qNumInsertStr;
+    ssize_t qNumInsertStr_capacity;
     uint64_t qNumInsert;
+    char* qBaseInsertStr;
+    ssize_t qBaseInsertStr_capacity;
     uint64_t qBaseInsert;
+    char* tNumInsertStr;
+    ssize_t tNumInsertStr_capacity;
     uint64_t tNumInsert;
+    char* tBaseInsertStr;
+    ssize_t tBaseInsertStr_capacity;
     uint64_t tBaseInsert;
-    char *strand;
-    char *qName;
+    char* strand;
+    ssize_t strand_capacity;
+    char* qName;
+    ssize_t qName_capacity;
+    char* qSizeStr;
+    ssize_t qSizeStr_capacity;
     uint64_t qSize;
+    char* qStartStr;
+    ssize_t qStartStr_capacity;
     uint64_t qStart;
+    char* qEndStr;
+    ssize_t qEndStr_capacity;
     uint64_t qEnd;
-    char *tName;
+    char* tName;
+    ssize_t tName_capacity;
+    char* tSizeStr;
+    ssize_t tSizeStr_capacity;
     uint64_t tSize;
+    char* tStartStr;
+    ssize_t tStartStr_capacity;
     uint64_t tStart;
+    char* tEndStr;
+    ssize_t tEndStr_capacity;
     uint64_t tEnd;
+    char* blockCountStr;
+    ssize_t blockCountStr_capacity;
     uint64_t blockCount;
-    char *blockSizes;
-    char *qStarts;
-    char *tStarts;
+    char* blockSizes;
+    ssize_t blockSizes_capacity;
+    char* qStarts;
+    ssize_t qStarts_capacity;
+    char* tStarts;
+    ssize_t tStarts_capacity;
 } c2b_psl_t;
 
 typedef struct block {
@@ -471,35 +510,35 @@ typedef struct block {
 */
 
 typedef struct rmsk {
-    char *sw_score;
+    char* sw_score;
     ssize_t sw_score_capacity;
-    char *perc_div;
+    char* perc_div;
     ssize_t perc_div_capacity;
-    char *perc_deleted;
+    char* perc_deleted;
     ssize_t perc_deleted_capacity;
-    char *perc_inserted;
+    char* perc_inserted;
     ssize_t perc_inserted_capacity;
-    char *query_seq;
+    char* query_seq;
     ssize_t query_seq_capacity;
     uint64_t query_start;
     uint64_t query_end;
-    char *bases_past_match;
+    char* bases_past_match;
     ssize_t bases_past_match_capacity;
-    char *strand;
+    char* strand;
     ssize_t strand_capacity;
-    char *repeat_name;
+    char* repeat_name;
     ssize_t repeat_name_capacity;
-    char *repeat_class;
+    char* repeat_class;
     ssize_t repeat_class_capacity;
-    char *bases_before_match_comp;
+    char* bases_before_match_comp;
     ssize_t bases_before_match_comp_capacity;
-    char *match_start;
+    char* match_start;
     ssize_t match_start_capacity;
-    char *match_end;
+    char* match_end;
     ssize_t match_end_capacity;
-    char *unique_id;
+    char* unique_id;
     ssize_t unique_id_capacity;
-    char *higher_score_match;
+    char* higher_score_match;
     ssize_t higher_score_match_capacity;
 } c2b_rmsk_t;
 
@@ -534,26 +573,26 @@ typedef struct rmsk {
 */
 
 typedef struct vcf {
-    char *chrom;
+    char* chrom;
     ssize_t chrom_capacity;
     uint64_t pos;
     uint64_t start;
     uint64_t end;
-    char *id;
+    char* id;
     ssize_t id_capacity;
-    char *ref;
+    char* ref;
     ssize_t ref_capacity;
-    char *alt;
+    char* alt;
     ssize_t alt_capacity;
-    char *qual;
+    char* qual;
     ssize_t qual_capacity;
-    char *filter;
+    char* filter;
     ssize_t filter_capacity;
-    char *info;
+    char* info;
     ssize_t info_capacity;
-    char *format;
+    char* format;
     ssize_t format_capacity;
-    char *samples;
+    char* samples;
     ssize_t samples_capacity;
 } c2b_vcf_t;
 
@@ -592,9 +631,9 @@ typedef struct vcf {
 #define MAX_PIPES 4
 
 typedef struct pipeset {
-    int **in;
-    int **out;
-    int **err;
+    int** in;
+    int** out;
+    int** err;
     size_t num;
 } c2b_pipeset_t;
 
@@ -607,12 +646,12 @@ typedef struct pipeset {
 */
 
 typedef struct pipeline_stage {
-    c2b_pipeset_t *pipeset;
+    c2b_pipeset_t* pipeset;
     unsigned int src;
     unsigned int dest;
     void (*line_functor)();
     int status;
-    char *description;
+    char* description;
     pid_t pid;
     ssize_t buffer_size;
 } c2b_pipeline_stage_t;
@@ -631,18 +670,28 @@ typedef struct pipeline_stage {
 #define POPEN4_FLAG_CLOSE_CHILD_STDOUT          (1U << 4)
 #define POPEN4_FLAG_CLOSE_CHILD_STDERR          (1U << 5)
 
-static const char *application_name = "convert2bed";
+static const char* application_name = "convert2bed";
 
-static const char *application_version = C2B_VERSION;
+static const char* application_version = C2B_VERSION;
+
+#if BEDOPS_BINARY_TYPE == 0
+static const char* application_type = "typical";
+#else
+#if BEDOPS_BINARY_TYPE == 1
+static const char* application_type = "megarow";
+#else
+static const char* application_type = "typical";
+#endif
+#endif
 
-static const char *application_authors = "Alex Reynolds";
+static const char* application_authors = "Alex Reynolds";
 
-static const char *general_usage = "\n"                                 \
+static const char* general_usage = "\n"                                 \
     "  Usage:\n"                                                        \
     "\n"                                                                \
     "  $ convert2bed --input=fmt [--output=fmt] [options] < input > output\n";
 
-static const char *general_description =                                \
+static const char* general_description =                                \
     "  Convert BAM, GFF, GTF, GVF, PSL, RepeatMasker (OUT), SAM, VCF\n" \
     "  and WIG genomic formats to BED or BEDOPS Starch (compressed BED)\n"      \
     "\n"                                                                \
@@ -651,7 +700,7 @@ static const char *general_description =                                \
     "\n"                                                                \
     "  $ some_upstream_process ... | convert2bed --input=fmt - > output\n";
 
-static const char *general_io_options =                                 \
+static const char* general_io_options =                                 \
     "  Input (required):\n\n"                                           \
     "  --input=[bam|gff|gtf|gvf|psl|rmsk|sam|vcf|wig] (-i <fmt>)\n"     \
     "      Genomic format of input file (required)\n\n"                 \
@@ -659,7 +708,7 @@ static const char *general_io_options =                                 \
     "  --output=[bed|starch] (-o <fmt>)\n"                              \
     "      Format of output file, either BED or BEDOPS Starch (optional, default is BED)\n";
 
-static const char *general_options =                                    \
+static const char* general_options =                                    \
     "  Other processing options:\n\n"                                   \
     "  --do-not-sort (-d)\n"                                            \
     "      Do not sort BED output with sort-bed (not compatible with --output=starch)\n" \
@@ -683,9 +732,9 @@ static const char *general_options =                                    \
     "  --version (-w)\n"                                                \
     "      Show application version\n";
 
-static const char *bam_name = "convert2bed -i bam";
+static const char* bam_name = "convert2bed -i bam";
 
-static const char *bam_description =                                    \
+static const char* bam_description =                                    \
     "  The BAM format is an indexed, binary representation of a SAM (Sequence\n" \
     "  Alignment/Map) file. Internally, it is a 0-based, half-open [a-1,b)\n" \
     "  file, but printing it to text via samtools turns it into a SAM file, which\n" \
@@ -729,7 +778,7 @@ static const char *bam_description =                                    \
     "  --keep-header option to preserve the header data from the SAM input as\n" \
     "  pseudo-BED elements that use the \"_header\" chromosome name.\n";
 
-static const char *bam_options =                                        \
+static const char* bam_options =                                        \
     "  BAM conversion options:\n\n"                                     \
     "  --all-reads (-a)\n"                                              \
     "      Include both unmapped and mapped reads in output\n"          \
@@ -737,9 +786,14 @@ static const char *bam_options =                                        \
     "      Preserve header section as pseudo-BED elements\n"            \
     "  --split (-s)\n"                                                  \
     "      Split reads with 'N' CIGAR operations into separate BED\n"   \
-    "      elements\n";
-
-static const char *bam_usage =                                          \
+    "      elements\n"                                                  \
+    "  --split-with-deletions (-S)\n"                                   \
+    "      Split reads with 'N' and 'D' CIGAR operations into\n"        \
+    "      separate elements\n"                                         \
+    "  --reduced (-R)\n"                                                \
+    "      Only print first six columns of output\n";
+
+static const char* bam_usage =                                          \
     "  Converts 0-based, half-open [a-1,b) headered or headerless BAM input\n" \
     "  into 0-based, half-open [a-1,b) extended BED or BEDOPS Starch\n\n" \
     "  Usage:\n"                                                        \
@@ -760,9 +814,9 @@ static const char *bam_usage =                                          \
     "\n"                                                                \
     "  $ bam2bed --do-not-sort < foo.bam > unsorted-foo.bam.bed\n";
 
-static const char *gff_name = "convert2bed -i gff";
+static const char* gff_name = "convert2bed -i gff";
 
-static const char *gff_description =                                    \
+static const char* gff_description =                                    \
     "  The GFF3 specification (http://www.sequenceontology.org/gff3.shtml) \n" \
     "  contains columns that do not map directly to common or UCSC BED columns.\n" \
     "  Therefore, we add the following columns to preserve the ability to\n" \
@@ -792,12 +846,12 @@ static const char *gff_description =                                    \
     "  option to preserve these data as pseudo-BED elements that use the \"_header\"\n" \
     "  chromosome name.\n";
 
-static const char *gff_options =                                        \
+static const char* gff_options =                                        \
     "  GFF conversion options:\n\n"                                     \
     "  --keep-header (-k)\n"                                            \
     "      Preserve header section as pseudo-BED elements\n";
 
-static const char *gff_usage =                                          \
+static const char* gff_usage =                                          \
     "  Converts 1-based, closed [a, b] GFF3 input into 0-based, half-\n" \
     "  open [a-1, b) six-column extended BED or BEDOPS Starch\n"        \
     "\n"                                                                \
@@ -819,9 +873,9 @@ static const char *gff_usage =                                          \
     "\n"                                                                \
     "  $ gff2bed --do-not-sort < foo.gff > unsorted-foo.gff.bed\n";
 
-static const char *gtf_name = "convert2bed -i gtf";
+static const char* gtf_name = "convert2bed -i gtf";
 
-static const char *gtf_usage =                                          \
+static const char* gtf_usage =                                          \
     "  Converts 1-based, closed [a, b] GTF2.2 input into 0-based, half-\n" \
     "  open [a-1, b) six-column extended BED and BEDOPS Starch\n"       \
     "\n"                                                                \
@@ -843,7 +897,7 @@ static const char *gtf_usage =                                          \
     "\n"                                                                \
     "  $ gtf2bed --do-not-sort < foo.gtf > unsorted-foo.gtf.bed\n";
 
-static const char *gtf_description =                                    \
+static const char* gtf_description =                                    \
     "  The GTF2.2 specification (http://mblab.wustl.edu/GTF22.html)\n"  \
     "  contains columns that do not map directly to common or UCSC BED columns.\n" \
     "  Therefore, we add the following columns to preserve the ability to\n" \
@@ -870,11 +924,11 @@ static const char *gtf_description =                                    \
     "  and a 'zero_length_insertion' attribute is added to the 'attributes' GTF\n" \
     "  column data.\n";
 
-static const char *gtf_options = NULL;
+static const char* gtf_options = NULL;
 
-static const char *gvf_name = "convert2bed -i gvf";
+static const char* gvf_name = "convert2bed -i gvf";
 
-static const char *gvf_description =                                    \
+static const char* gvf_description =                                    \
     "  GVF is a type of GFF3 file with additional pragmas and attributes \n" \
     "  specified (http://www.sequenceontology.org/resources/gvf.html).\n" \
     "  The GVF format has the same nine-column tab-delimited format as \n" \
@@ -910,12 +964,12 @@ static const char *gvf_description =                                    \
     "  option to preserve these data as pseudo-BED elements that use the \"_header\"\n" \
     "  chromosome name.\n";
 
-static const char *gvf_options =                                        \
+static const char* gvf_options =                                        \
     "  GVF conversion options:\n\n"                                     \
     "  --keep-header (-k)\n"                                            \
     "      Preserve header section as pseudo-BED elements\n";
 
-static const char *gvf_usage =                                          \
+static const char* gvf_usage =                                          \
     "  Converts 1-based, closed [a, b] GVF (GFF3) input into 0-based,\n" \
     "  half-open [a-1, b) six-column extended BED or BEDOPS Starch\n"   \
     "\n"                                                                \
@@ -937,9 +991,9 @@ static const char *gvf_usage =                                          \
     "\n"                                                                \
     "  $ gvf2bed --do-not-sort < foo.gvf > unsorted-foo.gvf.bed\n";
 
-static const char *psl_name = "convert2bed -i psl";
+static const char* psl_name = "convert2bed -i psl";
 
-static const char *psl_usage =                                          \
+static const char* psl_usage =                                          \
     "  Converts 0-based, half-open [a-1, b) headered or headerless PSL\n" \
     "  input into 0-based, half-open [a-1, b) extended BED or BEDOPS Starch\n" \
     "\n"                                                                \
@@ -959,7 +1013,7 @@ static const char *psl_usage =                                          \
     "\n"                                                                \
     "  $ psl2bed --do-not-sort < foo.psl > unsorted-foo.psl.bed\n";
 
-static const char *psl_description =                                    \
+static const char* psl_description =                                    \
     "  The PSL specification (http://genome.ucsc.edu/goldenPath/help/blatSpec.html)\n" \
     "  contains 21 columns, some which map to UCSC BED columns and some which do not.\n" \
     "\n"                                                                \
@@ -1004,16 +1058,16 @@ static const char *psl_description =                                    \
     "  - qStarts\n"                                                     \
     "  - tStarts\n";
 
-static const char *psl_options =                                        \
+static const char* psl_options =                                        \
     "  PSL conversion options:\n\n"                                     \
     "  --keep-header (-k)\n"                                            \
     "      Preserve header section as pseudo-BED elements (requires --headered)\n" \
     "  --split (-s)\n"                                                  \
     "      Split record into multiple BED elements, based on tStarts field value\n";
 
-static const char *rmsk_name = "convert2bed -i rmsk";
+static const char* rmsk_name = "convert2bed -i rmsk";
 
-static const char *rmsk_usage =                                         \
+static const char* rmsk_usage =                                         \
     "  Converts 1-base, closed [a, b] RepeatMasker annotation input\n"  \
     "  into 0-based, half-open [a-1, b) extended BED or BEDOPS Starch\n" \
     "\n"                                                                \
@@ -1035,7 +1089,7 @@ static const char *rmsk_usage =                                         \
     "\n"                                                                \
     "  $ rmsk2bed --do-not-sort < foo.out > unsorted-foo.out.bed\n";
 
-static const char *rmsk_description =                                   \
+static const char* rmsk_description =                                   \
     "  The RepeatMasker annotation format is 1-based and closed [a, b]\n" \
     "  which is converted to 0-based, half-closed [a-1, b) when creating\n" \
     "  BED output.\n"                                                   \
@@ -1068,14 +1122,14 @@ static const char *rmsk_description =                                   \
     "  to RepeatMasker annotation output with a simple awk statement or other script\n" \
     "  that calculates 1-based coordinates and permutes columns.\n";
 
-static const char *rmsk_options =                                       \
+static const char* rmsk_options =                                       \
     "  RepeatMasker annotation conversion options:\n\n"                 \
     "  --keep-header (-k)\n"                                            \
     "      Preserve header section as pseudo-BED elements\n";
 
-static const char *sam_name = "convert2bed -i sam";
+static const char* sam_name = "convert2bed -i sam";
 
-static const char *sam_usage =                                          \
+static const char* sam_usage =                                          \
     "  Converts 1-based, closed [a, b] headered or headerless SAM input\n" \
     "  into 0-based, half-open [a-1, b) extended BED or BEDOPS Starch\n" \
     "\n"                                                                \
@@ -1097,7 +1151,7 @@ static const char *sam_usage =                                          \
     "\n"                                                                \
     "  $ sam2bed --do-not-sort < foo.sam > unsorted-foo.sam.bed\n";
 
-static const char *sam_description =                                    \
+static const char* sam_description =                                    \
     "  The SAM (Sequence Alignment/Map) format is 1-based and closed [a, b]\n" \
     "  which is converted to 0-based, half-closed [a-1, b) when creating\n" \
     "  BED output.\n"                                                   \
@@ -1139,7 +1193,7 @@ static const char *sam_description =                                    \
     "  --keep-header option to preserve the header data from the SAM input as\n" \
     "  pseudo-BED elements.\n";
 
-static const char *sam_options =                                        \
+static const char* sam_options =                                        \
     "  SAM conversion options:\n\n"                                     \
     "  --all-reads (-a)\n"                                              \
     "      Include both unmapped and mapped reads in output\n"          \
@@ -1147,11 +1201,16 @@ static const char *sam_options =                                        \
     "      Preserve header section as pseudo-BED elements\n"            \
     "  --split (-s)\n"                                                  \
     "      Split reads with 'N' CIGAR operations into separate BED\n"   \
-    "      elements\n";
+    "      elements\n"                                                  \
+    "  --split-with-deletions (-S)\n"                                   \
+    "      Split reads with 'N' and 'D' CIGAR operations into\n"        \
+    "      separate elements\n"                                         \
+    "  --reduced (-R)\n"                                                \
+    "      Only print first six columns of output\n";
 
-static const char *vcf_name = "convert2bed -i vcf";
+static const char* vcf_name = "convert2bed -i vcf";
 
-static const char *vcf_usage =                                          \
+static const char* vcf_usage =                                          \
     "  Converts 1-based, closed [a, b] VCF v4 input into 0-based,\n"    \
     "  half-open [a-1, b) extended BED or BEDOPS Starch\n"              \
     "\n"                                                                \
@@ -1173,7 +1232,7 @@ static const char *vcf_usage =                                          \
     "\n"                                                                \
     "  $ vcf2bed --do-not-sort < foo.vcf > unsorted-foo.vcf.bed\n";
 
-static const char *vcf_description =                                    \
+static const char* vcf_description =                                    \
     "  This conversion utility relies on the VCF v4.2 format, with its\n" \
     "  specifications outlined here by the 1000 Genomes and Samtools projects:\n" \
     "\n"                                                                \
@@ -1207,7 +1266,7 @@ static const char *vcf_description =                                    \
     "     problems. It may be useful to validate the VCF v4.2 input\n"  \
     "     before conversion.\n";
 
-static const char *vcf_options =                                        \
+static const char* vcf_options =                                        \
     "  VCF conversion options:\n\n"                                     \
     "  --do-not-split (-p)\n"                                           \
     "      By default, this application prints multiple BED elements for each alternate\n" \
@@ -1221,9 +1280,9 @@ static const char *vcf_options =                                        \
     "  --keep-header (-k)\n"                                            \
     "      Preserve header section as pseudo-BED elements\n";
 
-static const char *wig_name = "convert2bed -i wig";
+static const char* wig_name = "convert2bed -i wig";
 
-static const char *wig_usage =                                          \
+static const char* wig_usage =                                          \
     "  Convert UCSC Wiggle to extended BED or BEDOPS Starch\n"          \
     "\n"                                                                \
     "  Usage:\n"                                                        \
@@ -1244,7 +1303,7 @@ static const char *wig_usage =                                          \
     "\n"                                                                \
     "  $ wig2bed --do-not-sort < foo.wig > unsorted-foo.wig.bed\n";
 
-static const char *wig_description =                                    \
+static const char* wig_description =                                    \
     "  The UCSC Wiggle format (http://genome.ucsc.edu/goldenPath/help/wiggle.html)\n" \
     "  is 1-based, closed [a, b] and is offered in variable or fixed step varieties.\n" \
     "  We convert either variety to 0-based, half-open [a-1, b) indexing when creating\n" \
@@ -1253,7 +1312,7 @@ static const char *wig_description =                                    \
     "  By default, data are passed internally to BEDOPS sort-bed to provide sorted\n" \
     "  output ready for use with other BEDOPS utilities.\n";
 
-static const char *wig_options =                                        \
+static const char* wig_options =                                        \
     "  WIG conversion options:\n\n"                                     \
     "  --keep-header (-k)\n"                                            \
     "      Preserve header section as pseudo-BED elements\n"            \
@@ -1266,35 +1325,36 @@ static const char *wig_options =                                        \
     "      with input derived from bigWigToWig, for example, where the bigWig\n" \
     "      data are originally zero-indexed.\n";
 
-static const char *format_undefined_usage =                             \
+static const char* format_undefined_usage =                             \
     "  Note: Please specify format to get detailed usage parameters:\n\n" \
     "  --help[-bam|-gff|-gtf|-gvf|-psl|-rmsk|-sam|-vcf|-wig] (-h <fmt>)\n";
 
 typedef struct gff_state {
-    c2b_gff_t *element;
+    c2b_gff_t* element;
 } c2b_gff_state_t;
 
 typedef struct gtf_state {
-    c2b_gtf_t *element;
+    c2b_gtf_t* element;
     uint64_t line_count;
 } c2b_gtf_state_t;
 
 typedef struct psl_state {
+    c2b_psl_t* element;
     boolean is_headered;
-    c2b_psl_block_t *block;
+    c2b_psl_block_t* block;
 } c2b_psl_state_t;
 
 typedef struct rmsk_state {
-    c2b_rmsk_t *element;
+    c2b_rmsk_t* element;
     uint64_t line;
     boolean is_start_of_line;
     boolean is_start_of_gap;
 } c2b_rmsk_state_t;
 
 typedef struct sam_state {
-    char *samtools_path;
-    c2b_cigar_t *cigar;
-    c2b_sam_t *element;
+    char* samtools_path;
+    c2b_cigar_t* cigar;
+    c2b_sam_t* element;
 } c2b_sam_state_t;
 
 typedef struct vcf_state {
@@ -1315,162 +1375,170 @@ typedef struct wig_state {
     uint64_t start_pos;
     uint64_t end_pos;
     double score;
-    char *chr;
-    char *id;
+    char* chr;
+    char* id;
     boolean is_fixed_step;
     boolean start_write;
-    char *basename;
+    char* basename;
     int start_shift;
     int end_shift;
 } c2b_wig_state_t;
 
 typedef struct cat_params {
-    char *path;
+    char* path;
 } c2b_cat_params_t;
 
 typedef struct sort_params {
     boolean is_enabled;
-    char *sort_bed_path;
-    char *max_mem_value;
-    char *sort_tmpdir_path;
+    char* sort_bed_path;
+    char* max_mem_value;
+    char* sort_tmpdir_path;
 } c2b_sort_params_t;
 
 typedef struct starch_params {
-    char *path;
+    char* path;
     boolean bzip2;
     boolean gzip;
-    char *note;
+    char* note;
 } c2b_starch_params_t;
 
 static struct globals {
     c2b_format_t help_format_idx;
-    char *input_format;
+    char* input_format;
     c2b_format_t input_format_idx;
-    char *output_format;
+    char* output_format;
     c2b_format_t output_format_idx;
     unsigned int header_line_idx;
     boolean all_reads_flag;
     boolean keep_header_flag;
     boolean split_flag;
+    boolean split_with_deletions_flag;
+    boolean reduced_flag;
     boolean zero_indexed_flag;
-    c2b_gff_state_t *gff;
-    c2b_gtf_state_t *gtf;
-    c2b_psl_state_t *psl;
-    c2b_rmsk_state_t *rmsk;
-    c2b_sam_state_t *sam;
-    c2b_vcf_state_t *vcf;
-    c2b_wig_state_t *wig;
-    c2b_cat_params_t *cat;
-    c2b_sort_params_t *sort;
-    c2b_starch_params_t *starch;
+    c2b_gff_state_t* gff;
+    c2b_gtf_state_t* gtf;
+    c2b_psl_state_t* psl;
+    c2b_rmsk_state_t* rmsk;
+    c2b_sam_state_t* sam;
+    c2b_vcf_state_t* vcf;
+    c2b_wig_state_t* wig;
+    c2b_cat_params_t* cat;
+    c2b_sort_params_t* sort;
+    c2b_starch_params_t* starch;
+    char* src_line_str;
+    char* dest_line_str;
 } c2b_globals;
 
 static struct option c2b_client_long_options[] = {
-    { "input",          required_argument,   NULL,    'i' },
-    { "output",         required_argument,   NULL,    'o' },
-    { "do-not-sort",    no_argument,         NULL,    'd' },
-    { "all-reads",      no_argument,         NULL,    'a' },
-    { "keep-header",    no_argument,         NULL,    'k' },
-    { "split",          no_argument,         NULL,    's' },
-    { "do-not-split",   no_argument,         NULL,    'p' },
-    { "snvs",           no_argument,         NULL,    'v' },
-    { "insertions",     no_argument,         NULL,    't' },
-    { "deletions",      no_argument,         NULL,    'n' },
-    { "starch-bzip2",   no_argument,         NULL,    'z' },
-    { "starch-gzip",    no_argument,         NULL,    'g' },
-    { "starch-note",    required_argument,   NULL,    'e' },
-    { "max-mem",        required_argument,   NULL,    'm' },
-    { "sort-tmpdir",    required_argument,   NULL,    'r' },
-    { "multisplit",     required_argument,   NULL,    'b' },
-    { "zero-indexed",   no_argument,         NULL,    'x' },
-    { "help",           no_argument,         NULL,    'h' },
-    { "version",        no_argument,         NULL,    'w' },
-    { "help-bam",       no_argument,         NULL,    '1' },
-    { "help-gff",       no_argument,         NULL,    '2' },
-    { "help-gtf",       no_argument,         NULL,    '3' },
-    { "help-gvf",       no_argument,         NULL,    '4' },
-    { "help-psl",       no_argument,         NULL,    '5' },
-    { "help-rmsk",      no_argument,         NULL,    '6' },
-    { "help-sam",       no_argument,         NULL,    '7' },
-    { "help-vcf",       no_argument,         NULL,    '8' },
-    { "help-wig",       no_argument,         NULL,    '9' },
-    { NULL,             no_argument,         NULL,     0  }
+    { "input",                         required_argument,   NULL,    'i' },
+    { "output",                        required_argument,   NULL,    'o' },
+    { "do-not-sort",                   no_argument,         NULL,    'd' },
+    { "all-reads",                     no_argument,         NULL,    'a' },
+    { "keep-header",                   no_argument,         NULL,    'k' },
+    { "split",                         no_argument,         NULL,    's' },
+    { "split-with-deletions",          no_argument,         NULL,    'S' },
+    { "do-not-split",                  no_argument,         NULL,    'p' },
+    { "reduced",                       no_argument,         NULL,    'R' },
+    { "snvs",                          no_argument,         NULL,    'v' },
+    { "insertions",                    no_argument,         NULL,    't' },
+    { "deletions",                     no_argument,         NULL,    'n' },
+    { "starch-bzip2",                  no_argument,         NULL,    'z' },
+    { "starch-gzip",                   no_argument,         NULL,    'g' },
+    { "starch-note",                   required_argument,   NULL,    'e' },
+    { "max-mem",                       required_argument,   NULL,    'm' },
+    { "sort-tmpdir",                   required_argument,   NULL,    'r' },
+    { "multisplit",                    required_argument,   NULL,    'b' },
+    { "zero-indexed",                  no_argument,         NULL,    'x' },
+    { "help",                          no_argument,         NULL,    'h' },
+    { "version",                       no_argument,         NULL,    'w' },
+    { "help-bam",                      no_argument,         NULL,    '1' },
+    { "help-gff",                      no_argument,         NULL,    '2' },
+    { "help-gtf",                      no_argument,         NULL,    '3' },
+    { "help-gvf",                      no_argument,         NULL,    '4' },
+    { "help-psl",                      no_argument,         NULL,    '5' },
+    { "help-rmsk",                     no_argument,         NULL,    '6' },
+    { "help-sam",                      no_argument,         NULL,    '7' },
+    { "help-vcf",                      no_argument,         NULL,    '8' },
+    { "help-wig",                      no_argument,         NULL,    '9' },
+    { NULL,                            no_argument,         NULL,     0  }
 };
 
-static const char *c2b_client_opt_string = "i:o:dakspvtnzge:m:r:b:xhw12345678?";
+static const char* c2b_client_opt_string = "i:o:daksSpRvtnzge:m:r:b:xhw12345678?";
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-    static void              c2b_init_conversion(c2b_pipeset_t *p);
-    static void              c2b_init_gff_conversion(c2b_pipeset_t *p);
-    static void              c2b_init_gtf_conversion(c2b_pipeset_t *p);
-    static void              c2b_init_gvf_conversion(c2b_pipeset_t *p);
-    static void              c2b_init_psl_conversion(c2b_pipeset_t *p);
-    static void              c2b_init_rmsk_conversion(c2b_pipeset_t *p);
-    static void              c2b_init_sam_conversion(c2b_pipeset_t *p);
-    static void              c2b_init_vcf_conversion(c2b_pipeset_t *p);
-    static void              c2b_init_wig_conversion(c2b_pipeset_t *p);
-    static void              c2b_init_generic_conversion(c2b_pipeset_t *p, void(*to_bed_line_functor)(char *, ssize_t *, char *, ssize_t));
-    static void              c2b_init_bam_conversion(c2b_pipeset_t *p);
-    static inline void       c2b_cmd_cat_stdin(char *cmd);
-    static inline void       c2b_cmd_bam_to_sam(char *cmd);
-    static inline void       c2b_cmd_sort_bed(char *cmd);
-    static inline void       c2b_cmd_starch_bed(char *cmd);
-    static void              c2b_gtf_init_element(c2b_gtf_t **e);
-    static void              c2b_gtf_delete_element(c2b_gtf_t *e);
-    static void              c2b_line_convert_gtf_to_bed_unsorted(char *dest, ssize_t *dest_size, char *src, ssize_t src_size);
-    static inline void       c2b_line_convert_gtf_ptr_to_bed(c2b_gtf_t *g, char *dest_line, ssize_t *dest_size);
-    static void              c2b_gff_init_element(c2b_gff_t **e);
-    static void              c2b_gff_delete_element(c2b_gff_t *e);
-    static void              c2b_line_convert_gff_to_bed_unsorted(char *dest, ssize_t *dest_size, char *src, ssize_t src_size);
-    static inline void       c2b_line_convert_gff_ptr_to_bed(c2b_gff_t *g, char *dest_line, ssize_t *dest_size);
-    static void              c2b_line_convert_psl_to_bed_unsorted(char *dest, ssize_t *dest_size, char *src, ssize_t src_size);
-    static inline void       c2b_psl_blockSizes_to_ptr(char *s, uint64_t bc);
-    static inline void       c2b_psl_tStarts_to_ptr(char *s, uint64_t bc);
-    static inline void       c2b_line_convert_psl_to_bed(c2b_psl_t p, char *dest_line, ssize_t *dest_size);
-    static void              c2b_rmsk_init_element(c2b_rmsk_t **e);
-    static void              c2b_rmsk_delete_element(c2b_rmsk_t *e);
-    static void              c2b_line_convert_rmsk_to_bed_unsorted(char *dest, ssize_t *dest_size, char *src, ssize_t src_size);
-    static inline void       c2b_line_convert_rmsk_ptr_to_bed(c2b_rmsk_t *r, char *dest_line, ssize_t *dest_size);
-    static void              c2b_line_convert_sam_to_bed_unsorted_without_split_operation(char *dest, ssize_t *dest_size, char *src, ssize_t src_size);
-    static void              c2b_line_convert_sam_to_bed_unsorted_with_split_operation(char *dest, ssize_t *dest_size, char *src, ssize_t src_size); 
-    static inline void       c2b_sam_cigar_str_to_ops(char *s);
-    static void              c2b_sam_init_element(c2b_sam_t **e);
-    static void              c2b_sam_delete_element(c2b_sam_t *e);
-    static void              c2b_sam_init_cigar_ops(c2b_cigar_t **c, const ssize_t size);
-    static void              c2b_sam_resize_cigar_ops(c2b_cigar_t **new_c, c2b_cigar_t *old_c);
-    static void              c2b_sam_debug_cigar_ops(c2b_cigar_t *c);
-    static void              c2b_sam_delete_cigar_ops(c2b_cigar_t *c);
-    static inline void       c2b_line_convert_sam_ptr_to_bed(c2b_sam_t *s, char *dest_line, ssize_t *dest_size, boolean print_modified_qname);
-    static void              c2b_line_convert_vcf_to_bed_unsorted(char *dest, ssize_t *dest_size, char *src, ssize_t src_size);
-    static inline boolean    c2b_vcf_allele_is_id(char *s);
-    static inline boolean    c2b_vcf_record_is_snv(char *ref, char *alt);
-    static inline boolean    c2b_vcf_record_is_insertion(char *ref, char *alt);
-    static inline boolean    c2b_vcf_record_is_deletion(char *ref, char *alt);
-    static void              c2b_vcf_init_element(c2b_vcf_t **e);
-    static void              c2b_vcf_delete_element(c2b_vcf_t *e);
-    static inline void       c2b_line_convert_vcf_ptr_to_bed(c2b_vcf_t *v, char *dest_line, ssize_t *dest_size);
-    static void              c2b_line_convert_wig_to_bed_unsorted(char *dest, ssize_t *dest_size, char *src, ssize_t src_size);
+    static void              c2b_init_conversion(c2b_pipeset_t* p);
+    static void              c2b_init_gff_conversion(c2b_pipeset_t* p);
+    static void              c2b_init_gtf_conversion(c2b_pipeset_t* p);
+    static void              c2b_init_gvf_conversion(c2b_pipeset_t* p);
+    static void              c2b_init_psl_conversion(c2b_pipeset_t* p);
+    static void              c2b_init_rmsk_conversion(c2b_pipeset_t* p);
+    static void              c2b_init_sam_conversion(c2b_pipeset_t* p);
+    static void              c2b_init_vcf_conversion(c2b_pipeset_t* p);
+    static void              c2b_init_wig_conversion(c2b_pipeset_t* p);
+    static void              c2b_init_generic_conversion(c2b_pipeset_t* p, void(*to_bed_line_functor)(char**, ssize_t*, ssize_t*, char*, ssize_t));
+    static void              c2b_init_bam_conversion(c2b_pipeset_t* p);
+    static inline void       c2b_cmd_cat_stdin(char* cmd);
+    static inline void       c2b_cmd_bam_to_sam(char* cmd);
+    static inline void       c2b_cmd_sort_bed(char* cmd);
+    static inline void       c2b_cmd_starch_bed(char* cmd);
+    static void              c2b_gtf_init_element(c2b_gtf_t** e);
+    static void              c2b_gtf_delete_element(c2b_gtf_t* e);
+    static void              c2b_line_convert_gtf_to_bed_unsorted(char** dest, ssize_t* dest_size, ssize_t* dest_capacity, char* src, ssize_t src_size);
+    static inline void       c2b_line_convert_gtf_ptr_to_bed(c2b_gtf_t* g, char** dest_line_ptr, ssize_t* dest_size, ssize_t* dest_capacity);
+    static void              c2b_gff_init_element(c2b_gff_t** e);
+    static void              c2b_gff_delete_element(c2b_gff_t* e);
+    static void              c2b_line_convert_gff_to_bed_unsorted(char** dest, ssize_t* dest_size, ssize_t* dest_capacity, char* src, ssize_t src_size);
+    static inline void       c2b_line_convert_gff_ptr_to_bed(c2b_gff_t* g, char** dest_line_ptr, ssize_t* dest_size, ssize_t* dest_capacity);
+    static void              c2b_psl_init_element(c2b_psl_t** e);
+    static void              c2b_psl_delete_element(c2b_psl_t* e);
+    static void              c2b_line_convert_psl_to_bed_unsorted(char** dest, ssize_t* dest_size, ssize_t* dest_capacity, char* src, ssize_t src_size);
+    static inline void       c2b_psl_blockSizes_to_ptr(char* s, uint64_t bc);
+    static inline void       c2b_psl_tStarts_to_ptr(char* s, uint64_t bc);
+    static inline void       c2b_line_convert_psl_ptr_to_bed(c2b_psl_t* p, char** dest_line_ptr, ssize_t* dest_size, ssize_t* dest_capacity);
+    static void              c2b_rmsk_init_element(c2b_rmsk_t** e);
+    static void              c2b_rmsk_delete_element(c2b_rmsk_t* e);
+    static void              c2b_line_convert_rmsk_to_bed_unsorted(char** dest, ssize_t* dest_size, ssize_t* dest_capacity, char* src, ssize_t src_size);
+    static inline void       c2b_line_convert_rmsk_ptr_to_bed(c2b_rmsk_t* r, char** dest_line_ptr, ssize_t* dest_size, ssize_t* dest_capacity);
+    static void              c2b_line_convert_sam_to_bed_unsorted_without_split_operation(char** dest, ssize_t* dest_size, ssize_t* dest_capacity, char* src, ssize_t src_size);
+    static void              c2b_line_convert_sam_to_bed_unsorted_with_split_operation(char** dest, ssize_t* dest_size, ssize_t* dest_capacity, char* src, ssize_t src_size); 
+    static inline void       c2b_sam_cigar_str_to_ops(char* s);
+    static void              c2b_sam_init_element(c2b_sam_t** e);
+    static void              c2b_sam_delete_element(c2b_sam_t* e);
+    static void              c2b_sam_init_cigar_ops(c2b_cigar_t** c, const ssize_t size);
+    static void              c2b_sam_resize_cigar_ops(c2b_cigar_t** new_c, c2b_cigar_t* old_c);
+    static void              c2b_sam_debug_cigar_ops(c2b_cigar_t* c);
+    static void              c2b_sam_delete_cigar_ops(c2b_cigar_t* c);
+    static inline void       c2b_line_convert_sam_ptr_to_bed(c2b_sam_t* s, char** dest_line_ptr, ssize_t* dest_size, ssize_t* dest_capacity, boolean print_modified_qname);
+    static void              c2b_line_convert_vcf_to_bed_unsorted(char** dest, ssize_t* dest_size, ssize_t* dest_capacity, char* src, ssize_t src_size);
+    static inline boolean    c2b_vcf_allele_is_id(char* s);
+    static inline boolean    c2b_vcf_record_is_snv(char* ref, char* alt);
+    static inline boolean    c2b_vcf_record_is_insertion(char* ref, char* alt);
+    static inline boolean    c2b_vcf_record_is_deletion(char* ref, char* alt);
+    static void              c2b_vcf_init_element(c2b_vcf_t** e);
+    static void              c2b_vcf_delete_element(c2b_vcf_t* e);
+    static inline void       c2b_line_convert_vcf_ptr_to_bed(c2b_vcf_t* v, char** dest_line_ptr, ssize_t* dest_size, ssize_t* dest_capacity);
+    static void              c2b_line_convert_wig_to_bed_unsorted(char** dest, ssize_t* dest_size, ssize_t* dest_capacity, char* src, ssize_t src_size);
     static void *            c2b_read_bytes_from_stdin(void *arg);
-    static void *            c2b_process_intermediate_bytes_by_lines(void *arg);
-    static void *            c2b_write_in_bytes_to_in_process(void *arg);
-    static void *            c2b_write_out_bytes_to_in_process(void *arg);
-    static void *            c2b_write_in_bytes_to_stdout(void *arg);
-    static void *            c2b_write_out_bytes_to_stdout(void *arg);
-    static void              c2b_memrchr_offset(ssize_t *offset, char *buf, ssize_t buf_size, ssize_t len, char delim);
-    static void              c2b_init_pipeset(c2b_pipeset_t *p, const size_t num);
-    static void              c2b_debug_pipeset(c2b_pipeset_t *p, const size_t num);
-    static void              c2b_delete_pipeset(c2b_pipeset_t *p);
+    static void *            c2b_process_intermediate_bytes_by_lines(void* arg);
+    static void *            c2b_write_in_bytes_to_in_process(void* arg);
+    static void *            c2b_write_out_bytes_to_in_process(void* arg);
+    static void *            c2b_write_in_bytes_to_stdout(void* arg);
+    static void *            c2b_write_out_bytes_to_stdout(void* arg);
+    static void              c2b_memrchr_offset(ssize_t* offset, char* buf, ssize_t buf_size, ssize_t len, char delim);
+    static void              c2b_init_pipeset(c2b_pipeset_t* p, const size_t num);
+    static void              c2b_debug_pipeset(c2b_pipeset_t* p, const size_t num);
+    static void              c2b_delete_pipeset(c2b_pipeset_t* p);
     static void              c2b_set_close_exec_flag(int fd);
     static void              c2b_unset_close_exec_flag(int fd);
     static int               c2b_pipe4(int fd[2], int flags);
     static pid_t             c2b_popen4(const char* cmd, int pin[2], int pout[2], int perr[2], int flags);
     static void              c2b_test_dependencies();
-    static boolean           c2b_print_matches(char *path, char *fn);
-    static char *            c2b_strsep(char **stringp, const char *delim);
-    static boolean           c2b_is_there(char *candidate);
+    static boolean           c2b_print_matches(char* path, char* fn);
+    static char *            c2b_strsep(char** stringp, const char* delim);
+    static boolean           c2b_is_there(char* candidate);
     static void              c2b_init_globals();
     static void              c2b_delete_globals();
     static void              c2b_init_global_gff_state();
@@ -1493,13 +1561,13 @@ extern "C" {
     static void              c2b_delete_global_sort_params();
     static void              c2b_init_global_starch_params();
     static void              c2b_delete_global_starch_params();
-    static void              c2b_init_command_line_options(int argc, char **argv);
-    static void              c2b_print_version(FILE *stream);
-    static void              c2b_print_usage(FILE *stream);
-    static void              c2b_print_format_usage(FILE *stream);
-    static char *            c2b_to_lowercase(const char *src);
-    static c2b_format_t      c2b_to_input_format(const char *input_format);
-    static c2b_format_t      c2b_to_output_format(const char *output_format);
+    static void              c2b_init_command_line_options(int argc, char** argv);
+    static void              c2b_print_version(FILE* stream);
+    static void              c2b_print_usage(FILE* stream);
+    static void              c2b_print_format_usage(FILE* stream);
+    static char*             c2b_to_lowercase(const char* src);
+    static c2b_format_t      c2b_to_input_format(const char* input_format);
+    static c2b_format_t      c2b_to_output_format(const char* output_format);
 
 #ifdef __cplusplus
 }
diff --git a/applications/bed/conversion/src/tests/bam/split2.bam b/applications/bed/conversion/src/tests/bam/split2.bam
new file mode 100644
index 0000000..8806fa3
Binary files /dev/null and b/applications/bed/conversion/src/tests/bam/split2.bam differ
diff --git a/applications/bed/conversion/src/tests/bam/split2.sam b/applications/bed/conversion/src/tests/bam/split2.sam
new file mode 100644
index 0000000..650bb00
--- /dev/null
+++ b/applications/bed/conversion/src/tests/bam/split2.sam
@@ -0,0 +1,29 @@
+ at HD	VN:1.4	SO:coordinate
+ at SQ	SN:chr1	LN:249250621
+ at SQ	SN:chr10	LN:135534747
+ at SQ	SN:chr11	LN:135006516
+ at SQ	SN:chr12	LN:133851895
+ at SQ	SN:chr13	LN:115169878
+ at SQ	SN:chr14	LN:107349540
+ at SQ	SN:chr15	LN:102531392
+ at SQ	SN:chr16	LN:90354753
+ at SQ	SN:chr17	LN:81195210
+ at SQ	SN:chr18	LN:78077248
+ at SQ	SN:chr19	LN:59128983
+ at SQ	SN:chr2	LN:243199373
+ at SQ	SN:chr20	LN:63025520
+ at SQ	SN:chr21	LN:48129895
+ at SQ	SN:chr22	LN:51304566
+ at SQ	SN:chr3	LN:198022430
+ at SQ	SN:chr4	LN:191154276
+ at SQ	SN:chr5	LN:180915260
+ at SQ	SN:chr6	LN:171115067
+ at SQ	SN:chr7	LN:159138663
+ at SQ	SN:chr8	LN:146364022
+ at SQ	SN:chr9	LN:141213431
+ at SQ	SN:chrM	LN:16571
+ at SQ	SN:chrX	LN:155270560
+ at SQ	SN:chrY	LN:59373566
+ at PG	ID:TopHat	VN:2.0.13	CL:/net/lebowski/vol1/sw/tophat/2.0.13/tophat --GTF /home/nelsonjs/code/stampipes/data/tophat/refseq/hg19/genes.gtf -r 200 --mate-std-dev 300 --library-type fr-unstranded -p 8 -o DS27050_TCCGGAGA-TCAGAGCC_L001_tophat_001 /home/nelsonjs/code/stampipes/data/tophat/refseq/hg19/hg19 trimmed/DS27050_TCCGGAGA-TCAGAGCC_L001_R1_001.fastq.gz trimmed/DS27050_TCCGGAGA-TCAGAGCC_L001_R2_001.fastq.gz
+ at PG	ID:MarkDuplicates	PN:MarkDuplicates	VN:1.118(2329276ea55d31ab6b19bab55b9ee7b51e4a446e_1406559781)	CL:picard.sam.MarkDuplicates INPUT=[DS27050_TCCGGAGA-TCAGAGCC_L001.tophat_merged.bam] OUTPUT=DS27050_TCCGGAGA-TCAGAGCC_L001.hg19.bam METRICS_FILE=DS27050_TCCGGAGA-TCAGAGCC_L001.spotdups.txt REMOVE_DUPLICATES=false ASSUME_SORTED=true    PROGRAM_RECORD_ID=MarkDuplicates PROGRAM_GROUP_NAME=MarkDuplicates MAX_SEQUENCES_FOR_DISK_READ_ENDS_MAP=50000 MAX_FILE_HANDLES_FOR_READ_ENDS_MAP=8000 SORT [...]
+NS500372:42:H2JWJBGXX:2:12207:2947:19765	81	chr19	7695545	50	1M163N23M1D1M626N11M	=	7694707	-1663	GAGGGAGCTGTGGCCACCTGAGAAGCTTCAAGAGAT	FFFFFFFFFF<FFFFFFFFFFFFFFF.7FFFAAAA<	XA:i:0	MD:Z:36	PG:Z:MarkDuplicates	NH:i:1	NM:i:0	XS:A:+
diff --git a/applications/bed/conversion/src/wrappers/bam2bed b/applications/bed/conversion/src/wrappers/bam2bed
index feb4d8c..67c2bcb 100755
--- a/applications/bed/conversion/src/wrappers/bam2bed
+++ b/applications/bed/conversion/src/wrappers/bam2bed
@@ -36,6 +36,8 @@ sort_tmpdir="/tmp"
 all_reads=false
 keep_header=false
 split=false
+split_with_deletions=false
+reduced=false
 
 help()
 {
@@ -43,7 +45,7 @@ help()
     exit $1
 }
 
-optspec=":r:m:dhaks-:"
+optspec=":r:m:dhaksSR-:"
 while getopts "$optspec" optchar; do
     case "${optchar}" in
         -)
@@ -94,6 +96,12 @@ while getopts "$optspec" optchar; do
                 split)
                     split=true
                     ;;
+                split-with-deletions)
+                    split_with_deletions=true
+                    ;;
+                reduced)
+                    reduced=true
+                    ;;
                 *)
                     help 1
                     #if [ "$OPTERR" = 1 ] && [ "${optspec:0:1}" != ":" ]; then echo "Unknown option --${OPTARG}" >&2; fi
@@ -122,6 +130,12 @@ while getopts "$optspec" optchar; do
         s)
             split=true
             ;;
+        S)
+            split_with_deletions=true
+            ;;
+        R)
+            reduced=true
+            ;;
         *)
             help 1
             #if [ "$OPTERR" != 1 ] || [ "${optspec:0:1}" = ":" ]; then echo "Non-option argument: '-${OPTARG}'" >&2; fi
@@ -144,5 +158,7 @@ if [ "${do_not_sort}" = true ]; then options="${options} --do-not-sort"; fi
 if [ "${all_reads}" = true ]; then options="${options} --all-reads"; fi
 if [ "${keep_header}" = true ]; then options="${options} --keep-header"; fi
 if [ "${split}" = true ]; then options="${options} --split"; fi
+if [ "${split_with_deletions}" = true ]; then options="${options} --split-with-deletions"; fi
+if [ "${reduced}" = true ]; then options="${options} --reduced"; fi
 
 ${cmd} ${options} - <&0
diff --git a/applications/bed/conversion/src/wrappers/bam2starch b/applications/bed/conversion/src/wrappers/bam2starch
index 7a01673..113b47a 100755
--- a/applications/bed/conversion/src/wrappers/bam2starch
+++ b/applications/bed/conversion/src/wrappers/bam2starch
@@ -40,6 +40,8 @@ starch_not_set=false
 all_reads=false
 keep_header=false
 split=false
+split_with_deletions=false
+reduced=false
 
 help()
 {
@@ -47,7 +49,7 @@ help()
     exit $1
 }
 
-optspec=":e:zgr:m:dhaks-:"
+optspec=":e:zgr:m:dhaksSR-:"
 while getopts "$optspec" optchar; do
     case "${optchar}" in
         -)
@@ -114,6 +116,12 @@ while getopts "$optspec" optchar; do
                 split)
                     split=true
                     ;;
+                split-with-deletions)
+                    split_with_deletions=true
+                    ;;
+                reduced)
+                    reduced=true
+                    ;;
                 *)
                     help 1
                     #if [ "$OPTERR" = 1 ] && [ "${optspec:0:1}" != ":" ]; then echo "Unknown option --${OPTARG}" >&2; fi
@@ -152,6 +160,12 @@ while getopts "$optspec" optchar; do
         s)
             split=true
             ;;
+        S)
+            split_with_deletions=true
+            ;;
+        R)
+            reduced=true
+            ;;
         *)
             help 1
             #if [ "$OPTERR" != 1 ] || [ "${optspec:0:1}" = ":" ]; then echo "Non-option argument: '-${OPTARG}'" >&2; fi
@@ -177,5 +191,7 @@ if [ "${starch_note_set}" = true ]; then options="${options} --starch-note=\"${s
 if [ "${all_reads}" = true ]; then options="${options} --all-reads"; fi
 if [ "${keep_header}" = true ]; then options="${options} --keep-header"; fi
 if [ "${split}" = true ]; then options="${options} --split"; fi
+if [ "${split_with_deletions}" = true ]; then options="${options} --split-with-deletions"; fi
+if [ "${reduced}" = true ]; then options="${options} --reduced"; fi
 
 ${cmd} ${options} - <&0
diff --git a/applications/bed/conversion/src/wrappers/sam2bed b/applications/bed/conversion/src/wrappers/sam2bed
index 69e49b9..3dee14e 100755
--- a/applications/bed/conversion/src/wrappers/sam2bed
+++ b/applications/bed/conversion/src/wrappers/sam2bed
@@ -36,6 +36,8 @@ sort_tmpdir="/tmp"
 all_reads=false
 keep_header=false
 split=false
+split_with_deletions=false
+reduced=false
 
 help()
 {
@@ -43,7 +45,7 @@ help()
     exit $1
 }
 
-optspec=":r:m:dhaks-:"
+optspec=":r:m:dhaksSR-:"
 while getopts "$optspec" optchar; do
     case "${optchar}" in
         -)
@@ -94,6 +96,12 @@ while getopts "$optspec" optchar; do
                 split)
                     split=true
                     ;;
+                split-with-deletions)
+                    split_with_deletions=true
+                    ;;
+                reduced)
+                    reduced=true
+                    ;;
                 *)
                     help 1
                     #if [ "$OPTERR" = 1 ] && [ "${optspec:0:1}" != ":" ]; then echo "Unknown option --${OPTARG}" >&2; fi
@@ -122,6 +130,12 @@ while getopts "$optspec" optchar; do
         s)
             split=true
             ;;
+        S)
+            split_with_deletions=true
+            ;;
+        R)
+            reduced=true
+            ;;
         *)
             help 1
             #if [ "$OPTERR" != 1 ] || [ "${optspec:0:1}" = ":" ]; then echo "Non-option argument: '-${OPTARG}'" >&2; fi
@@ -144,5 +158,7 @@ if [ "${do_not_sort}" = true ]; then options="${options} --do-not-sort"; fi
 if [ "${all_reads}" = true ]; then options="${options} --all-reads"; fi
 if [ "${keep_header}" = true ]; then options="${options} --keep-header"; fi
 if [ "${split}" = true ]; then options="${options} --split"; fi
+if [ "${split_with_deletions}" = true ]; then options="${options} --split-with-deletions"; fi
+if [ "${reduced}" = true ]; then options="${options} --reduced"; fi
 
 ${cmd} ${options} - <&0
diff --git a/applications/bed/conversion/src/wrappers/sam2starch b/applications/bed/conversion/src/wrappers/sam2starch
index 12a38c6..3674372 100755
--- a/applications/bed/conversion/src/wrappers/sam2starch
+++ b/applications/bed/conversion/src/wrappers/sam2starch
@@ -40,6 +40,8 @@ starch_not_set=false
 all_reads=false
 keep_header=false
 split=false
+split_with_deletions=false
+reduced=false
 
 help()
 {
@@ -47,7 +49,7 @@ help()
     exit $1
 }
 
-optspec=":e:zgr:m:dhaks-:"
+optspec=":e:zgr:m:dhaksSR-:"
 while getopts "$optspec" optchar; do
     case "${optchar}" in
         -)
@@ -114,6 +116,12 @@ while getopts "$optspec" optchar; do
                 split)
                     split=true
                     ;;
+                split-with-deletions)
+                    split_with_deletions=true
+                    ;;
+                reduced)
+                    reduced=true
+                    ;;
                 *)
                     help 1
                     #if [ "$OPTERR" = 1 ] && [ "${optspec:0:1}" != ":" ]; then echo "Unknown option --${OPTARG}" >&2; fi
@@ -152,6 +160,12 @@ while getopts "$optspec" optchar; do
         s)
             split=true
             ;;
+        S)
+            split_with_deletions=true
+            ;;
+        R)
+            reduced=true
+            ;;
         *)
             help 1
             #if [ "$OPTERR" != 1 ] || [ "${optspec:0:1}" = ":" ]; then echo "Non-option argument: '-${OPTARG}'" >&2; fi
@@ -177,5 +191,7 @@ if [ "${starch_note_set}" = true ]; then options="${options} --starch-note=\"${s
 if [ "${all_reads}" = true ]; then options="${options} --all-reads"; fi
 if [ "${keep_header}" = true ]; then options="${options} --keep-header"; fi
 if [ "${split}" = true ]; then options="${options} --split"; fi
+if [ "${split_with_deletions}" = true ]; then options="${options} --split-with-deletions"; fi
+if [ "${reduced}" = true ]; then options="${options} --reduced"; fi
 
 ${cmd} ${options} - <&0
diff --git a/applications/bed/sort-bed/src/CheckSort.cpp b/applications/bed/sort-bed/src/CheckSort.cpp
index 09a9d77..f469b19 100644
--- a/applications/bed/sort-bed/src/CheckSort.cpp
+++ b/applications/bed/sort-bed/src/CheckSort.cpp
@@ -27,24 +27,28 @@
 
 #include "data/bed/BedCheckIterator.hpp"
 #include "data/bed/BedTypes.hpp"
+#include "suite/BEDOPS.Constants.hpp"
 #include "utility/Exception.hpp"
+#include "utility/PooledMemory.hpp"
 
 #include "Structures.hpp"
 
 int
 checkSort(char const **bedFileNames, unsigned int numFiles)
 {
-  typedef Bed::bed_check_iterator<Bed::B3Rest*> IterType;
+  constexpr std::size_t PoolSz = 8*2;
+  typedef Bed::bed_check_iterator<Bed::B3Rest*, PoolSz> IterType;
   int rtnval = EXIT_FAILURE;
   try {
+    Ext::PooledMemory<Bed::B3Rest, PoolSz> pool;
     for ( unsigned int i = 0; i < numFiles; ++i ) {
       std::ifstream infile(bedFileNames[i]);
       if ( 0 != std::strcmp(bedFileNames[i], "-") && !infile )
         throw(Ext::UserError("Unable to find: " + std::string(bedFileNames[i])));
       IterType start((std::strcmp(bedFileNames[i], "-") == 0) ? std::cin : infile,
-                     bedFileNames[i]), end;
+                     bedFileNames[i], pool), end;
       while ( start != end )
-        delete *start++;
+        pool.release(*start++);
     } // for each file
     rtnval = EXIT_SUCCESS;
   } catch(std::exception& s) {
diff --git a/applications/bed/sort-bed/src/Makefile b/applications/bed/sort-bed/src/Makefile
index 699a0b6..4a3a6ee 100644
--- a/applications/bed/sort-bed/src/Makefile
+++ b/applications/bed/sort-bed/src/Makefile
@@ -25,19 +25,26 @@ LOCALZLIBINCDIR     = ${LOCALZLIBDIR}
 LIBLOCATION         = -L${LOCALJANSSONLIBDIR} -L${LOCALBZIP2LIBDIR} -L${LOCALZLIBDIR}
 LIBRARIES           = ${LOCALJANSSONLIB} ${LOCALBZIP2LIB} ${LOCALZLIBLIB}
 
-PROG                = sort-bed
+PROG                = sort-bed-${BINARY_TYPE}
 BINDIR              = ../bin
-OBJDIR             = objects
+OBJDIR              = objects-${BINARY_TYPE}
 WARNINGS            = -Wall -Wextra -pedantic
-BLDFLAGS            = ${WARNINGS} -O3 -std=c++11
+BLDFLAGS            = ${WARNINGS} -O3 -std=c++11 ${MEGAFLAGS}
 SFLAGS              = -static
 
+ifeq ($(BINARY_TYPE),)
+	TFLAG = -DBEDOPS_BINARY_TYPE=0
+else
+	TFLAG = -DBEDOPS_BINARY_TYPE=$(BINARY_TYPE_NUM)
+endif
+
 dependency_names    = starchConstants starchFileHelpers starchHelpers starchMetadataHelpers unstarchHelpers starchSha1Digest starchBase64Coding SortDetails Sort CheckSort
 dependencies        = $(addprefix $(OBJDIR)/, $(addsuffix .o, $(dependency_names)))
+debug_dependencies  = $(addprefix $(OBJDIR)/, $(addsuffix .do, $(dependency_names)))
 
-FLAGS               = $(SFLAGS) -s ${BLDFLAGS} ${LIBLOCATION} ${INCLUDES}
-DFLAGS              = $(SFLAGS) -g -O0 -std=c++11 -Wall -fno-inline -pedantic ${LIBLOCATION} ${INCLUDES}
-GPROFFLAGS          = $(SFLAGS) -O -std=c++11 -Wall -pedantic -pg ${LIBLOCATION} ${INCLUDES}
+FLAGS               = $(SFLAGS) ${MEGAFLAGS} -s ${BLDFLAGS} ${LIBLOCATION} ${INCLUDES}
+DFLAGS              = $(SFLAGS) ${MEGAFLAGS} -g -O0 -std=c++11 -Wall -fno-inline -pedantic ${LIBLOCATION} ${INCLUDES}
+GPROFFLAGS          = $(SFLAGS) ${MEGAFLAGS} -O -std=c++11 -Wall -pedantic -pg ${LIBLOCATION} ${INCLUDES}
 
 ifneq ($(shell uname -s),CYGWIN_NT-6.1)
 	WARNINGS += -ansi
@@ -45,45 +52,56 @@ else
 	WARNINGS += -U__STRICT_ANSI__
 endif
 
-build: $(BINDIR)/$(PROG) $(dependencies) update-sort-bed-slurm update-sort-bed-starch-slurm update-sort-bed-migrate-candidates
+build: $(dependencies) $(BINDIR)/$(PROG) update-sort-bed-slurm-${BINARY_TYPE} update-sort-bed-starch-slurm-${BINARY_TYPE} update-sort-bed-migrate-candidates-${BINARY_TYPE}
+	rm -rf ${OBJDIR}
 
 build_gprof: $(BINDIR)/gprof.$(PROG)
+	rm -rf ${OBJDIR}
 
 build_debug: $(BINDIR)/debug.$(PROG)
+	rm -rf ${OBJDIR}
 
 dependencies: $(dependencies)
 
-update-sort-bed-slurm:
-	mkdir -p $(BINDIR) && cp update-sort-bed-slurm.py $(BINDIR)/update-sort-bed-slurm
+debug_dependencies: $(debug_dependencies)
 
-update-sort-bed-starch-slurm:
-	mkdir -p $(BINDIR) && cp update-sort-bed-starch-slurm.py $(BINDIR)/update-sort-bed-starch-slurm
+update-sort-bed-slurm-${BINARY_TYPE}:
+	mkdir -p $(BINDIR) && cp update-sort-bed-slurm.py $(BINDIR)/update-sort-bed-slurm-${BINARY_TYPE}
 
-update-sort-bed-migrate-candidates:
-	mkdir -p $(BINDIR) && cp update-sort-bed-migrate-candidates.py $(BINDIR)/update-sort-bed-migrate-candidates
+update-sort-bed-starch-slurm-${BINARY_TYPE}:
+	mkdir -p $(BINDIR) && cp update-sort-bed-starch-slurm.py $(BINDIR)/update-sort-bed-starch-slurm-${BINARY_TYPE}
+
+update-sort-bed-migrate-candidates-${BINARY_TYPE}:
+	mkdir -p $(BINDIR) && cp update-sort-bed-migrate-candidates.py $(BINDIR)/update-sort-bed-migrate-candidates-${BINARY_TYPE}
 
 $(BINDIR)/$(PROG) : $(dependencies)
-	mkdir -p $(BINDIR) && $(CXX) -o $@ $(FLAGS) $^ ${LIBRARIES}
+	mkdir -p $(BINDIR) && $(CXX) -o $@ ${TFLAG} $(FLAGS) $^ ${LIBRARIES}
 
 $(BINDIR)/gprof.$(PROG) : $(dependencies)
-	mkdir -p $(BINDIR) && $(CXX) -o $@ $(GPROFFLAGS) $^ ${LIBRARIES}
+	mkdir -p $(BINDIR) && $(CXX) -o $@ ${TFLAG} $(GPROFFLAGS) $^ ${LIBRARIES}
 
-$(BINDIR)/debug.$(PROG) : $(dependencies)
-	mkdir -p $(BINDIR) && $(CXX) -o $@ $(DFLAGS) $^ ${LIBRARIES}
+$(BINDIR)/debug.$(PROG) : $(debug_dependencies)
+	mkdir -p $(BINDIR) && $(CXX) -o $@ ${TFLAG} $(DFLAGS) $^ ${LIBRARIES}
+	rm -rf ${OBJDIR}
 
 $(OBJDIR)/%.o : $(LIB1)/%.cpp
-	mkdir -p $(OBJDIR) && $(CXX) -c $(BLDFLAGS) $^ -o $@ ${INCLUDES}
+	mkdir -p $(OBJDIR) && $(CXX) -c ${TFLAG} $(BLDFLAGS) $^ -o $@ ${INCLUDES}
 
 $(OBJDIR)/%.o : $(LIB3)/%.c
-	mkdir -p $(OBJDIR) && $(CXX) -c ${BLDFLAGS} $^ -o $@ ${INCLUDES}
+	mkdir -p $(OBJDIR) && $(CXX) -c ${TFLAG} ${BLDFLAGS} $^ -o $@ ${INCLUDES}
 
 $(OBJDIR)/%.o : %.cpp
-	mkdir -p $(OBJDIR) && $(CXX) -c ${BLDFLAGS} $^ -o $@ ${INCLUDES}
+	mkdir -p $(OBJDIR) && $(CXX) -c ${TFLAG} ${BLDFLAGS} $^ -o $@ ${INCLUDES}
+
+$(OBJDIR)/%.do : $(LIB1)/%.cpp
+	mkdir -p $(OBJDIR) && $(CXX) -c ${TFLAG} $(DFLAGS) $^ -o $@ ${INCLUDES}
+
+$(OBJDIR)/%.do : $(LIB3)/%.c
+	mkdir -p $(OBJDIR) && $(CXX) -c ${TFLAG} ${DFLAGS} $^ -o $@ ${INCLUDES}
+
+$(OBJDIR)/%.do : %.cpp
+	mkdir -p $(OBJDIR) && $(CXX) -c ${TFLAG} ${DFLAGS} $^ -o $@ ${INCLUDES}
 
 clean:
 	rm -rf ${OBJDIR}
-	rm -f $(BINDIR)/$(PROG)
-	rm -f $(BINDIR)/*.$(PROG)
-	rm -f $(BINDIR)/update-sort-bed-slurm
-	rm -f $(BINDIR)/update-sort-bed-starch-slurm
-	rm -f $(BINDIR)/update-sort-bed-migrate-candidates
+	rm -rf $(BINDIR)
diff --git a/applications/bed/sort-bed/src/Makefile.darwin b/applications/bed/sort-bed/src/Makefile.darwin
index 6717c8a..766b876 100644
--- a/applications/bed/sort-bed/src/Makefile.darwin
+++ b/applications/bed/sort-bed/src/Makefile.darwin
@@ -1,12 +1,10 @@
-MIN_OSX_VERSION      = 10.7
-
 MAIN                 = ../../../..
 MAINAPPDIR           = ../..
 HEAD                 = $(MAIN)/interfaces/general-headers
 LIB3                 = $(MAIN)/interfaces/src/data/starch
-PROG                 = sort-bed
+PROG                 = sort-bed-${BINARY_TYPE}
 DIST_DIR             = ../bin
-OBJ_DIR              = objects_${ARCH}
+OBJ_DIR              = objects_${ARCH}_${BINARY_TYPE}
 OPTIMIZE             = -O3 -std=c++11 -stdlib=libc++
 WARNINGS             = -Wall
 MAIN                 = ../../../..
@@ -34,65 +32,76 @@ LIBRARIES            = ${LOCALJANSSONLIB} ${LOCALBZIP2LIB} ${LOCALZLIBLIB}
 BLDFLAGS             = ${WARNINGS} ${OPTIMIZE}
 INCLUDES             = -iquote$(HEAD) -I${LOCALJANSSONINCDIR} -I${LOCALBZIP2INCDIR} -I${LOCALZLIBINCDIR}
 STARCHOBJS           = $(OBJ_DIR)/starchConstants.o $(OBJ_DIR)/starchFileHelpers.o $(OBJ_DIR)/starchHelpers.o $(OBJ_DIR)/starchMetadataHelpers.o $(OBJ_DIR)/unstarchHelpers.o $(OBJ_DIR)/starchSha1Digest.o $(OBJ_DIR)/starchBase64Coding.o
+SELF                 = ${shell pwd}/Makefile.darwin
+
+ifeq ($(BINARY_TYPE),)
+	TFLAG = -DBEDOPS_BINARY_TYPE=0
+else
+	TFLAG = -DBEDOPS_BINARY_TYPE=$(BINARY_TYPE_NUM)
+endif
 
-build: sort update-sort-bed-slurm update-sort-bed-starch-slurm update-sort-bed-migrate-candidates
+build: sort check-cp
+	rm -rf ${OBJ_DIR}
 
 update-sort-bed-slurm:
-	cp update-sort-bed-slurm.py ${DIST_DIR}/update-sort-bed-slurm
+	cp update-sort-bed-slurm.py ${DIST_DIR}/update-sort-bed-slurm-${BINARY_TYPE}
 
 update-sort-bed-starch-slurm:
-	cp update-sort-bed-starch-slurm.py ${DIST_DIR}/update-sort-bed-starch-slurm
+	cp update-sort-bed-starch-slurm.py ${DIST_DIR}/update-sort-bed-starch-slurm-${BINARY_TYPE}
 
 update-sort-bed-migrate-candidates:
-	cp update-sort-bed-migrate-candidates.py ${DIST_DIR}/update-sort-bed-migrate-candidates
+	cp update-sort-bed-migrate-candidates.py ${DIST_DIR}/update-sort-bed-migrate-candidates-${BINARY_TYPE}
+
+check-cp:
+	make -f ${SELF} update-sort-bed-slurm
+	make -f ${SELF} update-sort-bed-starch-slurm
+	make -f ${SELF} update-sort-bed-migrate-candidates
 
 sort: sortbuild
-	${CXX} -o ${DIST_DIR}/${PROG}_${ARCH} ${BLDFLAGS} ${LIBLOCATION} ${INCLUDES} -mmacosx-version-min=$(MIN_OSX_VERSION) -arch $(ARCH) -lc++ ${STARCHOBJS} ${OBJ_DIR}/SortDetails.o ${OBJ_DIR}/Sort.o ${OBJ_DIR}/CheckSort.o ${LIBRARIES}
+	${CXX} -o ${DIST_DIR}/${PROG} ${MEGAFLAGS} ${BLDFLAGS} ${LIBLOCATION} ${INCLUDES} -mmacosx-version-min=$(MIN_OSX_VERSION) -arch $(ARCH) -lc++ ${STARCHOBJS} ${OBJ_DIR}/SortDetails.o ${OBJ_DIR}/Sort.o ${OBJ_DIR}/CheckSort.o ${LIBRARIES}
 
 sortbuild: prep
-	$(CXX) -x c++ -mmacosx-version-min=${MIN_OSX_VERSION} -arch ${ARCH} -c ${BLDFLAGS} ${LIB3}/starchConstants.c -o ${OBJ_DIR}/starchConstants.o ${INCLUDES}
-	$(CXX) -x c++ -mmacosx-version-min=${MIN_OSX_VERSION} -arch ${ARCH} -c ${BLDFLAGS} ${LIB3}/starchFileHelpers.c -o ${OBJ_DIR}/starchFileHelpers.o ${INCLUDES}
-	$(CXX) -x c++ -mmacosx-version-min=${MIN_OSX_VERSION} -arch ${ARCH} -c ${BLDFLAGS} ${LIB3}/starchHelpers.c -o ${OBJ_DIR}/starchHelpers.o -iquote${HEAD} ${INCLUDES}
-	$(CXX) -x c++ -mmacosx-version-min=${MIN_OSX_VERSION} -arch ${ARCH} -c ${BLDFLAGS} ${LIB3}/starchMetadataHelpers.c -o ${OBJ_DIR}/starchMetadataHelpers.o ${INCLUDES}
-	$(CXX) -x c++ -mmacosx-version-min=${MIN_OSX_VERSION} -arch ${ARCH} -c ${BLDFLAGS} ${LIB3}/unstarchHelpers.c -o ${OBJ_DIR}/unstarchHelpers.o ${INCLUDES}
-	$(CXX) -x c++ -mmacosx-version-min=${MIN_OSX_VERSION} -arch ${ARCH} -c ${BLDFLAGS} ${LIB3}/starchSha1Digest.c -o  ${OBJ_DIR}/starchSha1Digest.o ${INCLUDES}
-	$(CXX) -x c++ -mmacosx-version-min=${MIN_OSX_VERSION} -arch ${ARCH} -c ${BLDFLAGS} ${LIB3}/starchBase64Coding.c -o  ${OBJ_DIR}/starchBase64Coding.o ${INCLUDES}
-	${CXX} -mmacosx-version-min=${MIN_OSX_VERSION} -arch ${ARCH} -c ${BLDFLAGS} SortDetails.cpp -o ${OBJ_DIR}/SortDetails.o -I${HEAD} 
-	${CXX} -mmacosx-version-min=${MIN_OSX_VERSION} -arch ${ARCH} -c ${BLDFLAGS} Sort.cpp -o ${OBJ_DIR}/Sort.o -I${HEAD}
-	${CXX} -mmacosx-version-min=${MIN_OSX_VERSION} -arch ${ARCH} -c ${BLDFLAGS} CheckSort.cpp -o ${OBJ_DIR}/CheckSort.o ${INCLUDES}
+	$(CXX) -x c++ -mmacosx-version-min=${MIN_OSX_VERSION} -arch ${ARCH} -c ${BLDFLAGS} ${TFLAG} ${MEGAFLAGS} ${LIB3}/starchConstants.c -o ${OBJ_DIR}/starchConstants.o ${INCLUDES}
+	$(CXX) -x c++ -mmacosx-version-min=${MIN_OSX_VERSION} -arch ${ARCH} -c ${BLDFLAGS} ${TFLAG} ${MEGAFLAGS} ${LIB3}/starchFileHelpers.c -o ${OBJ_DIR}/starchFileHelpers.o ${INCLUDES}
+	$(CXX) -x c++ -mmacosx-version-min=${MIN_OSX_VERSION} -arch ${ARCH} -c ${BLDFLAGS} ${TFLAG} ${MEGAFLAGS} ${LIB3}/starchHelpers.c -o ${OBJ_DIR}/starchHelpers.o -iquote${HEAD} ${INCLUDES}
+	$(CXX) -x c++ -mmacosx-version-min=${MIN_OSX_VERSION} -arch ${ARCH} -c ${BLDFLAGS} ${TFLAG} ${MEGAFLAGS} ${LIB3}/starchMetadataHelpers.c -o ${OBJ_DIR}/starchMetadataHelpers.o ${INCLUDES}
+	$(CXX) -x c++ -mmacosx-version-min=${MIN_OSX_VERSION} -arch ${ARCH} -c ${BLDFLAGS} ${TFLAG} ${MEGAFLAGS} ${LIB3}/unstarchHelpers.c -o ${OBJ_DIR}/unstarchHelpers.o ${INCLUDES}
+	$(CXX) -x c++ -mmacosx-version-min=${MIN_OSX_VERSION} -arch ${ARCH} -c ${BLDFLAGS} ${TFLAG} ${MEGAFLAGS} ${LIB3}/starchSha1Digest.c -o  ${OBJ_DIR}/starchSha1Digest.o ${INCLUDES}
+	$(CXX) -x c++ -mmacosx-version-min=${MIN_OSX_VERSION} -arch ${ARCH} -c ${BLDFLAGS} ${TFLAG} ${MEGAFLAGS} ${LIB3}/starchBase64Coding.c -o  ${OBJ_DIR}/starchBase64Coding.o ${INCLUDES}
+	${CXX} -mmacosx-version-min=${MIN_OSX_VERSION} -arch ${ARCH} -c ${BLDFLAGS} ${TFLAG} ${MEGAFLAGS} SortDetails.cpp -o ${OBJ_DIR}/SortDetails.o -I${HEAD} 
+	${CXX} -mmacosx-version-min=${MIN_OSX_VERSION} -arch ${ARCH} -c ${BLDFLAGS} ${TFLAG} ${MEGAFLAGS} Sort.cpp -o ${OBJ_DIR}/Sort.o -I${HEAD}
+	${CXX} -mmacosx-version-min=${MIN_OSX_VERSION} -arch ${ARCH} -c ${BLDFLAGS} ${TFLAG} ${MEGAFLAGS} CheckSort.cpp -o ${OBJ_DIR}/CheckSort.o ${INCLUDES}
 
-build_debug: prep
-	$(CXX) -x c++ -mmacosx-version-min=${MIN_OSX_VERSION} -arch ${ARCH} -g -O0 -std=c++11 -stdlib=libc++ -c ${LIB3}/starchConstants.c -o ${OBJ_DIR}/starchConstants.o ${INCLUDES}
-	$(CXX) -x c++ -mmacosx-version-min=${MIN_OSX_VERSION} -arch ${ARCH} -g -O0 -std=c++11 -stdlib=libc++ -c ${LIB3}/starchFileHelpers.c -o ${OBJ_DIR}/starchFileHelpers.o ${INCLUDES}
-	$(CXX) -x c++ -mmacosx-version-min=${MIN_OSX_VERSION} -arch ${ARCH} -g -O0 -std=c++11 -stdlib=libc++ -c ${LIB3}/starchHelpers.c -o ${OBJ_DIR}/starchHelpers.o -iquote${HEAD} ${INCLUDES}
-	$(CXX) -x c++ -mmacosx-version-min=${MIN_OSX_VERSION} -arch ${ARCH} -g -O0 -std=c++11 -stdlib=libc++ -c ${LIB3}/starchMetadataHelpers.c -o ${OBJ_DIR}/starchMetadataHelpers.o ${INCLUDES}
-	$(CXX) -x c++ -mmacosx-version-min=${MIN_OSX_VERSION} -arch ${ARCH} -g -O0 -std=c++11 -stdlib=libc++ -c ${LIB3}/unstarchHelpers.c -o ${OBJ_DIR}/unstarchHelpers.o ${INCLUDES}
-	$(CXX) -x c++ -mmacosx-version-min=${MIN_OSX_VERSION} -arch ${ARCH} -g -O0 -std=c++11 -stdlib=libc++ -c ${LIB3}/starchSha1Digest.c -o  ${OBJ_DIR}/starchSha1Digest.o ${INCLUDES}
-	$(CXX) -x c++ -mmacosx-version-min=${MIN_OSX_VERSION} -arch ${ARCH} -g -O0 -std=c++11 -stdlib=libc++ -c ${LIB3}/starchBase64Coding.c -o  ${OBJ_DIR}/starchBase64Coding.o ${INCLUDES}
-	${CXX} -mmacosx-version-min=${MIN_OSX_VERSION} -arch ${ARCH} -g -O0 -std=c++11 -stdlib=libc++ -c SortDetails.cpp -o ${OBJ_DIR}/SortDetails.o -I${HEAD}
-	${CXX} -mmacosx-version-min=${MIN_OSX_VERSION} -arch ${ARCH} -g -O0 -std=c++11 -stdlib=libc++ -c Sort.cpp -o ${OBJ_DIR}/Sort.o -I${HEAD}
-	${CXX} -mmacosx-version-min=${MIN_OSX_VERSION} -arch ${ARCH} -g -O0 -std=c++11 -stdlib=libc++ -c CheckSort.cpp -o ${OBJ_DIR}/CheckSort.o ${INCLUDES}
-	${CXX} -o ${DIST_DIR}/debug.${PROG}_${ARCH} ${LIBLOCATION} ${INCLUDES} -mmacosx-version-min=${MIN_OSX_VERSION} -arch ${ARCH} -g -lc++ ${STARCHOBJS} ${OBJ_DIR}/SortDetails.o ${OBJ_DIR}/Sort.o ${OBJ_DIR}/CheckSort.o ${LIBRARIES}
+build_debug: prep check-cp
+	$(CXX) -x c++ -mmacosx-version-min=${MIN_OSX_VERSION} -arch ${ARCH} ${TFLAG} ${MEGAFLAGS} -g -O0 -std=c++11 -stdlib=libc++ -c ${LIB3}/starchConstants.c -o ${OBJ_DIR}/starchConstants.o ${INCLUDES}
+	$(CXX) -x c++ -mmacosx-version-min=${MIN_OSX_VERSION} -arch ${ARCH} ${TFLAG} ${MEGAFLAGS} -g -O0 -std=c++11 -stdlib=libc++ -c ${LIB3}/starchFileHelpers.c -o ${OBJ_DIR}/starchFileHelpers.o ${INCLUDES}
+	$(CXX) -x c++ -mmacosx-version-min=${MIN_OSX_VERSION} -arch ${ARCH} ${TFLAG} ${MEGAFLAGS} -g -O0 -std=c++11 -stdlib=libc++ -c ${LIB3}/starchHelpers.c -o ${OBJ_DIR}/starchHelpers.o -iquote${HEAD} ${INCLUDES}
+	$(CXX) -x c++ -mmacosx-version-min=${MIN_OSX_VERSION} -arch ${ARCH} ${TFLAG} ${MEGAFLAGS} -g -O0 -std=c++11 -stdlib=libc++ -c ${LIB3}/starchMetadataHelpers.c -o ${OBJ_DIR}/starchMetadataHelpers.o ${INCLUDES}
+	$(CXX) -x c++ -mmacosx-version-min=${MIN_OSX_VERSION} -arch ${ARCH} ${TFLAG} ${MEGAFLAGS} -g -O0 -std=c++11 -stdlib=libc++ -c ${LIB3}/unstarchHelpers.c -o ${OBJ_DIR}/unstarchHelpers.o ${INCLUDES}
+	$(CXX) -x c++ -mmacosx-version-min=${MIN_OSX_VERSION} -arch ${ARCH} ${TFLAG} ${MEGAFLAGS} -g -O0 -std=c++11 -stdlib=libc++ -c ${LIB3}/starchSha1Digest.c -o  ${OBJ_DIR}/starchSha1Digest.o ${INCLUDES}
+	$(CXX) -x c++ -mmacosx-version-min=${MIN_OSX_VERSION} -arch ${ARCH} ${TFLAG} ${MEGAFLAGS} -g -O0 -std=c++11 -stdlib=libc++ -c ${LIB3}/starchBase64Coding.c -o  ${OBJ_DIR}/starchBase64Coding.o ${INCLUDES}
+	${CXX} -mmacosx-version-min=${MIN_OSX_VERSION} -arch ${ARCH} ${TFLAG} ${MEGAFLAGS} -g -O0 -std=c++11 -stdlib=libc++ -c SortDetails.cpp -o ${OBJ_DIR}/SortDetails.o -I${HEAD}
+	${CXX} -mmacosx-version-min=${MIN_OSX_VERSION} -arch ${ARCH} ${TFLAG} ${MEGAFLAGS} -g -O0 -std=c++11 -stdlib=libc++ -c Sort.cpp -o ${OBJ_DIR}/Sort.o -I${HEAD}
+	${CXX} -mmacosx-version-min=${MIN_OSX_VERSION} -arch ${ARCH} ${TFLAG} ${MEGAFLAGS} -g -O0 -std=c++11 -stdlib=libc++ -c CheckSort.cpp -o ${OBJ_DIR}/CheckSort.o ${INCLUDES}
+	${CXX} -o ${DIST_DIR}/debug.${PROG} ${TFLAG} ${MEGAFLAGS} ${LIBLOCATION} ${INCLUDES} -mmacosx-version-min=${MIN_OSX_VERSION} -arch ${ARCH} -g -lc++ ${STARCHOBJS} ${OBJ_DIR}/SortDetails.o ${OBJ_DIR}/Sort.o ${OBJ_DIR}/CheckSort.o ${LIBRARIES}
 
-build_gprof: prep
-	$(CXX) -x c++ -mmacosx-version-min=${MIN_OSX_VERSION} -arch ${ARCH} -pg -O -std=c++11 -stdlib=libc++ -c ${LIB3}/starchConstants.c -o ${OBJ_DIR}/starchConstants.o ${INCLUDES}
-	$(CXX) -x c++ -mmacosx-version-min=${MIN_OSX_VERSION} -arch ${ARCH} -pg -O -std=c++11 -stdlib=libc++ -c ${LIB3}/starchFileHelpers.c -o ${OBJ_DIR}/starchFileHelpers.o ${INCLUDES}
-	$(CXX) -x c++ -mmacosx-version-min=${MIN_OSX_VERSION} -arch ${ARCH} -pg -O -std=c++11 -stdlib=libc++ -c ${LIB3}/starchHelpers.c -o ${OBJ_DIR}/starchHelpers.o -iquote${HEAD} ${INCLUDES}
-	$(CXX) -x c++ -mmacosx-version-min=${MIN_OSX_VERSION} -arch ${ARCH} -pg -O -std=c++11 -stdlib=libc++ -c ${LIB3}/starchMetadataHelpers.c -o ${OBJ_DIR}/starchMetadataHelpers.o ${INCLUDES}
-	$(CXX) -x c++ -mmacosx-version-min=${MIN_OSX_VERSION} -arch ${ARCH} -pg -O -std=c++11 -stdlib=libc++ -c ${LIB3}/unstarchHelpers.c -o ${OBJ_DIR}/unstarchHelpers.o ${INCLUDES}
-	$(CXX) -x c++ -mmacosx-version-min=${MIN_OSX_VERSION} -arch ${ARCH} -pg -O -std=c++11 -stdlib=libc++ -c ${LIB3}/starchSha1Digest.c -o  ${OBJ_DIR}/starchSha1Digest.o ${INCLUDES}
-	$(CXX) -x c++ -mmacosx-version-min=${MIN_OSX_VERSION} -arch ${ARCH} -pg -O -std=c++11 -stdlib=libc++ -c ${LIB3}/starchBase64Coding.c -o  ${OBJ_DIR}/starchBase64Coding.o ${INCLUDES}
-	${CXX} -mmacosx-version-min=${MIN_OSX_VERSION} -arch ${ARCH} -pg -O -std=c++11 -stdlib=libc++ -c SortDetails.cpp -o ${OBJ_DIR}/SortDetails.o -I${HEAD}
-	${CXX} -mmacosx-version-min=${MIN_OSX_VERSION} -arch ${ARCH} -pg -O -std=c++11 -stdlib=libc++ -c Sort.cpp -o ${OBJ_DIR}/Sort.o -I${HEAD}
-	${CXX} -mmacosx-version-min=${MIN_OSX_VERSION} -arch ${ARCH} -pg -O -std=c++11 -stdlib=libc++ -c CheckSort.cpp -o ${OBJ_DIR}/CheckSort.o ${INCLUDES}
-	${CXX} -o ${DIST_DIR}/gprof.${PROG}_${ARCH} ${LIBLOCATION} ${INCLUDES} -mmacosx-version-min=${MIN_OSX_VERSION} -arch ${ARCH} -g -lc++ ${STARCHOBJS} ${OBJ_DIR}/SortDetails.o ${OBJ_DIR}/Sort.o ${OBJ_DIR}/CheckSort.o ${LIBRARIES}
+build_gprof: prep check-cp
+	$(CXX) -x c++ -mmacosx-version-min=${MIN_OSX_VERSION} -arch ${ARCH} ${TFLAG} ${MEGAFLAGS} -pg -O -std=c++11 -stdlib=libc++ -c ${LIB3}/starchConstants.c -o ${OBJ_DIR}/starchConstants.o ${INCLUDES}
+	$(CXX) -x c++ -mmacosx-version-min=${MIN_OSX_VERSION} -arch ${ARCH} ${TFLAG} ${MEGAFLAGS} -pg -O -std=c++11 -stdlib=libc++ -c ${LIB3}/starchFileHelpers.c -o ${OBJ_DIR}/starchFileHelpers.o ${INCLUDES}
+	$(CXX) -x c++ -mmacosx-version-min=${MIN_OSX_VERSION} -arch ${ARCH} ${TFLAG} ${MEGAFLAGS} -pg -O -std=c++11 -stdlib=libc++ -c ${LIB3}/starchHelpers.c -o ${OBJ_DIR}/starchHelpers.o -iquote${HEAD} ${INCLUDES}
+	$(CXX) -x c++ -mmacosx-version-min=${MIN_OSX_VERSION} -arch ${ARCH} ${TFLAG} ${MEGAFLAGS} -pg -O -std=c++11 -stdlib=libc++ -c ${LIB3}/starchMetadataHelpers.c -o ${OBJ_DIR}/starchMetadataHelpers.o ${INCLUDES}
+	$(CXX) -x c++ -mmacosx-version-min=${MIN_OSX_VERSION} -arch ${ARCH} ${TFLAG} ${MEGAFLAGS} -pg -O -std=c++11 -stdlib=libc++ -c ${LIB3}/unstarchHelpers.c -o ${OBJ_DIR}/unstarchHelpers.o ${INCLUDES}
+	$(CXX) -x c++ -mmacosx-version-min=${MIN_OSX_VERSION} -arch ${ARCH} ${TFLAG} ${MEGAFLAGS} -pg -O -std=c++11 -stdlib=libc++ -c ${LIB3}/starchSha1Digest.c -o  ${OBJ_DIR}/starchSha1Digest.o ${INCLUDES}
+	$(CXX) -x c++ -mmacosx-version-min=${MIN_OSX_VERSION} -arch ${ARCH} ${TFLAG} ${MEGAFLAGS}-pg -O -std=c++11 -stdlib=libc++ -c ${LIB3}/starchBase64Coding.c -o  ${OBJ_DIR}/starchBase64Coding.o ${INCLUDES}
+	${CXX} -mmacosx-version-min=${MIN_OSX_VERSION} -arch ${ARCH} -pg -O ${TFLAG} ${MEGAFLAGS} -std=c++11 -stdlib=libc++ -c SortDetails.cpp -o ${OBJ_DIR}/SortDetails.o -I${HEAD}
+	${CXX} -mmacosx-version-min=${MIN_OSX_VERSION} -arch ${ARCH} -pg -O ${TFLAG} ${MEGAFLAGS} -std=c++11 -stdlib=libc++ -c Sort.cpp -o ${OBJ_DIR}/Sort.o -I${HEAD}
+	${CXX} -mmacosx-version-min=${MIN_OSX_VERSION} -arch ${ARCH} -pg -O ${TFLAG} ${MEGAFLAGS} -std=c++11 -stdlib=libc++ -c CheckSort.cpp -o ${OBJ_DIR}/CheckSort.o ${INCLUDES}
+	${CXX} -o ${DIST_DIR}/gprof.${PROG}_${ARCH} ${LIBLOCATION} ${INCLUDES} ${TFLAG} ${MEGAFLAGS} -mmacosx-version-min=${MIN_OSX_VERSION} -arch ${ARCH} -g -lc++ ${STARCHOBJS} ${OBJ_DIR}/SortDetails.o ${OBJ_DIR}/Sort.o ${OBJ_DIR}/CheckSort.o ${LIBRARIES}
 
 prep:
 	rm -rf ${OBJ_DIR}
 	mkdir -p ${OBJ_DIR}
 
 clean:
-	rm -rf ${OBJ_DIR}*
-	rm -rf ${DIST_DIR}/${PROG}*
-	rm -rf ${DIST_DIR}/*.${PROG}*
+	rm -rf ${OBJ_DIR}
 	rm -rf ${DIST_DIR}
diff --git a/applications/bed/sort-bed/src/Sort.cpp b/applications/bed/sort-bed/src/Sort.cpp
index 5fb4805..659d3f3 100644
--- a/applications/bed/sort-bed/src/Sort.cpp
+++ b/applications/bed/sort-bed/src/Sort.cpp
@@ -39,8 +39,17 @@ using namespace std;
 static const char *name = "sort-bed";
 static const char *authors = "Scott Kuehn";
 static const char *usage = "\nUSAGE: sort-bed [--help] [--version] [--check-sort] [--max-mem <val>] [--tmpdir <path>] <file1.bed> <file2.bed> <...>\n        Sort BED file(s).\n        May use '-' to indicate stdin.\n        Results are sent to stdout.\n\n        <val> for --max-mem may be 8G, 8000M, or 8000000000 to specify 8 GB of memory.\n        --tmpdir is useful only with --max-mem.\n";
+#if BEDOPS_BINARY_TYPE == 0
+static const char *application_type = "typical";
+#else
+#if BEDOPS_BINARY_TYPE == 1
+static const char *application_type = "megarow";
+#else
+static const char *application_type = "typical";
+#endif
+#endif
 
-static void 
+static void
 getArgs(int argc, char **argv, const char **inFiles, unsigned int *numInFiles, int *justCheck, double* maxMem, char **tmpPath)
 {
     int numFiles, i, j, stdincnt = 0, changeMem = 0, units = 0, changeTDir = 0;
@@ -51,14 +60,14 @@ getArgs(int argc, char **argv, const char **inFiles, unsigned int *numInFiles, i
     numFiles = argc - 1;
     if(numFiles < 1)
         {
-            fprintf(stderr, "%s\n  citation: %s\n  version:  %s\n  authors:  %s\n%s\n",
-                    name, BEDOPS::citation(), BEDOPS::revision(), authors, usage);
+            fprintf(stderr, "%s\n  citation: %s\n  version:  %s (%s)\n  authors:  %s\n%s\n",
+                    name, BEDOPS::citation(), BEDOPS::revision(), application_type, authors, usage);
             exit(EXIT_FAILURE);
         }
     else if (numFiles > MAX_INFILES)
         {
-            fprintf(stderr, "%s\n  citation: %s\n  version:  %s\n  authors:  %s\n%s\nToo Many Files\n",
-                    name, BEDOPS::citation(), BEDOPS::revision(), authors, usage);
+            fprintf(stderr, "%s\n  citation: %s\n  version:  %s (%s)\n  authors:  %s\n%s\nToo Many Files\n",
+                    name, BEDOPS::citation(), BEDOPS::revision(), application_type, authors, usage);
             exit(EXIT_FAILURE);
         }
     else
@@ -68,14 +77,14 @@ getArgs(int argc, char **argv, const char **inFiles, unsigned int *numInFiles, i
                     /* Check for --help */
                     if(strcmp(argv[i], "--help") == 0) 
                         {
-                            fprintf(stdout, "%s\n  citation: %s\n  version:  %s\n  authors:  %s\n%s\n",
-                                    name, BEDOPS::citation(), BEDOPS::revision(), authors, usage);
+                            fprintf(stdout, "%s\n  citation: %s\n  version:  %s (%s)\n  authors:  %s\n%s\n",
+                                    name, BEDOPS::citation(), BEDOPS::revision(), application_type, authors, usage);
                             exit(EXIT_SUCCESS);
                         }
                     else if (strcmp(argv[i], "--version") == 0)
                         {
-                            fprintf(stdout, "%s\n  citation: %s\n  version:  %s\n  authors:  %s\n",
-                                    name, BEDOPS::citation(), BEDOPS::revision(), authors);
+                            fprintf(stdout, "%s\n  citation: %s\n  version:  %s (%s)\n  authors:  %s\n",
+                                    name, BEDOPS::citation(), BEDOPS::revision(), application_type, authors);
                             exit(EXIT_SUCCESS);
                         }
                     /* Check for max memory before merge-sort */
@@ -183,8 +192,8 @@ getArgs(int argc, char **argv, const char **inFiles, unsigned int *numInFiles, i
         }
     else if(numFiles < 1) /* can be different from before if --max-mem was used, for example*/
         {
-            fprintf(stderr, "%s\n  citation: %s\n  version:  %s\n  authors:  %s\n%s\n%s\n",
-                    name, BEDOPS::citation(), BEDOPS::revision(), authors, usage, "No file given.");
+            fprintf(stderr, "%s\n  citation: %s\n  version:  %s (%s)\n  authors:  %s\n%s\n%s\n",
+                    name, BEDOPS::citation(), BEDOPS::revision(), application_type, authors, usage, "No file given.");
             exit(EXIT_FAILURE);
         }
     return;
@@ -222,7 +231,7 @@ main(int argc, char **argv)
                 {
                     tmpPath = getenv("TMPDIR");
                 }
-        
+
             // sort
             rval = processData(inFiles, numInFiles, maxMemory, tmpPath);
 
diff --git a/applications/bed/sort-bed/src/SortDetails.cpp b/applications/bed/sort-bed/src/SortDetails.cpp
index 18fb94b..0766ff5 100644
--- a/applications/bed/sort-bed/src/SortDetails.cpp
+++ b/applications/bed/sort-bed/src/SortDetails.cpp
@@ -357,7 +357,7 @@ appendChromBedEntry(ChromBedData *chrom, Bed::SignedCoordType startPos, Bed::Sig
 }
 
 int
-checkfiles(const char **bedFileNames, unsigned int numFiles)
+checkFiles(const char **bedFileNames, unsigned int numFiles)
 {
     FILE* bedFile;
     int notStdin = 0, stdinCount = 0;
@@ -450,9 +450,9 @@ mergeSort(FILE* output, FILE **tmpFiles, unsigned int numFiles)
                             else if(0 == val)
                                 {
                                     if(starts[i] < starts[currMin])
-                                        currMin = static_cast<int>(i);
+                                        currMin = static_cast<int>(i), currRest = rests[i];
                                     else if(starts[i] == starts[currMin] && ends[i] < ends[currMin])
-                                        currMin = static_cast<int>(i);
+                                        currMin = static_cast<int>(i), currRest = rests[i];
                                     else if(starts[i] == starts[currMin] && ends[i] == ends[currMin])
                                         {
                                             if (currRest == NULL)
@@ -574,7 +574,7 @@ processData(char const **bedFileNames, unsigned int numFiles, const double maxMe
     chromBuf[0] = '\0';
 
     /* check input files */
-    if(0 != checkfiles(bedFileNames, numFiles))
+    if(0 != checkFiles(bedFileNames, numFiles))
         {
             return EXIT_FAILURE;
         }
diff --git a/applications/bed/sort-bed/src/Structures.hpp b/applications/bed/sort-bed/src/Structures.hpp
index 7d6c1f2..8cf8398 100644
--- a/applications/bed/sort-bed/src/Structures.hpp
+++ b/applications/bed/sort-bed/src/Structures.hpp
@@ -98,9 +98,6 @@ typedef struct {
 
 /* Function Prototypes */
 int
-checkfiles(const char **bedFileNames, unsigned int numFiles);
-
-int
 checkSort(char const **bedFileNames, unsigned int numFiles);
 
 int
diff --git a/applications/bed/sort-bed/src/update-sort-bed-migrate-candidates.py b/applications/bed/sort-bed/src/update-sort-bed-migrate-candidates.py
index 9b1ad28..33db1d5 100755
--- a/applications/bed/sort-bed/src/update-sort-bed-migrate-candidates.py
+++ b/applications/bed/sort-bed/src/update-sort-bed-migrate-candidates.py
@@ -32,7 +32,7 @@ import logging
 name = "update-sort-bed-migrate-candidates"
 citation = "  citation: http://bioinformatics.oxfordjournals.org/content/28/14/1919.abstract"
 authors = "  authors:  Alex Reynolds and Shane Neph"
-version = "  version:  2.4.26"
+version = "  version:  2.4.28"
 usage = """  $ update-sort-bed-migrate-candidates [ --dry-run ] [ --debug ]
                                        [ --write-list |
                                          --resort-immediately |
diff --git a/applications/bed/sort-bed/src/update-sort-bed-slurm.py b/applications/bed/sort-bed/src/update-sort-bed-slurm.py
index cb92e17..f1403c8 100755
--- a/applications/bed/sort-bed/src/update-sort-bed-slurm.py
+++ b/applications/bed/sort-bed/src/update-sort-bed-slurm.py
@@ -33,7 +33,7 @@ import logging
 name = "update-sort-bed-slurm"
 citation = "  citation: http://bioinformatics.oxfordjournals.org/content/28/14/1919.abstract"
 authors = "  authors:  Alex Reynolds and Shane Neph"
-version = "  version:  2.4.26"
+version = "  version:  2.4.28"
 usage = """  $ update-sort-bed-slurm [ --slurm-memory <MB> ] 
                           [ --slurm-partition <SLURM partition> ] 
                           [ --slurm-workdir <working directory> ]
diff --git a/applications/bed/sort-bed/src/update-sort-bed-starch-slurm.py b/applications/bed/sort-bed/src/update-sort-bed-starch-slurm.py
index 038a858..d2ce7fd 100755
--- a/applications/bed/sort-bed/src/update-sort-bed-starch-slurm.py
+++ b/applications/bed/sort-bed/src/update-sort-bed-starch-slurm.py
@@ -33,7 +33,7 @@ import logging
 name = "update-sort-bed-starch-slurm"
 citation = "  citation: http://bioinformatics.oxfordjournals.org/content/28/14/1919.abstract"
 authors = "  authors:  Alex Reynolds and Shane Neph"
-version = "  version:  2.4.26"
+version = "  version:  2.4.28"
 usage = """  $ update-sort-bed-starch-slurm [ --slurm-memory <MB> ] 
                                  [ --slurm-partition <SLURM partition> ] 
                                  [ --slurm-workdir <working directory> ]
@@ -288,7 +288,7 @@ def main():
             '--partition',
             slurm_partition,
             '--wrap',
-            '"srun ' + unstarch_path + ' ' + chromosome + ' ' + args.input_fn + ' | ' + sort_bed_path + ' - | ' + starch_path + ' - > ' + temp_dest + '"'
+            '"srun ' + unstarch_path + ' ' + chromosome + ' ' + args.input_original_fn + ' | ' + sort_bed_path + ' - | ' + starch_path + ' - > ' + temp_dest + '"'
         ]
         if logger: logger.info('Submitting job via [%s]' % (' '.join(per_chromosome_sort_cmd_components)))
         try:
diff --git a/applications/bed/starch/src/Makefile b/applications/bed/starch/src/Makefile
index fc81548..6f930ca 100644
--- a/applications/bed/starch/src/Makefile
+++ b/applications/bed/starch/src/Makefile
@@ -5,9 +5,9 @@ MAINAPPDIR                = ../..
 PARTY3                    = $(HEAD)/third-party
 BINDIR                    = ../bin
 THISDIR                   = ${shell pwd}
-LIBSTARCH                 = libstarch.a
-LIBSTARCHDEBUG            = libstarch_debug.a
-LIBSTARCHGPROF            = libstarch_gprof.a
+LIBSTARCH                 = libstarch${POSTFIX}.a
+LIBSTARCHDEBUG            = libstarch_debug${POSTFIX}.a
+LIBSTARCHGPROF            = libstarch_gprof${POSTFIX}.a
 LIBJANSSON                = libjansson.a
 LIBBZIP2                  = libbz2.a
 LIBZLIB                   = libz.a
@@ -28,63 +28,80 @@ LOCALZLIBLIBDIR           = ${LOCALZLIBDIR}
 LOCALZLIBLIB              = ${LOCALZLIBLIBDIR}/${LIBZLIB}
 LOCALZLIBINCDIR           = ${LOCALZLIBDIR}
 OBJDIR                    = ${INTERFACES}/src/data/starch
-LOCALOBJDIR               = objects
+LOCALOBJDIR               = objects${POSTFIX}
 INCLUDES                  = -iquote${MAIN} -iquote${HEAD} -iquote${PARTY3} -I${LOCALJANSSONINCDIR} -I${LOCALBZIP2INCDIR} -I${LOCALZLIBINCDIR}
 LIBRARIES                 = ${LOCALJANSSONLIB} ${LOCALBZIP2LIB} ${LOCALZLIBLIB}
-ARCH_VERSION              = v2.1
-BIN_VERSION               = v2.4.16
+ARCH_VERSION              = v2.2
+BIN_VERSION               = v2.4.27
 TEST                      = ../test
 TEST_LINUX_BINDIR         = ${TEST}/binaries/linux/${ARCH_VERSION}/bin
 TEST_OSX_BINDIR           = ${TEST}/binaries/osx/${ARCH_VERSION}/bin
 AR                        = ar
 SFLAGS                    = -static
 CXXFLAGS                  = -D__STDC_CONSTANT_MACROS -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE=1 -DUSE_ZLIB -DUSE_BZLIB -O2 -Wformat -Wall -Wextra -Wswitch-enum -std=c++11 ${SFLAGS} -s
-CXXDFLAGS                 = -D__STDC_CONSTANT_MACROS -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE=1 -DUSE_ZLIB -DUSE_BZLIB -O0 -g -Wformat -Wall -Wextra -Wswitch-enum -std=c++11 -DDEBUG_VERBOSE=1 ${SFLAGS}
-CXXGFLAGS                 = -D__STDC_CONSTANT_MACROS -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE=1 -DUSE_ZLIB -DUSE_BZLIB -O -Wformat -Wall -Wextra -Wswitch-enum -std=c++11 -DDEBUG_VERBOSE=1 ${SFLAGS} -pg
+CXXDFLAGS                 = -D__STDC_CONSTANT_MACROS -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE=1 -DUSE_ZLIB -DUSE_BZLIB -O0 -g -Wformat -Wall -Wextra -Wswitch-enum -std=c++11 -DDEBUG_VERBOSE=1 ${SFLAGS} -DDEBUG=1
+CXXGFLAGS                 = -D__STDC_CONSTANT_MACROS -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE=1 -DUSE_ZLIB -DUSE_BZLIB -O -Wformat -Wall -Wextra -Wswitch-enum -std=c++11 -DDEBUG_VERBOSE=1 ${SFLAGS} -DDEBUG=1 -pg
 
 STARCH_NAMES              = starchConstants unstarchHelpers starchHelpers starchMetadataHelpers starchFileHelpers starchSha1Digest starchBase64Coding
 STARCH_OBJECTS            = $(addprefix $(LOCALOBJDIR)/, $(addsuffix .o, $(STARCH_NAMES)))
 
+ifeq ($(BINARY_TYPE),)
+	TFLAG = -DBEDOPS_BINARY_TYPE=0
+else
+	TFLAG = -DBEDOPS_BINARY_TYPE=$(BINARY_TYPE_NUM)
+endif
+
 .PHONY: starchcluster starch unstarch starchcat build build_debug build_gprof starch-diff starchstrip
 
 build: starch unstarch starchcat starchcluster starch-diff starchstrip
+	rm -rf ${LOCALOBJDIR}
 build_debug: $(BINDIR)/debug.starch $(BINDIR)/debug.unstarch $(BINDIR)/debug.starchcat $(BINDIR)/debug.starchstrip
+	rm -rf ${LOCALOBJDIR}
 build_gprof: $(BINDIR)/gprof.starch $(BINDIR)/gprof.unstarch $(BINDIR)/gprof.starchcat $(BINDIR)/gprof.starchstrip
+	rm -rf ${LOCALOBJDIR}
 
 # Cancel implicit compilation rules
 % : %.o
 % : %.c
 
-starch: $(BINDIR)/starch
-unstarch: $(BINDIR)/unstarch
-starchcat: $(BINDIR)/starchcat
-starchcluster: $(BINDIR)/starchcluster_gnuParallel $(BINDIR)/starchcluster_sge $(BINDIR)/starchcluster_slurm
-starch-diff: $(BINDIR)/starch-diff
-starchstrip: $(BINDIR)/starchstrip
+starch: $(BINDIR)/starch-$(BINARY_TYPE)
+unstarch: $(BINDIR)/unstarch-$(BINARY_TYPE)
+starchcat: $(BINDIR)/starchcat-$(BINARY_TYPE)
+starchcluster: $(BINDIR)/starchcluster_gnuParallel-$(BINARY_TYPE) $(BINDIR)/starchcluster_sge-$(BINARY_TYPE) $(BINDIR)/starchcluster_slurm-$(BINARY_TYPE)
+starch-diff: $(BINDIR)/starch-diff-$(BINARY_TYPE)
+starchstrip: $(BINDIR)/starchstrip-$(BINARY_TYPE)
 
-$(BINDIR)/% : %.c $(LOCALSTARCHLIB) $(LIBRARIES)
+$(BINDIR)/%-$(BINARY_TYPE) : %.c $(LOCALSTARCHLIB) $(LIBRARIES)
 	mkdir -p $(BINDIR)
-	${CXX} ${CXXFLAGS} -c $*.c -o $(LOCALOBJDIR)/$*.o ${INCLUDES}
-	${CXX} ${CXXFLAGS} $(LOCALOBJDIR)/$*.o -o $@ ${LOCALSTARCHLIB} ${LIBRARIES}
+	${CXX} ${CXXFLAGS} ${TFLAG} ${MEGAFLAGS} -c $*.c -o $(LOCALOBJDIR)/$*.o ${INCLUDES}
+	${CXX} ${CXXFLAGS} ${TFLAG} ${MEGAFLAGS} $(LOCALOBJDIR)/$*.o -o $@ ${LOCALSTARCHLIB} ${LIBRARIES}
 
 $(BINDIR)/debug.% : %.c $(LOCALSTARCHLIB) $(LIBRARIES)
 	mkdir -p $(BINDIR)
-	${CXX} ${CXXDFLAGS} -c $*.c -o $(LOCALOBJDIR)/$*.o ${INCLUDES}
-	${CXX} ${CXXDFLAGS} $(LOCALOBJDIR)/$*.o -o $@ ${LOCALSTARCHLIB} ${LIBRARIES}
+	${CXX} ${CXXDFLAGS} ${TFLAG} ${MEGAFLAGS} -c $*.c -o $(LOCALOBJDIR)/$*.o ${INCLUDES}
+	${CXX} ${CXXDFLAGS} ${TFLAG} ${MEGAFLAGS} $(LOCALOBJDIR)/$*.o -o $@ ${LOCALSTARCHLIB} ${LIBRARIES}
 
 $(BINDIR)/gprof.% : %.c $(LOCALSTARCHLIB) $(LIBRARIES)
 	mkdir -p $(BINDIR)
-	${CXX} ${CXXGFLAGS} -c $*.c -o $(LOCALOBJDIR)/$*.o ${INCLUDES}
-	${CXX} ${CXXGFLAGS} $(LOCALOBJDIR)/$*.o -o $@ ${LOCALSTARCHLIB} ${LIBRARIES}
+	${CXX} ${CXXGFLAGS} ${TFLAG} ${MEGAFLAGS} -c $*.c -o $(LOCALOBJDIR)/$*.o ${INCLUDES}
+	${CXX} ${CXXGFLAGS} ${TFLAG} ${MEGAFLAGS} $(LOCALOBJDIR)/$*.o -o $@ ${LOCALSTARCHLIB} ${LIBRARIES}
 
 $(BINDIR)/% : %.tcsh
 	mkdir -p $(BINDIR)
 	cp $< $@
 
+$(BINDIR)/%-$(BINARY_TYPE) : %.tcsh
+	mkdir -p $(BINDIR)
+	cp $< $@
+
 $(BINDIR)/% : %.py
 	mkdir -p $(BINDIR)
 	cp $< $@
 
+$(BINDIR)/%-$(BINARY_TYPE) : %.py
+	mkdir -p $(BINDIR)
+	cp $< $@
+
 starchLibrary: $(LOCALSTARCHLIB)
 
 $(LOCALSTARCHLIB) : $(STARCH_OBJECTS)
@@ -93,18 +110,17 @@ $(LOCALSTARCHLIB) : $(STARCH_OBJECTS)
 
 $(LOCALOBJDIR)/%.o : $(OBJDIR)/%.c $(LIBRARIES)
 	mkdir -p $(LOCALOBJDIR)
-	${CXX} ${CXXFLAGS} -c $< -o $@ ${INCLUDES}
+	${CXX} ${CXXFLAGS} ${TFLAG} -c $< -o $@ ${INCLUDES}
 
 test: starch unstarch starchcat
-	cp ${BINDIR}/starch ${TEST_LINUX_BINDIR}/starch
-	cp ${BINDIR}/unstarch ${TEST_LINUX_BINDIR}/unstarch
-	cp ${BINDIR}/starchcat ${TEST_LINUX_BINDIR}/starchcat
+	cp ${BINDIR}/starch-${BINARY_TYPE} ${TEST_LINUX_BINDIR}/starch-${BINARY_TYPE}
+	cp ${BINDIR}/unstarch-${BINARY_TYPE} ${TEST_LINUX_BINDIR}/unstarch-${BINARY_TYPE}
+	cp ${BINDIR}/starchcat-${BINARY_TYPE} ${TEST_LINUX_BINDIR}/starchcat-${BINARY_TYPE}
 	make -C ${TEST} all
 
 clean:
-	rm -f $(LOCALSTARCHLIB)
+	rm -rf $(LOCALSTARCHLIBDIR)
 	rm -f ${LOCALSTARCHLIBDEBUG}
 	rm -f ${LOCALSTARCHLIBGPROF}
-	rm -f ${BINDIR}/*starch*
 	rm -rf ${LOCALOBJDIR}
 	rm -rf ${BINDIR}
diff --git a/applications/bed/starch/src/Makefile.darwin b/applications/bed/starch/src/Makefile.darwin
index eac99a8..24c4496 100644
--- a/applications/bed/starch/src/Makefile.darwin
+++ b/applications/bed/starch/src/Makefile.darwin
@@ -1,5 +1,3 @@
-MIN_OSX_VERSION           = 10.7
-
 MAIN                      = ../../../..
 MAINAPPDIR                = ../..
 INTERFACES                = $(MAIN)/interfaces
@@ -11,7 +9,7 @@ LIBSTARCHDEBUG            = libstarch_debug.a
 LIBJANSSON                = libjansson.a
 LIBBZIP2                  = libbz2.a
 LIBZLIB                   = libz.a
-LOCALSTARCHLIBDIR         = ../lib_${ARCH}
+LOCALSTARCHLIBDIR         = ../lib
 LOCALSTARCHLIB            = ${LOCALSTARCHLIBDIR}/${LIBSTARCH}
 LOCALSTARCHLIBDEBUG       = ${LOCALSTARCHLIBDIR}/${LIBSTARCHDEBUG}
 LOCALJANSSONDIR           = ${PARTY3}/darwin_intel_${ARCH}/jansson
@@ -27,37 +25,44 @@ LOCALZLIBLIBDIR           = ${LOCALZLIBDIR}
 LOCALZLIBLIB              = ${LOCALZLIBLIBDIR}/${LIBZLIB}
 LOCALZLIBINCDIR           = ${LOCALZLIBDIR}
 OBJDIR                    = ${INTERFACES}/src/data/starch
-LOCALOBJDIR               = objects_${ARCH}
+LOCALOBJDIR               = objects_${BINARY_TYPE}
 INCLUDES                  = -iquote${MAIN} -iquote${HEAD} -iquote${PARTY3} -I${LOCALJANSSONINCDIR} -I${LOCALBZIP2INCDIR} -I${LOCALZLIBINCDIR}
 LIBRARIES                 = ${LOCALJANSSONLIB} ${LOCALBZIP2LIB} ${LOCALZLIBLIB}
-BINDIR                    = ../bin_${ARCH}
+BINDIR                    = ../bin
 WARNINGS                  = -Weverything -Wno-c++98-compat-pedantic -Wno-padded
 ARCH_VERSION              = v2.2
-BIN_VERSION               = v2.4.26
+BIN_VERSION               = v2.4.28
 TEST                      = ../test
 TEST_OSX_BINDIR           = ${TEST}/binaries/osx/${ARCH_VERSION}/bin
 
-CFLAGS                    = -D__STDC_CONSTANT_MACROS -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE=1 -DUSE_ZLIB -DUSE_BZLIB -O2 ${WARNINGS} -std=c99 -mmacosx-version-min=$(MIN_OSX_VERSION) -arch ${ARCH} -x c++ -v -stdlib=libc++ -std=c++11
-CXXFLAGS                  = -D__STDC_CONSTANT_MACROS -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE=1 -DUSE_ZLIB -DUSE_BZLIB -O2 ${WARNINGS} -std=c++11 -stdlib=libc++ -mmacosx-version-min=$(MIN_OSX_VERSION) -arch ${ARCH}
-CDFLAGS                   = -D__STDC_CONSTANT_MACROS -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE=1 -DUSE_ZLIB -DUSE_BZLIB -O0 -g ${WARNINGS} -std=c99 -DDEBUG=1 -mmacosx-version-min=$(MIN_OSX_VERSION) -arch ${ARCH} -x c++ -v -stdlib=libc++ -std=c++11
-CXXDFLAGS                 = -D__STDC_CONSTANT_MACROS -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE=1 -DUSE_ZLIB -DUSE_BZLIB -O0 -g ${WARNINGS} -std=c++11 -stdlib=libc++ -DDEBUG=1 -mmacosx-version-min=$(MIN_OSX_VERSION) -arch ${ARCH}
+ifeq ($(BINARY_TYPE),)
+	TFLAG = -DBEDOPS_BINARY_TYPE=0
+else
+	TFLAG = -DBEDOPS_BINARY_TYPE=$(BINARY_TYPE_NUM)
+endif
+
+CCFLAGS                   = ${MEGAFLAGS} ${TFLAG} -D__STDC_CONSTANT_MACROS -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE=1 -DUSE_ZLIB -DUSE_BZLIB -O2 ${WARNINGS} -std=c99 -mmacosx-version-min=$(MIN_OSX_VERSION) -arch ${ARCH} -x c++ -v -stdlib=libc++ -std=c++11
+CXXFLAGS                  = ${MEGAFLAGS} ${TFLAG} -D__STDC_CONSTANT_MACROS -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE=1 -DUSE_ZLIB -DUSE_BZLIB -O2 ${WARNINGS} -std=c++11 -stdlib=libc++ -mmacosx-version-min=$(MIN_OSX_VERSION) -arch ${ARCH}
+CDFLAGS                   = ${MEGAFLAGS} ${TFLAG} -D__STDC_CONSTANT_MACROS -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE=1 -DUSE_ZLIB -DUSE_BZLIB -O0 -g ${WARNINGS} -std=c99 -DDEBUG=1 -mmacosx-version-min=$(MIN_OSX_VERSION) -arch ${ARCH} -x c++ -v -stdlib=libc++ -std=c++11
+CXXDFLAGS                 = ${MEGAFLAGS} ${TFLAG} -D__STDC_CONSTANT_MACROS -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE=1 -DUSE_ZLIB -DUSE_BZLIB -O0 -g ${WARNINGS} -std=c++11 -stdlib=libc++ -DDEBUG=1 -mmacosx-version-min=$(MIN_OSX_VERSION) -arch ${ARCH}
 
 build: dependencies starchLibrary starch unstarch starchcat starchcluster starch-diff starchstrip
 	rm -f *~
+	rm -Rf ${LOCALOBJDIR}
 
 # dependencies-related recipes all have mkdirs prereqs
 #   and pretty much everything else has dependencies-related prereqs at some level
 #   -> let make figure out hierarchy and eliminate mkdir/rm race conditions
 dependencies: mkdirs
-	${CC} ${CFLAGS} -c ${OBJDIR}/starchConstants.c -o ${LOCALOBJDIR}/starchConstants.o ${INCLUDES}
-	${CC} ${CFLAGS} -c ${OBJDIR}/starchMetadataHelpers.c -o  ${LOCALOBJDIR}/starchMetadataHelpers.o ${INCLUDES}
-	${CC} ${CFLAGS} -c ${OBJDIR}/unstarchHelpers.c -o  ${LOCALOBJDIR}/unstarchHelpers.o ${INCLUDES}
-	${CC} ${CFLAGS} -c ${OBJDIR}/starchHelpers.c -o  ${LOCALOBJDIR}/starchHelpers.o ${INCLUDES}
-	${CC} ${CFLAGS} -c ${OBJDIR}/starchFileHelpers.c -o  ${LOCALOBJDIR}/starchFileHelpers.o ${INCLUDES}
-	${CC} ${CFLAGS} -c ${OBJDIR}/starchSha1Digest.c -o  ${LOCALOBJDIR}/starchSha1Digest.o ${INCLUDES}
-	${CC} ${CFLAGS} -c ${OBJDIR}/starchBase64Coding.c -o  ${LOCALOBJDIR}/starchBase64Coding.o ${INCLUDES}
-
-build_debug: dependencies_debug starchLibrary_debug starch_debug unstarch_debug starchcat_debug starchstrip_debug
+	${CC} ${CCFLAGS} -c ${OBJDIR}/starchConstants.c -o ${LOCALOBJDIR}/starchConstants.o ${INCLUDES}
+	${CC} ${CCFLAGS} -c ${OBJDIR}/starchMetadataHelpers.c -o  ${LOCALOBJDIR}/starchMetadataHelpers.o ${INCLUDES}
+	${CC} ${CCFLAGS} -c ${OBJDIR}/unstarchHelpers.c -o  ${LOCALOBJDIR}/unstarchHelpers.o ${INCLUDES}
+	${CC} ${CCFLAGS} -c ${OBJDIR}/starchHelpers.c -o  ${LOCALOBJDIR}/starchHelpers.o ${INCLUDES}
+	${CC} ${CCFLAGS} -c ${OBJDIR}/starchFileHelpers.c -o  ${LOCALOBJDIR}/starchFileHelpers.o ${INCLUDES}
+	${CC} ${CCFLAGS} -c ${OBJDIR}/starchSha1Digest.c -o  ${LOCALOBJDIR}/starchSha1Digest.o ${INCLUDES}
+	${CC} ${CCFLAGS} -c ${OBJDIR}/starchBase64Coding.c -o  ${LOCALOBJDIR}/starchBase64Coding.o ${INCLUDES}
+
+build_debug: dependencies_debug starchLibrary_debug starch_debug unstarch_debug starchcat_debug starchstrip_debug starchcluster starch-diff
 	rm -f *~
 
 dependencies_debug: mkdirs
@@ -76,61 +81,61 @@ starchLibrary_debug: dependencies_debug
 	${AR} rcs ${LOCALSTARCHLIBDEBUG} ${LOCALOBJDIR}/starchConstants.o  ${LOCALOBJDIR}/unstarchHelpers.o  ${LOCALOBJDIR}/starchHelpers.o  ${LOCALOBJDIR}/starchMetadataHelpers.o  ${LOCALOBJDIR}/starchFileHelpers.o ${LOCALOBJDIR}/starchSha1Digest.o ${LOCALOBJDIR}/starchBase64Coding.o
 
 starch: starchLibrary
-	${CC} ${CFLAGS} -c starch.c -o $(LOCALOBJDIR)/starch.o ${INCLUDES}
-	${CXX} ${CXXFLAGS} -lc++ $(LOCALOBJDIR)/starch.o -o ${BINDIR}/starch ${LOCALSTARCHLIB} ${LIBRARIES}
+	${CC} ${CCFLAGS} -c starch.c -o $(LOCALOBJDIR)/starch.o ${INCLUDES}
+	${CXX} ${CXXFLAGS} -lc++ $(LOCALOBJDIR)/starch.o -o ${BINDIR}/starch-${BINARY_TYPE} ${LOCALSTARCHLIB} ${LIBRARIES}
 
 starch_debug: starchLibrary_debug
 	${CC} ${CDFLAGS} -c starch.c -o $(LOCALOBJDIR)/debug.starch.o ${INCLUDES}
-	${CXX} ${CXXDFLAGS} -lc++ $(LOCALOBJDIR)/debug.starch.o -o ${BINDIR}/debug.starch ${LOCALSTARCHLIBDEBUG} ${LIBRARIES}
+	${CXX} ${CXXDFLAGS} -lc++ $(LOCALOBJDIR)/debug.starch.o -o ${BINDIR}/debug.starch-${BINARY_TYPE} ${LOCALSTARCHLIBDEBUG} ${LIBRARIES}
 
 unstarch: starchLibrary
-	${CC} ${CFLAGS} -c unstarch.c -o $(LOCALOBJDIR)/unstarch.o ${INCLUDES}
-	${CXX} ${CXXFLAGS} -lc++ $(LOCALOBJDIR)/unstarch.o -o ${BINDIR}/unstarch ${LOCALSTARCHLIB} ${LIBRARIES}
+	${CC} ${CCFLAGS} -c unstarch.c -o $(LOCALOBJDIR)/unstarch.o ${INCLUDES}
+	${CXX} ${CXXFLAGS} -lc++ $(LOCALOBJDIR)/unstarch.o -o ${BINDIR}/unstarch-${BINARY_TYPE} ${LOCALSTARCHLIB} ${LIBRARIES}
 
 unstarch_debug: starchLibrary_debug
 	${CC} ${CDFLAGS} -c unstarch.c -o $(LOCALOBJDIR)/debug.unstarch.o ${INCLUDES}
-	${CXX} ${CXXDFLAGS} -lc++ $(LOCALOBJDIR)/debug.unstarch.o -o ${BINDIR}/debug.unstarch ${LOCALSTARCHLIBDEBUG} ${LIBRARIES}
+	${CXX} ${CXXDFLAGS} -lc++ $(LOCALOBJDIR)/debug.unstarch.o -o ${BINDIR}/debug.unstarch-${BINARY_TYPE} ${LOCALSTARCHLIBDEBUG} ${LIBRARIES}
 
 starchcluster: starchcat
-	cp starchcluster_sge.tcsh ${BINDIR}/starchcluster_sge
-	cp starchcluster_gnuParallel.tcsh ${BINDIR}/starchcluster_gnuParallel
-	cp starchcluster_slurm.tcsh ${BINDIR}/starchcluster_slurm
+	cp starchcluster_sge.tcsh ${BINDIR}/starchcluster_sge-${BINARY_TYPE}
+	cp starchcluster_gnuParallel.tcsh ${BINDIR}/starchcluster_gnuParallel-${BINARY_TYPE}
+	cp starchcluster_slurm.tcsh ${BINDIR}/starchcluster_slurm-${BINARY_TYPE}
 
 starch-diff: unstarch
-	cp starch-diff.py ${BINDIR}/starch-diff
+	cp starch-diff.py ${BINDIR}/starch-diff-${BINARY_TYPE}
 
 starchcat: starchLibrary
-	${CC} ${CFLAGS} -c starchcat.c -o $(LOCALOBJDIR)/starchcat.o ${INCLUDES}
-	${CXX} ${CXXFLAGS} -lc++ $(LOCALOBJDIR)/starchcat.o -o ${BINDIR}/starchcat ${LOCALSTARCHLIB} ${LIBRARIES}
+	${CC} ${CCFLAGS} -c starchcat.c -o $(LOCALOBJDIR)/starchcat.o ${INCLUDES}
+	${CXX} ${CXXFLAGS} -lc++ $(LOCALOBJDIR)/starchcat.o -o ${BINDIR}/starchcat-${BINARY_TYPE} ${LOCALSTARCHLIB} ${LIBRARIES}
 
 starchcat_debug: starchLibrary_debug
 	${CC} ${CDFLAGS} -c starchcat.c -o $(LOCALOBJDIR)/starchcat.o ${INCLUDES}
-	${CXX} ${CXXDFLAGS} -lc++ $(LOCALOBJDIR)/starchcat.o -o ${BINDIR}/debug.starchcat ${LOCALSTARCHLIBDEBUG} ${LIBRARIES}
+	${CXX} ${CXXDFLAGS} -lc++ $(LOCALOBJDIR)/starchcat.o -o ${BINDIR}/debug.starchcat-${BINARY_TYPE} ${LOCALSTARCHLIBDEBUG} ${LIBRARIES}
 
 starchstrip: starchLibrary
-	${CC} ${CFLAGS} -c starchstrip.c -o $(LOCALOBJDIR)/starchstrip.o ${INCLUDES}
-	${CXX} ${CXXFLAGS} -lc++ $(LOCALOBJDIR)/starchstrip.o -o ${BINDIR}/starchstrip ${LOCALSTARCHLIB} ${LIBRARIES}
+	${CC} ${CCFLAGS} -c starchstrip.c -o $(LOCALOBJDIR)/starchstrip.o ${INCLUDES}
+	${CXX} ${CXXFLAGS} -lc++ $(LOCALOBJDIR)/starchstrip.o -o ${BINDIR}/starchstrip-${BINARY_TYPE} ${LOCALSTARCHLIB} ${LIBRARIES}
 
 starchstrip_debug: starchLibrary_debug
 	${CC} ${CDFLAGS} -c starchstrip.c -o $(LOCALOBJDIR)/debug.starchstrip.o ${INCLUDES}
-	${CXX} ${CXXDFLAGS} -lc++ $(LOCALOBJDIR)/debug.starchstrip.o -o ${BINDIR}/debug.starchstrip ${LOCALSTARCHLIBDEBUG} ${LIBRARIES}
+	${CXX} ${CXXDFLAGS} -lc++ $(LOCALOBJDIR)/debug.starchstrip.o -o ${BINDIR}/debug.starchstrip-${BINARY_TYPE} ${LOCALSTARCHLIBDEBUG} ${LIBRARIES}
 
 test: starch unstarch starchcat
-	cp ${BINDIR}/starch ${TEST_OSX_BINDIR}/starch
-	cp ${BINDIR}/unstarch ${TEST_OSX_BINDIR}/unstarch
-	cp ${BINDIR}/starchcat ${TEST_OSX_BINDIR}/starchcat
+	cp ${BINDIR}/starch-${BINARY_TYPE} ${TEST_OSX_BINDIR}/starch-${BINARY_TYPE}
+	cp ${BINDIR}/unstarch-${BINARY_TYPE} ${TEST_OSX_BINDIR}/unstarch-${BINARY_TYPE}
+	cp ${BINDIR}/starchcat-${BINARY_TYPE} ${TEST_OSX_BINDIR}/starchcat-${BINARY_TYPE}
 	make -C ${TEST} all
 
 mkdirs:
+	rm -rf ${LOCALOBJDIR}
+	rm -rf ${LOCALSTARCHLIBDIR}
 	mkdir -p ${LOCALOBJDIR}
 	mkdir -p ${LOCALSTARCHLIBDIR}
 	mkdir -p ${BINDIR}
 
 clean:
-	rm -f $(LOCALSTARCHLIB)
+	rm -rf $(LOCALSTARCHLIBDIR)
 	rm -f ${LOCALSTARCHLIBDEBUG}
-	rm -Rf ${LOCALOBJDIR}
-	rm -Rf ${LOCALSTARCHLIBDIR}
-	rm -rf ${BINDIR}/*starch*
-	rm -Rf ${BINDIR}
-	rm -Rf ${THISDIR}/../bin
+	rm -rf ${LOCALOBJDIR}
+	rm -rf ${LOCALSTARCHLIBDIR}
+	rm -rf ${BINDIR}
diff --git a/applications/bed/starch/src/starch-diff.py b/applications/bed/starch/src/starch-diff.py
index e989c1f..1c25ecc 100755
--- a/applications/bed/starch/src/starch-diff.py
+++ b/applications/bed/starch/src/starch-diff.py
@@ -32,11 +32,20 @@ import logging
 name = "starch-diff"
 citation = "  citation: http://bioinformatics.oxfordjournals.org/content/28/14/1919.abstract"
 authors = "  authors:  Alex Reynolds and Shane Neph"
-version = "  version:  2.4.26"
+version = "  version:  2.4.28"
 usage = "  $ starch-diff [ --chr <chr> ] starch-file-1 starch-file-2 [ starch-file-3 ... ]"
 help = """
   The 'starch-diff' utility compares the signatures of two or more specified 
   Starch v2.2+ archives for all chromosomes, or for a specified chromosome.
+  
+  The typical output of 'starch-diff' is a message indicating that the 
+  archives' chromosome(s) are identical or dissimilar, written to the standard
+  error stream.
+  
+  In addition, if all chromosomes are identical, 'starch-diff' exits with a 
+  zero status code. Likewise, if any chromosomes are dissimilar, 'starch-diff'
+  exits with a non-zero status code. This facilitates testing in a scripting
+  environment.
 """
 
 default_chromosome = "all"
diff --git a/applications/bed/starch/src/starch.c b/applications/bed/starch/src/starch.c
index 3e793ab..6c904f0 100644
--- a/applications/bed/starch/src/starch.c
+++ b/applications/bed/starch/src/starch.c
@@ -41,7 +41,7 @@ namespace {
 #endif
 
 int
-main (int argc, char **argv)
+main(int argc, char **argv)
 {
 #ifdef DEBUG
     fprintf (stderr, "\n--- starch main() - enter ---\n");
@@ -64,15 +64,15 @@ main (int argc, char **argv)
     parseValue = STARCH_parseCommandLineOptions (argc, argv);
     switch (parseValue) {
         case STARCH_HELP_ERROR: {
-            STARCH_printUsage (STARCH_HELP_ERROR);
+            STARCH_printUsage(STARCH_HELP_ERROR);
             return EXIT_SUCCESS;
         }
         case STARCH_VERSION_ERROR: {
-            STARCH_printRevision ();
+            STARCH_printRevision();
             return EXIT_SUCCESS;
         }
         case STARCH_FATAL_ERROR: {
-            STARCH_printUsage (STARCH_FATAL_ERROR);
+            STARCH_printUsage(STARCH_FATAL_ERROR);
             return EXIT_FAILURE;
         }
     }
@@ -205,21 +205,27 @@ main (int argc, char **argv)
         }
 #endif
     }
-    
+
     else if (STARCH_MAJOR_VERSION > 2) {
         fprintf (stderr, "ERROR: Starch does not yet support making archives in this major version release (built as: %d.%d.%d)\n", STARCH_MAJOR_VERSION, STARCH_MINOR_VERSION, STARCH_REVISION_VERSION); // this condition is preserved in case of test-builds of future-proofed Starch binaries
         exit (EXIT_FAILURE);
     }
 
     /* cleanup */
-    if (bedFnPtr != NULL)
-        fclose (bedFnPtr), bedFnPtr = NULL;
+    if (bedFnPtr != NULL) {
+        fclose (bedFnPtr);
+        bedFnPtr = NULL;
+    }
     if (metadata != NULL)
         STARCH_freeMetadata (&metadata);
-    if (starchHeader)
-        free (starchHeader), starchHeader = NULL;
-    if (starch_client_global_args.uniqueTag)
-        free (starch_client_global_args.uniqueTag), starch_client_global_args.uniqueTag = NULL;
+    if (starchHeader) {
+        free (starchHeader);
+        starchHeader = NULL;
+    }
+    if (starch_client_global_args.uniqueTag) {
+        free (starch_client_global_args.uniqueTag);
+        starch_client_global_args.uniqueTag = NULL;
+    }
 
 #ifdef DEBUG
     fprintf (stderr, "\n--- starch main() - exit ---\n");
@@ -233,7 +239,7 @@ namespace starch {
 #endif
 
 void
-STARCH_initializeGlobals ()
+STARCH_initializeGlobals()
 {
 #ifdef DEBUG
     fprintf (stderr, "\n--- STARCH_initializeGlobals() ---\n");
@@ -251,7 +257,7 @@ STARCH_initializeGlobals ()
 }
 
 int
-STARCH_parseCommandLineOptions (int argc, char **argv)
+STARCH_parseCommandLineOptions(int argc, char **argv)
 {
 #ifdef DEBUG
     fprintf (stderr, "\n--- STARCH_parseCommandLineOptions()  ---\n");
@@ -342,7 +348,7 @@ STARCH_parseCommandLineOptions (int argc, char **argv)
 }
 
 void
-STARCH_printUsage (int errorType)
+STARCH_printUsage(int errorType)
 {
 #ifdef DEBUG
     fprintf (stderr, "\n--- STARCH_printUsage() ---\n");
@@ -360,7 +366,7 @@ STARCH_printUsage (int errorType)
                 case STARCH_FATAL_ERROR:
                 case STARCH_HELP_ERROR:
                 default: {
-                    fprintf(stderr, "%s\n citation: %s\n binary version: %s (creates archive version: %s)\n authors:  %s\n%s\n\n", name, BEDOPS::citation(), BEDOPS::revision(), avStr, authors, usage);
+                    fprintf(stderr, "%s\n  citation: %s\n  binary version: %s (%s) (creates archive version: %s)\n  authors:  %s\n%s\n\n", name, BEDOPS::citation(), BEDOPS::revision(), application_type, avStr, authors, usage);
                     break;
                 }
             }
@@ -370,7 +376,7 @@ STARCH_printUsage (int errorType)
 }
 
 void
-STARCH_printRevision ()
+STARCH_printRevision()
 {
 #ifdef DEBUG
     fprintf (stderr, "\n--- STARCH_printRevision() ---\n");
@@ -384,7 +390,7 @@ STARCH_printRevision ()
     if (avStr != NULL) {
         int result = sprintf (avStr, "%d.%d.%d", STARCH_MAJOR_VERSION, STARCH_MINOR_VERSION, STARCH_REVISION_VERSION);
         if (result != -1)
-            fprintf (stderr, "%s\n binary version: %s (creates archive version: %s)\n", name, BEDOPS::revision(), avStr);
+            fprintf (stderr, "%s\n  binary version: %s (%s) (creates archive version: %s)\n", name, BEDOPS::revision(), application_type, avStr);
         free (avStr);
     }
 }
diff --git a/applications/bed/starch/src/starch.h b/applications/bed/starch/src/starch.h
index 79e213f..8166bf3 100644
--- a/applications/bed/starch/src/starch.h
+++ b/applications/bed/starch/src/starch.h
@@ -69,6 +69,16 @@ static const char *usage = "\n" \
     "    --version             Show binary version.\n\n" \
     "    --help                Show this usage message.\n";
 
+#if BEDOPS_BINARY_TYPE == 0
+static const char* application_type = "typical";
+#else
+#if BEDOPS_BINARY_TYPE == 1
+static const char* application_type = "megarow";
+#else
+static const char* application_type = "typical";
+#endif
+#endif
+
 static struct starch_client_global_args_t {
     char *note;
     CompressionType compressionType;
diff --git a/applications/bed/starch/src/starchcat.c b/applications/bed/starch/src/starchcat.c
index 4f86292..6de4eef 100644
--- a/applications/bed/starch/src/starchcat.c
+++ b/applications/bed/starch/src/starchcat.c
@@ -63,8 +63,8 @@ namespace {
 } // unnamed namespace
 #endif
 
-int 
-main (int argc, char **argv) 
+int
+main (int argc, char **argv)
 {
 #ifdef DEBUG
     fprintf (stderr, "\n--- starchcat main() - enter ---\n");
@@ -236,8 +236,8 @@ main (int argc, char **argv)
 namespace starch {
 #endif
 
-void   
-STARCHCAT_initializeGlobals() 
+void
+STARCHCAT_initializeGlobals()
 {
 #ifdef DEBUG
     fprintf (stderr, "\n--- STARCHCAT_initializeGlobals() ---\n");
@@ -286,7 +286,7 @@ STARCHCAT_parseCommandLineOptions(int argc, char **argv)
                     fprintf (stderr, "ERROR: Numerical value is outside of range.\n");
                     return STARCHCAT_FATAL_ERROR;
                 }
-                break;    
+                break;
             case 'h':
                 return STARCHCAT_HELP_ERROR;
             case '?':
@@ -308,8 +308,8 @@ STARCHCAT_parseCommandLineOptions(int argc, char **argv)
     return STARCHCAT_EXIT_SUCCESS;
 }
 
-int 
-STARCHCAT2_copyInputRecordToOutput (Metadata **outMd, const char *outTag, const CompressionType outType, const char *inChr, const MetadataRecord *inRec, size_t *cumulativeOutputSize, const Boolean reportProgressFlag)
+int
+STARCHCAT2_copyInputRecordToOutput(Metadata **outMd, const char *outTag, const CompressionType outType, const char *inChr, const MetadataRecord *inRec, size_t *cumulativeOutputSize, const Boolean reportProgressFlag)
 {
 #ifdef DEBUG
     fprintf (stderr, "\n--- STARCHCAT2_copyInputRecordToOutput() ---\n");
@@ -380,7 +380,7 @@ STARCHCAT2_copyInputRecordToOutput (Metadata **outMd, const char *outTag, const
 #endif
 
     /* determine the offsets of the stream-of-interest */
-    if (av->major == 2) 
+    if (av->major == 2)
         startOffset += STARCH2_MD_HEADER_BYTE_LENGTH;
     else
         startOffset += inRec->mdOffset;
@@ -532,12 +532,12 @@ STARCHCAT2_copyInputRecordToOutput (Metadata **outMd, const char *outTag, const
                                      outSignature,
                                      outFileLineMaxStringLength );
     }
-    
+
     return STARCHCAT_EXIT_SUCCESS;
 }
 
-int    
-STARCHCAT_copyInputRecordToOutput (Metadata **outMd, const char *outTag, const CompressionType outType, const char *inChr, const MetadataRecord *inRec)
+int
+STARCHCAT_copyInputRecordToOutput(Metadata **outMd, const char *outTag, const CompressionType outType, const char *inChr, const MetadataRecord *inRec)
 {
     /*
         This function copies the bytes of a single record (chromosome) 
@@ -748,8 +748,8 @@ STARCHCAT_copyInputRecordToOutput (Metadata **outMd, const char *outTag, const C
     return STARCHCAT_EXIT_SUCCESS;
 }
 
-int 
-STARCHCAT2_rewriteInputRecordToOutput (Metadata **outMd, const char *outTag, const CompressionType outType, const char *inChr, const MetadataRecord *inRec, size_t *cumulativeOutputSize, const Boolean generatePerChrSignatureFlag, const Boolean reportProgressFlag, const LineCountType reportProgressN)
+int
+STARCHCAT2_rewriteInputRecordToOutput(Metadata **outMd, const char *outTag, const CompressionType outType, const char *inChr, const MetadataRecord *inRec, size_t *cumulativeOutputSize, const Boolean generatePerChrSignatureFlag, const Boolean reportProgressFlag, const LineCountType reportProgressN)
 {
     /*
         This function extracts a single record (chromosome) of data
@@ -777,17 +777,25 @@ STARCHCAT2_rewriteInputRecordToOutput (Metadata **outMd, const char *outTag, con
     int64_t nRetransformBuf = 0;
 
     /* allocate memory for intermediate buffer variables */
+#ifdef __cplusplus
+    retransformLineBuf = static_cast<unsigned char *>( calloc(TOKENS_MAX_LENGTH, sizeof(unsigned char)) );
+#else
     retransformLineBuf = (unsigned char *) calloc(TOKENS_MAX_LENGTH, sizeof(unsigned char));
+#endif
     if (!retransformLineBuf) {
         fprintf(stderr, "ERROR: Insufficient memory for intermediate buffer variable [retransformLineBuf].\n");
         exit(ENOMEM);
     }
+#ifdef __cplusplus
+    retransformBuf = static_cast<unsigned char *>( calloc(STARCH_BUFFER_MAX_LENGTH, sizeof(unsigned char)) );
+#else
     retransformBuf = (unsigned char *) calloc(STARCH_BUFFER_MAX_LENGTH, sizeof(unsigned char));
+#endif
     if (!retransformBuf) {
         fprintf(stderr, "ERROR: Insufficient memory for intermediate buffer variable [retransformBuf].\n");
         exit(ENOMEM);
     }
-    
+
     /* bzip2 variables */
     BZFILE *bzInFp = NULL;
     BZFILE *bzOutFp = NULL;
@@ -804,17 +812,29 @@ STARCHCAT2_rewriteInputRecordToOutput (Metadata **outMd, const char *outTag, con
     unsigned int bzOutBytesWritten = 0U;
 
     /* allocate memory for bzip2 variables */
+#ifdef __cplusplus
+    bzReadBuf = static_cast<unsigned char *>( calloc(STARCH_BZ_BUFFER_MAX_LENGTH, sizeof(unsigned char)) );
+#else
     bzReadBuf = (unsigned char *) calloc(STARCH_BZ_BUFFER_MAX_LENGTH, sizeof(unsigned char));
+#endif
     if (!bzReadBuf) {
         fprintf(stderr, "ERROR: Insufficient memory for bzip2 variable [bzReadBuf].\n");
         exit(ENOMEM);
     }
+#ifdef __cplusplus
+    bzRemainderBuf = static_cast<unsigned char *>( calloc(STARCH_BZ_BUFFER_MAX_LENGTH, sizeof(unsigned char)) );
+#else
     bzRemainderBuf = (unsigned char *) calloc(STARCH_BZ_BUFFER_MAX_LENGTH, sizeof(unsigned char));
+#endif
     if (!bzRemainderBuf) {
         fprintf(stderr, "ERROR: Insufficient memory for bzip2 variable [bzRemainderBuf].\n");
         exit(ENOMEM);
     }
+#ifdef __cplusplus
+    bzLineBuf = static_cast<unsigned char *>( calloc(STARCH_BZ_BUFFER_MAX_LENGTH, sizeof(unsigned char)) );
+#else
     bzLineBuf = (unsigned char *) calloc(STARCH_BZ_BUFFER_MAX_LENGTH, sizeof(unsigned char));
+#endif
     if (!bzLineBuf) {
         fprintf(stderr, "ERROR: Insufficient memory for bzip2 variable [bzLineBuf].\n");
         exit(ENOMEM);
@@ -836,27 +856,47 @@ STARCHCAT2_rewriteInputRecordToOutput (Metadata **outMd, const char *outTag, con
     unsigned char *zLineBuf = NULL;
 
     /* allocate memory for gzip variables */
+#ifdef __cplusplus
+    zOutBuffer = static_cast<unsigned char *>( calloc(STARCH_Z_BUFFER_MAX_LENGTH, sizeof(unsigned char)) );
+#else
     zOutBuffer = (unsigned char *) calloc(STARCH_Z_BUFFER_MAX_LENGTH, sizeof(unsigned char));
+#endif
     if (!zOutBuffer) {
         fprintf(stderr, "ERROR: Insufficient memory for gzip variable [zOutBuffer].\n");
         exit(ENOMEM);
     }
+#ifdef __cplusplus
+    zReadBuf = static_cast<unsigned char *>( calloc(STARCH_Z_CHUNK/1024, sizeof(unsigned char)) );
+#else
     zReadBuf = (unsigned char *) calloc(STARCH_Z_CHUNK/1024, sizeof(unsigned char));
+#endif
     if (!zReadBuf) {
         fprintf(stderr, "ERROR: Insufficient memory for gzip variable [zReadBuf].\n");
         exit(ENOMEM);
     }
+#ifdef __cplusplus
+    zOutBuf = static_cast<unsigned char *>( calloc(STARCH_Z_CHUNK, sizeof(unsigned char)) );
+#else
     zOutBuf = (unsigned char *) calloc(STARCH_Z_CHUNK, sizeof(unsigned char));
+#endif
     if (!zOutBuf) {
         fprintf(stderr, "ERROR: Insufficient memory for gzip variable [zOutBuf].\n");
         exit(ENOMEM);
     }
+#ifdef __cplusplus
+    zRemainderBuf = static_cast<unsigned char *>( calloc(STARCH_Z_BUFFER_MAX_LENGTH, sizeof(unsigned char)) );
+#else
     zRemainderBuf = (unsigned char *) calloc(STARCH_Z_BUFFER_MAX_LENGTH, sizeof(unsigned char));
+#endif
     if (!zRemainderBuf) {
         fprintf(stderr, "ERROR: Insufficient memory for gzip variable [zRemainderBuf].\n");
         exit(ENOMEM);
     }
+#ifdef __cplusplus
+    zLineBuf = static_cast<unsigned char *>( calloc(STARCH_Z_BUFFER_MAX_LENGTH, sizeof(unsigned char)) );
+#else
     zLineBuf = (unsigned char *) calloc(STARCH_Z_BUFFER_MAX_LENGTH, sizeof(unsigned char));
+#endif
     if (!zLineBuf) {
         fprintf(stderr, "ERROR: Insufficient memory for gzip variable [zLineBuf].\n");
         exit(ENOMEM);
@@ -891,12 +931,20 @@ STARCHCAT2_rewriteInputRecordToOutput (Metadata **outMd, const char *outTag, con
     LineLengthType t_lineMaxStringLength = STARCH_DEFAULT_LINE_STRING_LENGTH;
 
     /* allocate memory for transformation variables */
+#ifdef __cplusplus
+    t_firstInputToken = static_cast<char *>( calloc(UNSTARCH_FIRST_TOKEN_MAX_LENGTH, sizeof(char)) );
+#else
     t_firstInputToken = (char *) calloc(UNSTARCH_FIRST_TOKEN_MAX_LENGTH, sizeof(char));
+#endif
     if (!t_firstInputToken) {
         fprintf(stderr, "ERROR: Insufficient memory for transformation variable [t_firstInputToken].\n");
         exit(ENOMEM);
     }
+#ifdef __cplusplus
+    t_secondInputToken = static_cast<char *>( calloc(UNSTARCH_SECOND_TOKEN_MAX_LENGTH, sizeof(char)) );
+#else
     t_secondInputToken = (char *) calloc(UNSTARCH_SECOND_TOKEN_MAX_LENGTH, sizeof(char));
+#endif
     if (!t_secondInputToken) {
         fprintf(stderr, "ERROR: Insufficient memory for transformation variable [t_secondInputToken].\n");
         exit(ENOMEM);
@@ -947,7 +995,7 @@ STARCHCAT2_rewriteInputRecordToOutput (Metadata **outMd, const char *outTag, con
     /*
         Use fseek() to ensure we are at the correct file offset before reading bytes
     */
-    if (av->major == 2) 
+    if (av->major == 2)
         startOffset += STARCH2_MD_HEADER_BYTE_LENGTH;
     else if (av->major == 1)
         startOffset += inRec->mdOffset;
@@ -1049,7 +1097,7 @@ STARCHCAT2_rewriteInputRecordToOutput (Metadata **outMd, const char *outTag, con
                         return STARCHCAT_EXIT_FAILURE;
                     }
                 }
-            }            
+            }
             break;
         }
         case kUndefined: {
@@ -1140,7 +1188,7 @@ STARCHCAT2_rewriteInputRecordToOutput (Metadata **outMd, const char *outTag, con
                         nBzRemainderBuf = 0;
                     }
                     bzBufIndex = 0;
-                    while (bzBufIndex < nBzRead) {                        
+                    while (bzBufIndex < nBzRead) {
                         bufChar = bzReadBuf[bzBufIndex];
                         bzLineBuf[bufCharIndex++] = bufChar;
 #ifdef DEBUG
@@ -1249,7 +1297,7 @@ STARCHCAT2_rewriteInputRecordToOutput (Metadata **outMd, const char *outTag, con
                                 /* test for duplicate element */
                                 if ((t_pStart == t_currStart) && (t_pStop == t_currStop))
                                     t_duplicateElementExists = kStarchTrue;
-                                
+
                                 /* test for nested element */
                                 if ((t_pStart < t_currStart) && (t_pStop > t_currStop))
                                     t_nestedElementExists = kStarchTrue;
@@ -1546,7 +1594,7 @@ STARCHCAT2_rewriteInputRecordToOutput (Metadata **outMd, const char *outTag, con
             if (bzInError != BZ_OK) {
                 fprintf(stderr, "ERROR: Bzip2 error after closing read stream: %d\n", bzInError);
                 return STARCHCAT_EXIT_FAILURE;
-            }            
+            }
             break;
         }
 
@@ -1557,7 +1605,7 @@ STARCHCAT2_rewriteInputRecordToOutput (Metadata **outMd, const char *outTag, con
         */
         case kGzip: {
 #ifdef DEBUG
-            fprintf (stderr, "\tsetting up gzip read stream...\n");            
+            fprintf (stderr, "\tsetting up gzip read stream...\n");
 #endif
             zInStream.zalloc = Z_NULL;
             zInStream.zfree = Z_NULL;
@@ -1570,7 +1618,7 @@ STARCHCAT2_rewriteInputRecordToOutput (Metadata **outMd, const char *outTag, con
                 fprintf(stderr, "ERROR: Could not initialize z-stream\n");
                 return STARCHCAT_EXIT_FAILURE;
             }
-            
+
             do {
 #ifdef DEBUG
                 fprintf (stderr, "\treading from stream... (%s)\n", inChr);
@@ -1629,7 +1677,7 @@ STARCHCAT2_rewriteInputRecordToOutput (Metadata **outMd, const char *outTag, con
                         buffer as is done for bzip2 streams.
                     */
                     bufCharIndex = 0;
-                    
+
                     if (nZRemainderBuf > 0) {
 #ifdef DEBUG
                         fprintf(stderr, "\tADDING FROM REMAINDER [%zd] [%s]\n", nZRemainderBuf, zRemainderBuf);
@@ -1649,7 +1697,7 @@ STARCHCAT2_rewriteInputRecordToOutput (Metadata **outMd, const char *outTag, con
                         /* zRemainderBuf[nZRemainderBuf] = '\0'; */
                         nZRemainderBuf = 0;
                     }
-                    
+
                     zBufIndex = 0;
                     while (zBufIndex < zInHave) {
 
@@ -1721,7 +1769,7 @@ STARCHCAT2_rewriteInputRecordToOutput (Metadata **outMd, const char *outTag, con
                                 /* test for duplicate element */
                                 if ((t_pStart == t_currStart) && (t_pStop == t_currStop))
                                     t_duplicateElementExists = kStarchTrue;
-                                
+
                                 /* test for nested element */
                                 if ((t_pStart < t_currStart) && (t_pStop > t_currStop))
                                     t_nestedElementExists = kStarchTrue;
@@ -1849,11 +1897,11 @@ STARCHCAT2_rewriteInputRecordToOutput (Metadata **outMd, const char *outTag, con
 
 #ifdef DEBUG
                             if ((zBufIndex + 1) == zInHave) {
-                                fprintf(stderr, "\tNEWLINE FOUND AT END OF Z-STREAM BUFFER! zLineBuf: [%s]\n", zLineBuf);                                
+                                fprintf(stderr, "\tNEWLINE FOUND AT END OF Z-STREAM BUFFER! zLineBuf: [%s]\n", zLineBuf);
                             }
 #endif
                         }
-                        
+
                         else if ((zBufIndex + 1) == zInHave) {
                             /* add to remainder if we're at the end of zInHave */
                             memset(zRemainderBuf, 0, nZRemainderBuf);
@@ -2024,7 +2072,7 @@ STARCHCAT2_rewriteInputRecordToOutput (Metadata **outMd, const char *outTag, con
                     }
                     default: {
                         fprintf(stderr, "ERROR: Unknown error with deflateEnd() (err: %d)\n", zOutError);
-                        return STARCHCAT_EXIT_FAILURE;                                
+                        return STARCHCAT_EXIT_FAILURE;
                     }
                 }
             }
@@ -2054,7 +2102,7 @@ STARCHCAT2_rewriteInputRecordToOutput (Metadata **outMd, const char *outTag, con
                                         t_duplicateElementExists,
                                         t_nestedElementExists,
                                         t_base64EncodedSha1Digest,
-                                        t_lineMaxStringLength );    
+                                        t_lineMaxStringLength );
     else
         *outMd = STARCH_addMetadata( *outMd, 
 #ifdef __cplusplus
@@ -2073,26 +2121,40 @@ STARCHCAT2_rewriteInputRecordToOutput (Metadata **outMd, const char *outTag, con
                                      t_lineMaxStringLength );
 
     /* cleanup */
-    free(outTagFn), outTagFn = NULL;
-    free(t_base64EncodedSha1Digest), t_base64EncodedSha1Digest = NULL;
-    free(retransformLineBuf), retransformLineBuf = NULL;
-    free(retransformBuf), retransformBuf = NULL;
-    free(bzReadBuf), bzReadBuf = NULL;
-    free(bzRemainderBuf), bzRemainderBuf = NULL;
-    free(bzLineBuf), bzLineBuf = NULL;
-    free(zOutBuffer), zOutBuffer = NULL;
-    free(zReadBuf), zReadBuf = NULL;
-    free(zOutBuf), zOutBuf = NULL;
-    free(zRemainderBuf), zRemainderBuf = NULL;
-    free(zLineBuf), zLineBuf = NULL;
-    free(t_firstInputToken), t_firstInputToken = NULL;
-    free(t_secondInputToken), t_secondInputToken = NULL;
+    free(outTagFn);
+    outTagFn = NULL;
+    free(t_base64EncodedSha1Digest);
+    t_base64EncodedSha1Digest = NULL;
+    free(retransformLineBuf);
+    retransformLineBuf = NULL;
+    free(retransformBuf);
+    retransformBuf = NULL;
+    free(bzReadBuf);
+    bzReadBuf = NULL;
+    free(bzRemainderBuf);
+    bzRemainderBuf = NULL;
+    free(bzLineBuf);
+    bzLineBuf = NULL;
+    free(zOutBuffer);
+    zOutBuffer = NULL;
+    free(zReadBuf);
+    zReadBuf = NULL;
+    free(zOutBuf);
+    zOutBuf = NULL;
+    free(zRemainderBuf);
+    zRemainderBuf = NULL;
+    free(zLineBuf);
+    zLineBuf = NULL;
+    free(t_firstInputToken);
+    t_firstInputToken = NULL;
+    free(t_secondInputToken);
+    t_secondInputToken = NULL;
 
     return STARCHCAT_EXIT_SUCCESS;
 }
 
-int    
-STARCHCAT_rewriteInputRecordToOutput (Metadata **outMd, const char *outTag, const CompressionType outType, const char *inChr, const MetadataRecord *inRec)
+int
+STARCHCAT_rewriteInputRecordToOutput(Metadata **outMd, const char *outTag, const CompressionType outType, const char *inChr, const MetadataRecord *inRec)
 {
     /*
         This function extracts a single record (chromosome) of
@@ -2131,7 +2193,7 @@ STARCHCAT_rewriteInputRecordToOutput (Metadata **outMd, const char *outTag, cons
         fprintf(stderr, "ERROR: Could not open an uncompressed output file handle to %s\n", uncomprOutFn);
         return STARCHCAT_EXIT_FAILURE;
     }
-    
+
     switch (inType) {
         case kBzip2: {
 #ifdef __cplusplus
@@ -2299,8 +2361,8 @@ STARCHCAT2_parseCoordinatesFromBedLine(const char *lineBuf, const size_t inRecId
     return STARCHCAT_EXIT_SUCCESS;
 }
 
-int 
-STARCHCAT2_identifyLowestBedElement (const Boolean *eobFlags, const SignedCoordType *starts, const SignedCoordType *stops, const size_t numRecords, size_t *lowestIdx) 
+int
+STARCHCAT2_identifyLowestBedElement(const Boolean *eobFlags, const SignedCoordType *starts, const SignedCoordType *stops, const size_t numRecords, size_t *lowestIdx)
 {
 #ifdef DEBUG
     fprintf (stderr, "\n--- STARCHCAT2_identifyLowestBedElement() ---\n");
@@ -2375,8 +2437,8 @@ STARCHCAT2_identifyLowestBedElement (const Boolean *eobFlags, const SignedCoordT
     return STARCHCAT_EXIT_SUCCESS;
 }
 
-int 
-STARCHCAT2_identifyLowestBedElementV2p2 (const Boolean *eobFlags, const SignedCoordType *starts, const SignedCoordType *stops, const char **remainders, const size_t numRecords, size_t *lowestIdx) 
+int
+STARCHCAT2_identifyLowestBedElementV2p2(const Boolean *eobFlags, const SignedCoordType *starts, const SignedCoordType *stops, const char **remainders, const size_t numRecords, size_t *lowestIdx)
 {
 #ifdef DEBUG
     fprintf (stderr, "\n--- STARCHCAT2_identifyLowestBedElementV2p2() ---\n");
@@ -2429,7 +2491,7 @@ STARCHCAT2_identifyLowestBedElementV2p2 (const Boolean *eobFlags, const SignedCo
     */
 
     if (checkStopFlag == kStarchTrue) {
-        
+
         size_t *lowestStopMatches = NULL;
         size_t lowestStopMatchesCapacity = 0;
 #ifdef __cplusplus
@@ -2458,7 +2520,7 @@ STARCHCAT2_identifyLowestBedElementV2p2 (const Boolean *eobFlags, const SignedCo
                 }
             }
         }
-        
+
         /*
             process remainders when there are two or more lowestStopMatches entries
             (the lowestStopMatches array points to record indices, so we dereference
@@ -2475,7 +2537,8 @@ STARCHCAT2_identifyLowestBedElementV2p2 (const Boolean *eobFlags, const SignedCo
             }
         }
 
-        free(lowestStopMatches), lowestStopMatches = NULL;
+        free(lowestStopMatches);
+        lowestStopMatches = NULL;
     }
 
 #ifdef DEBUG
@@ -2493,8 +2556,8 @@ STARCHCAT2_identifyLowestBedElementV2p2 (const Boolean *eobFlags, const SignedCo
     return STARCHCAT_EXIT_SUCCESS;
 }
 
-int    
-STARCHCAT2_pullNextBedElement (const size_t recIdx, const char **inLinesBuf, const LineCountType *nInLinesBuf, char **outLineBuf, uint64_t **inBufNewlineOffsets)
+int
+STARCHCAT2_pullNextBedElement(const size_t recIdx, const char **inLinesBuf, const LineCountType *nInLinesBuf, char **outLineBuf, uint64_t **inBufNewlineOffsets)
 {
 #ifdef DEBUG
     fprintf(stderr, "\n--- STARCHCAT2_pullNextBedElement() ---\n");
@@ -2546,7 +2609,7 @@ STARCHCAT2_pullNextBedElement (const size_t recIdx, const char **inLinesBuf, con
 }
 
 int
-STARCHCAT2_mergeInputRecordsToOutput (const char *inChr, Metadata **outMd, const char *outTag, const CompressionType outType, const ChromosomeSummary *summary, size_t *cumulativeOutputSize)
+STARCHCAT2_mergeInputRecordsToOutput(const char *inChr, Metadata **outMd, const char *outTag, const CompressionType outType, const ChromosomeSummary *summary, size_t *cumulativeOutputSize)
 {
 #ifdef DEBUG
     fprintf (stderr, "\n--- STARCHCAT2_mergeInputRecordsToOutput() ---\n");
@@ -2568,7 +2631,7 @@ STARCHCAT2_mergeInputRecordsToOutput (const char *inChr, Metadata **outMd, const
     char **extractionBuffers = NULL;
     size_t *nExtractionBuffers = NULL;
     int *extractionBufferOffsets = NULL;
-    char **extractionRemainderBufs = NULL; 
+    char **extractionRemainderBufs = NULL;
     size_t *nExtractionRemainderBufs = NULL;
     char *compressionBuffer = NULL;
     LineCountType compressionLineCount = 0;
@@ -2652,7 +2715,7 @@ STARCHCAT2_mergeInputRecordsToOutput (const char *inChr, Metadata **outMd, const
     stops                          = malloc(sizeof(SignedCoordType)      * summary->numRecords);
     remainders                     = malloc(sizeof(char *)               * summary->numRecords);
     transformStates                = malloc(sizeof(TransformState *)     * summary->numRecords);
-    extractionRemainderBufs        = malloc(sizeof(char *)               * summary->numRecords); 
+    extractionRemainderBufs        = malloc(sizeof(char *)               * summary->numRecords);
     nExtractionRemainderBufs       = malloc(sizeof(size_t)               * summary->numRecords);
     bzInFps                        = malloc(sizeof(BZFILE *)             * summary->numRecords);
     nBzReads                       = malloc(sizeof(size_t)               * summary->numRecords);
@@ -2697,7 +2760,7 @@ STARCHCAT2_mergeInputRecordsToOutput (const char *inChr, Metadata **outMd, const
     }
 
     /* 1 -- initialize and fill input (extraction) buffers on first pass */
-    for (inRecIdx = 0U; inRecIdx < summary->numRecords; inRecIdx++) 
+    for (inRecIdx = 0U; inRecIdx < summary->numRecords; inRecIdx++)
     {
         eofFlags[inRecIdx]                                      = kStarchFalse;
         eobFlags[inRecIdx]                                      = kStarchFalse;
@@ -2846,7 +2909,7 @@ STARCHCAT2_mergeInputRecordsToOutput (const char *inChr, Metadata **outMd, const
                                   &extractionBufferOffsets[inRecIdx], 
                                   &extractedElements[inRecIdx]);
         extractedLineCounts[inRecIdx]--;
-        
+
         /* memset(outputRetransformState->r_chromosome, 0, TOKEN_CHR_MAX_LENGTH); */
 
         memset(outputRetransformState->r_remainder, 0, UNSTARCH_SECOND_TOKEN_MAX_LENGTH);
@@ -2895,7 +2958,7 @@ STARCHCAT2_mergeInputRecordsToOutput (const char *inChr, Metadata **outMd, const
             if ((eobFlags[inRecIdx] == kStarchFalse) || (eofFlags[inRecIdx] == kStarchFalse)) {
                 allEOF = kStarchFalse;
                 continue;
-            }            
+            }
         }
 
         /* 2, 3 -- parse coordinates for each record's current bed element (this gets us the start and stop coords) */
@@ -3026,7 +3089,7 @@ STARCHCAT2_mergeInputRecordsToOutput (const char *inChr, Metadata **outMd, const
                 }
 
                 extractedLineCounts[lowestStartElementIdx] = transformStates[lowestStartElementIdx]->t_lineIdx;
-                
+
                 /* 
                     reset the extraction buffer offset and try to pull something from 
                     the extraction buffer into the extracted elements buffer 
@@ -3053,11 +3116,11 @@ STARCHCAT2_mergeInputRecordsToOutput (const char *inChr, Metadata **outMd, const
 #ifdef DEBUG
             fprintf(stderr, "STEP 5 - COMP BUFFER [%s] -->\nCOMPRESS RETRANSFORMATION BUFFER (FULL)\n[%s]\n", compressionBuffer, retransformedOutputBuffer);
 #endif
-            
+
             /* hash the transformed buffer */
             sha1_process_bytes (retransformedOutputBuffer, strlen(retransformedOutputBuffer), &r_perChromosomeHashCtx);
 
-            STARCHCAT2_resetCompressionBuffer(compressionBuffer, &compressionLineCount);           
+            STARCHCAT2_resetCompressionBuffer(compressionBuffer, &compressionLineCount);
             switch (outType) {
                 case kBzip2: {
                     STARCHCAT2_squeezeRetransformedOutputBufferToBzip2Stream(&bzOutFp, 
@@ -3173,14 +3236,22 @@ STARCHCAT2_mergeInputRecordsToOutput (const char *inChr, Metadata **outMd, const
     /* breakdown */
     for (inRecIdx = 0U; inRecIdx < summary->numRecords; inRecIdx++) {
         if (STARCHCAT2_testSummaryForChromosomeExistence(inChr, summary, inRecIdx) == STARCHCAT_EXIT_SUCCESS) { 
-            if (extractionBuffers[inRecIdx])
-                free(extractionBuffers[inRecIdx]), extractionBuffers[inRecIdx] = NULL;
-            if (extractedElements[inRecIdx])
-                free(extractedElements[inRecIdx]), extractedElements[inRecIdx] = NULL;
-            if (extractionRemainderBufs[inRecIdx])
-                free(extractionRemainderBufs[inRecIdx]), extractionRemainderBufs[inRecIdx] = NULL;
-            if (remainders[inRecIdx])
-                free(remainders[inRecIdx]), remainders[inRecIdx] = NULL;
+            if (extractionBuffers[inRecIdx]) {
+                free(extractionBuffers[inRecIdx]);
+                extractionBuffers[inRecIdx] = NULL;
+            }
+            if (extractedElements[inRecIdx]) {
+                free(extractedElements[inRecIdx]);
+                extractedElements[inRecIdx] = NULL;
+            }
+            if (extractionRemainderBufs[inRecIdx]) {
+                free(extractionRemainderBufs[inRecIdx]);
+                extractionRemainderBufs[inRecIdx] = NULL;
+            }
+            if (remainders[inRecIdx]) {
+                free(remainders[inRecIdx]);
+                remainders[inRecIdx] = NULL;
+            }
             inRecord = *(summary->records) + inRecIdx;
             inType = inRecord->type; /* get record type of input stream */
             switch (inType) {
@@ -3205,58 +3276,104 @@ STARCHCAT2_mergeInputRecordsToOutput (const char *inChr, Metadata **outMd, const
             }
         } 
     }
-    if (extractionBuffers)
-        free(extractionBuffers), extractionBuffers = NULL;
-    if (nExtractionBuffers)
-        free(nExtractionBuffers), nExtractionBuffers = NULL;
-    if (extractionBufferOffsets)
-        free(extractionBufferOffsets), extractionBufferOffsets = NULL;
-    if (compressionBuffer)
-        free(compressionBuffer), compressionBuffer = NULL;
-    if (zInFps)
-        free(zInFps), zInFps = NULL;
-    if (extractedLineCounts)
-        free(extractedLineCounts), extractedLineCounts = NULL;
-    if (extractedElements)
-        free(extractedElements), extractedElements = NULL;
-    if (eobFlags)
-        free(eobFlags), eobFlags = NULL;
-    if (eofFlags)
-        free(eofFlags), eofFlags = NULL;
-    if (starts)
-        free(starts), starts = NULL;
-    if (stops)
-        free(stops), stops = NULL;
-    if (remainders)
-        free(remainders), remainders = NULL;
-    if (transformStates)
-        free(transformStates), transformStates = NULL;
-    if (extractionRemainderBufs)
-        free(extractionRemainderBufs), extractionRemainderBufs = NULL;
-    if (nExtractionRemainderBufs)
-        free(nExtractionRemainderBufs), nExtractionRemainderBufs = NULL;
-    if (bzInFps)
-        free(bzInFps), bzInFps = NULL;
-    if (nBzReads)
-        free(nBzReads), nBzReads = NULL;
-    if (zInStreams)
-        free(zInStreams), zInStreams = NULL;
-    if (nZReads)
-        free(nZReads), nZReads = NULL;
-    if (retransformedOutputBuffer)
-        free(retransformedOutputBuffer), retransformedOutputBuffer = NULL;
-    if (outputRetransformState)
-        free(outputRetransformState), outputRetransformState = NULL;
-    if (finalOutTagFn)
-        free(finalOutTagFn), finalOutTagFn = NULL;
-    if (r_base64EncodedSha1Digest)
-        free(r_base64EncodedSha1Digest), r_base64EncodedSha1Digest = NULL;
-    
+    if (extractionBuffers) {
+        free(extractionBuffers);
+        extractionBuffers = NULL;
+    }
+    if (nExtractionBuffers) {
+        free(nExtractionBuffers);
+        nExtractionBuffers = NULL;
+    }
+    if (extractionBufferOffsets) {
+        free(extractionBufferOffsets);
+        extractionBufferOffsets = NULL;
+    }
+    if (compressionBuffer) {
+        free(compressionBuffer);
+        compressionBuffer = NULL;
+    }
+    if (zInFps) {
+        free(zInFps);
+        zInFps = NULL;
+    }
+    if (extractedLineCounts) {
+        free(extractedLineCounts);
+        extractedLineCounts = NULL;
+    }
+    if (extractedElements) {
+        free(extractedElements);
+        extractedElements = NULL;
+    }
+    if (eobFlags) {
+        free(eobFlags);
+        eobFlags = NULL;
+    }
+    if (eofFlags) {
+        free(eofFlags);
+        eofFlags = NULL;
+    }
+    if (starts) {
+        free(starts);
+        starts = NULL;
+    }
+    if (stops) {
+        free(stops);
+        stops = NULL;
+    }
+    if (remainders) {
+        free(remainders);
+        remainders = NULL;
+    }
+    if (transformStates) {
+        free(transformStates);
+        transformStates = NULL;
+    }
+    if (extractionRemainderBufs) {
+        free(extractionRemainderBufs);
+        extractionRemainderBufs = NULL;
+    }
+    if (nExtractionRemainderBufs) {
+        free(nExtractionRemainderBufs);
+        nExtractionRemainderBufs = NULL;
+    }
+    if (bzInFps) {
+        free(bzInFps);
+        bzInFps = NULL;
+    }
+    if (nBzReads) {
+        free(nBzReads);
+        nBzReads = NULL;
+    }
+    if (zInStreams) {
+        free(zInStreams);
+        zInStreams = NULL;
+    }
+    if (nZReads) {
+        free(nZReads);
+        nZReads = NULL;
+    }
+    if (retransformedOutputBuffer) {
+        free(retransformedOutputBuffer);
+        retransformedOutputBuffer = NULL;
+    }
+    if (outputRetransformState) {
+        free(outputRetransformState);
+        outputRetransformState = NULL;
+    }
+    if (finalOutTagFn) {
+        free(finalOutTagFn);
+        finalOutTagFn = NULL;
+    }
+    if (r_base64EncodedSha1Digest) {
+        free(r_base64EncodedSha1Digest);
+        r_base64EncodedSha1Digest = NULL;
+    }
+
     return STARCHCAT_EXIT_SUCCESS;
 }
 
-int    
-STARCHCAT_mergeInputRecordsToOutput (Metadata **outMd, const char *outTag, const CompressionType outType, const ChromosomeSummary *summary)
+int
+STARCHCAT_mergeInputRecordsToOutput(Metadata **outMd, const char *outTag, const CompressionType outType, const ChromosomeSummary *summary)
 {
     /*
         This function will grab a buffer-ful of each file's chromosomal data, read 
@@ -3435,7 +3552,7 @@ STARCHCAT_mergeInputRecordsToOutput (Metadata **outMd, const char *outTag, const
 #else
         lineBuffers[inRecIdx] = malloc (STARCH_BUFFER_MAX_LENGTH);
 #endif
-        bufferIdx = 0U;        
+        bufferIdx = 0U;
         while ( (c = fgetc(tempOutFps[inRecIdx])) ) {
             if (c == EOF) {
                 fprintf(stderr, "ERROR: Could not retrieve data from archive (is it empty or corrupt?). Could not merge.\n");
@@ -3580,10 +3697,10 @@ STARCHCAT_mergeInputRecordsToOutput (Metadata **outMd, const char *outTag, const
                     lineBuffers[lsiIdx][(bufferIdx-1)] = '\0';
                     break;
                 }
-            }            
+            }
         }
         else {
-            for (lsiTestIdx = 0; lsiTestIdx < lsiIdx; lsiTestIdx++) {                
+            for (lsiTestIdx = 0; lsiTestIdx < lsiIdx; lsiTestIdx++) {
                 if (stops[lowestStartIdxs[lsiTestIdx]] < lowestStop) {
                     lowestStop = stops[lowestStartIdxs[lsiTestIdx]];
 #ifdef __cplusplus
@@ -3638,7 +3755,7 @@ STARCHCAT_mergeInputRecordsToOutput (Metadata **outMd, const char *outTag, const
         if (remove(tempOutFns[inRecIdx]) != 0) {
             fprintf(stderr, "ERROR: Could not delete temporary output file. Could not merge.\n");
             return STARCHCAT_EXIT_FAILURE;
-        }        
+        }
         free(tempOutFns[inRecIdx]);
     }
     if (tempOutFns)
@@ -3725,7 +3842,7 @@ STARCHCAT_mergeInputRecordsToOutput (Metadata **outMd, const char *outTag, const
 }
 
 int
-STARCHCAT_mergeChromosomeStreams (const ChromosomeSummaries *chrSums, const CompressionType outputType, const char *note) 
+STARCHCAT_mergeChromosomeStreams(const ChromosomeSummaries *chrSums, const CompressionType outputType, const char *note) 
 {
 #ifdef DEBUG
     fprintf (stderr, "\n--- STARCHCAT_mergeChromosomeStreams() ---\n");
@@ -3774,7 +3891,7 @@ STARCHCAT_mergeChromosomeStreams (const ChromosomeSummaries *chrSums, const Comp
 
     STARCH_buildProcessIDTag( &outputTag );
 
-    for (chrIdx = 0U; chrIdx < chrSums->numChromosomes; chrIdx++) 
+    for (chrIdx = 0U; chrIdx < chrSums->numChromosomes; chrIdx++)
     {
         summary = chrSums->summary + chrIdx;
 
@@ -3902,7 +4019,7 @@ STARCHCAT_mergeChromosomeStreams (const ChromosomeSummaries *chrSums, const Comp
 }
 
 int
-STARCHCAT_freeChromosomeNames (char ***chrs, unsigned int numChromosomes)
+STARCHCAT_freeChromosomeNames(char ***chrs, unsigned int numChromosomes)
 {
 #ifdef DEBUG
     fprintf (stderr, "\n--- STARCHCAT_freeChromosomeNames() ---\n");
@@ -3918,7 +4035,7 @@ STARCHCAT_freeChromosomeNames (char ***chrs, unsigned int numChromosomes)
 #endif
         free( *(*chrs + chrIdx) );
     }
-   
+
     free(*chrs);
     *chrs = NULL;
 
@@ -3947,12 +4064,12 @@ STARCHCAT_freeChromosomeSummaries (ChromosomeSummaries **chrSums)
 }
 
 int
-STARCHCAT_allocChromosomeSummaries (ChromosomeSummaries **chrSums, const unsigned int numChromosomes)
+STARCHCAT_allocChromosomeSummaries(ChromosomeSummaries **chrSums, const unsigned int numChromosomes)
 {
 #ifdef DEBUG
     fprintf(stderr, "\n--- STARCHCAT_allocChromosomeSummaries() ---\n");
 #endif
-    
+
     if (numChromosomes == 0)
         return STARCHCAT_EXIT_SUCCESS;
 
@@ -3974,7 +4091,7 @@ STARCHCAT_allocChromosomeSummaries (ChromosomeSummaries **chrSums, const unsigne
 }
 
 int
-STARCHCAT_buildChromosomeSummaries (ChromosomeSummaries **chrSums, const ChromosomeSummary *summary, const unsigned int numChromosomes)
+STARCHCAT_buildChromosomeSummaries(ChromosomeSummaries **chrSums, const ChromosomeSummary *summary, const unsigned int numChromosomes)
 {
 #ifdef DEBUG
     fprintf(stderr, "\n--- STARCHCAT_buildChromosomeSummaries() ---\n");
@@ -3996,7 +4113,7 @@ STARCHCAT_buildChromosomeSummaries (ChromosomeSummaries **chrSums, const Chromos
 }
 
 int
-STARCHCAT_printChromosomeSummaries (const ChromosomeSummaries *chrSums)
+STARCHCAT_printChromosomeSummaries(const ChromosomeSummaries *chrSums)
 {
 #ifdef DEBUG
     fprintf (stderr, "\n--- STARCHCAT_printChromosomeSummaries() ---\n");
@@ -4017,7 +4134,7 @@ STARCHCAT_printChromosomeSummaries (const ChromosomeSummaries *chrSums)
 #ifdef DEBUG
         fprintf(stderr, "\t[chrIdx: %02u]\n\t\tchromosome: %s\n\t\tnumRecords: %u\n", chrIdx, summary->chromosome, summary->numRecords);
 #endif
-        for (recIdx = 0U; recIdx < summary->numRecords; recIdx++) {            
+        for (recIdx = 0U; recIdx < summary->numRecords; recIdx++) {
             mdRecord = recs[recIdx];
 #ifdef __cplusplus
             md = static_cast<Metadata *>( mdRecord->metadata );
@@ -4081,7 +4198,7 @@ STARCHCAT_printChromosomeSummaries (const ChromosomeSummaries *chrSums)
 }
 
 int
-STARCHCAT_freeChromosomeSummary (ChromosomeSummary **summary, const unsigned int numChromosomes)
+STARCHCAT_freeChromosomeSummary(ChromosomeSummary **summary, const unsigned int numChromosomes)
 {
 #ifdef DEBUG
     fprintf (stderr, "\n--- STARCHCAT_freeChromosomeSummary() ---\n");
@@ -4092,13 +4209,13 @@ STARCHCAT_freeChromosomeSummary (ChromosomeSummary **summary, const unsigned int
     if (*summary == NULL)
         return STARCHCAT_EXIT_SUCCESS;
 
-    for (chrIdx = 0U; chrIdx < numChromosomes; chrIdx++) {        
+    for (chrIdx = 0U; chrIdx < numChromosomes; chrIdx++) {
         summaryInstance = *summary + chrIdx;
 #ifdef DEBUG
         fprintf(stderr, "\tfreeing chromosome [%s] %u (of %u)...\n", summaryInstance->chromosome, (chrIdx + 1), numChromosomes);
 #endif
         if (summaryInstance->chromosome) {
-            free( summaryInstance->chromosome ); 
+            free( summaryInstance->chromosome );
             summaryInstance->chromosome = NULL;
         }
         if (summaryInstance->records)
@@ -4110,7 +4227,7 @@ STARCHCAT_freeChromosomeSummary (ChromosomeSummary **summary, const unsigned int
 }
 
 int
-STARCHCAT_allocChromosomeSummary (ChromosomeSummary **summary, const unsigned int numChromosomes) 
+STARCHCAT_allocChromosomeSummary(ChromosomeSummary **summary, const unsigned int numChromosomes)
 {
 #ifdef DEBUG
     fprintf (stderr, "\n--- STARCHCAT_allocChromosomeSummary() ---\n");
@@ -4148,7 +4265,7 @@ STARCHCAT_allocChromosomeSummary (ChromosomeSummary **summary, const unsigned in
 }
 
 int
-STARCHCAT_buildChromosomeSummary (ChromosomeSummary **summary, const MetadataRecord *mdRecords, const unsigned int numRecords, const char **chromosomes, const unsigned int numChromosomes) 
+STARCHCAT_buildChromosomeSummary(ChromosomeSummary **summary, const MetadataRecord *mdRecords, const unsigned int numRecords, const char **chromosomes, const unsigned int numChromosomes) 
 {
 #ifdef DEBUG
     fprintf (stderr, "\n--- STARCHCAT_buildChromosomeSummary() ---\n");
@@ -4217,12 +4334,12 @@ STARCHCAT_buildChromosomeSummary (ChromosomeSummary **summary, const MetadataRec
             return STARCHCAT_EXIT_FAILURE;
         }
     }
-    
+
     return STARCHCAT_EXIT_SUCCESS;
 }
 
 MetadataRecord *
-STARCHCAT_copyMetadataRecord (const MetadataRecord *mdRec) 
+STARCHCAT_copyMetadataRecord(const MetadataRecord *mdRec) 
 {
 #ifdef DEBUG
     fprintf (stderr, "\n--- STARCHCAT_copyMetadataRecord() ---\n");
@@ -4248,7 +4365,7 @@ STARCHCAT_copyMetadataRecord (const MetadataRecord *mdRec)
 }
 
 int
-STARCHCAT_buildUniqueChromosomeList (char ***chromosomes, unsigned int *numChr, const MetadataRecord *mdRecords, const unsigned int numRecords) 
+STARCHCAT_buildUniqueChromosomeList(char ***chromosomes, unsigned int *numChr, const MetadataRecord *mdRecords, const unsigned int numRecords)
 {
 #ifdef DEBUG
     fprintf (stderr, "\n--- STARCHCAT_buildUniqueChromosomeList() ---\n");
@@ -4355,9 +4472,9 @@ STARCHCAT_buildUniqueChromosomeList (char ***chromosomes, unsigned int *numChr,
     return STARCHCAT_EXIT_SUCCESS;
 }
 
-int 
-STARCHCAT_compareCStrings (const void *a, const void *b) 
-{ 
+int
+STARCHCAT_compareCStrings(const void *a, const void *b)
+{
 #ifdef DEBUG
     fprintf (stderr, "\n--- STARCHCAT_compareCStrings() ---\n");
 #endif
@@ -4369,10 +4486,10 @@ STARCHCAT_compareCStrings (const void *a, const void *b)
 #else
     return strcmp(*(const char **)a, *(const char **)b);
 #endif
-} 
+}
 
 int
-STARCHCAT_allocMetadataRecords (MetadataRecord **mdRecords, const unsigned int numRecords)
+STARCHCAT_allocMetadataRecords(MetadataRecord **mdRecords, const unsigned int numRecords)
 {
 #ifdef DEBUG
     fprintf (stderr, "\n--- STARCHCAT_allocMetadataRecords() ---\n");
@@ -4413,7 +4530,7 @@ STARCHCAT_allocMetadataRecords (MetadataRecord **mdRecords, const unsigned int n
 }
 
 int
-STARCHCAT_freeMetadataRecords (MetadataRecord **mdRecords, const unsigned int numRecords) 
+STARCHCAT_freeMetadataRecords(MetadataRecord **mdRecords, const unsigned int numRecords)
 {
 #ifdef DEBUG
     fprintf (stderr, "\n--- STARCHCAT_freeMetadataRecords() ---\n");
@@ -4421,25 +4538,36 @@ STARCHCAT_freeMetadataRecords (MetadataRecord **mdRecords, const unsigned int nu
     unsigned int recIdx = 0U;
     MetadataRecord *instance = NULL;
 
-    if (! *mdRecords) 
+    if (! *mdRecords) {
         return STARCHCAT_EXIT_SUCCESS;
+    }
 
     for (recIdx = 0U; recIdx < numRecords; recIdx++) {
 #ifdef DEBUG
         fprintf(stderr, "\tattempting to free record %u (of %u)...\n", (recIdx + 1), numRecords);
 #endif
         if (mdRecords[recIdx]) {
-            instance = *mdRecords + recIdx;            
-            if (instance->filename)
-                free(instance->filename), instance->filename = NULL;            
-            if (instance->metadata)
-                STARCH_freeMetadata( &(instance->metadata) ), instance->metadata = NULL;            
-            if (instance->fp)
-                fclose(instance->fp), instance->fp = NULL;            
-            if (instance->av)
-                free(instance->av), instance->av = NULL;
-            if (instance->cTime)
-                free(instance->cTime), instance->cTime = NULL;
+            instance = *mdRecords + recIdx;
+            if (instance->filename) {
+                free(instance->filename);
+                instance->filename = NULL;
+            }
+            if (instance->metadata) {
+                STARCH_freeMetadata( &(instance->metadata) );
+                instance->metadata = NULL;
+            }
+            if (instance->fp) {
+                fclose(instance->fp);
+                instance->fp = NULL;
+            }
+            if (instance->av) {
+                free(instance->av);
+                instance->av = NULL;
+            }
+            if (instance->cTime) {
+                free(instance->cTime);
+                instance->cTime = NULL;
+            }
         }
     }
 
@@ -4451,7 +4579,7 @@ STARCHCAT_freeMetadataRecords (MetadataRecord **mdRecords, const unsigned int nu
 }
 
 int
-STARCHCAT_buildMetadataRecords (json_t ***metadataJSONs, MetadataRecord **mdRecords, const unsigned int firstArgc, const int argc, const char **argv)
+STARCHCAT_buildMetadataRecords(json_t ***metadataJSONs, MetadataRecord **mdRecords, const unsigned int firstArgc, const int argc, const char **argv)
 {
 #ifdef DEBUG
     fprintf (stderr, "\n--- STARCHCAT_buildMetadataRecords() ---\n");
@@ -4469,11 +4597,11 @@ STARCHCAT_buildMetadataRecords (json_t ***metadataJSONs, MetadataRecord **mdReco
     uint64_t mdOffset = 0;
     Boolean hFlag = kStarchFalse;
     MetadataRecord *mdRecord = NULL;
-    const Boolean suppressErrorMsgs = kStarchFalse; /* i.e., we want to see error messages */    
+    const Boolean suppressErrorMsgs = kStarchFalse; /* i.e., we want to see error messages */
     const Boolean preserveJSONRef = kStarchTrue;
     json_t *mdJSON = NULL;
     time_t creationTime;
-    struct tm *creationTimeInformation = NULL;    
+    struct tm *creationTimeInformation = NULL;
     size_t creationTimestampLength = STARCH_CREATION_TIMESTAMP_LENGTH;
     unsigned int numGzipRecs = 0U;
 
@@ -4502,7 +4630,7 @@ STARCHCAT_buildMetadataRecords (json_t ***metadataJSONs, MetadataRecord **mdReco
         fprintf(stderr, "\tidx/realIdx: %d/%d\n", idx, realIdx);
         fprintf(stderr, "\topening file: %s\n", inFile);
 #endif
-        
+
         /* parse the archive file's metadata */
         if ( STARCH_readJSONMetadata( &mdJSON, 
                       &inFilePtr, 
@@ -4600,7 +4728,7 @@ STARCHCAT_buildMetadataRecords (json_t ***metadataJSONs, MetadataRecord **mdReco
             }
             strncpy(cTime, creationTimestamp, strlen(creationTimestamp) + 1);
             free(creationTimestamp);
-            creationTimestamp = NULL;            
+            creationTimestamp = NULL;
         }
         mdRecord->cTime = cTime;
 
@@ -4646,19 +4774,19 @@ STARCHCAT_buildMetadataRecords (json_t ***metadataJSONs, MetadataRecord **mdReco
             version = NULL;
         }
     }
-    
+
     return STARCHCAT_EXIT_SUCCESS;
 }
 
-Boolean 
-STARCHCAT_fileExists (const char *fn) 
+Boolean
+STARCHCAT_fileExists(const char *fn)
 {
 #ifdef DEBUG
     fprintf (stderr, "\n--- STARCHCAT_fileExists() ---\n");
 #endif
     struct stat buf;
     int i = stat (fn, &buf);
-    
+
     /* 
        Regarding 64-bit support
        cf. http://www.gnu.org/s/libc/manual/html_node/Reading-Attributes.html
@@ -4674,8 +4802,8 @@ STARCHCAT_fileExists (const char *fn)
     return kStarchFalse;
 }
 
-void 
-STARCHCAT_printUsage (int errorType) 
+void
+STARCHCAT_printUsage(int errorType)
 {
 #ifdef DEBUG
     fprintf (stderr, "\n--- STARCHCAT_printUsage() ---\n");
@@ -4693,12 +4821,12 @@ STARCHCAT_printUsage (int errorType)
         if (result != -1) {
             switch (errorType) {
                 case STARCHCAT_VERSION_ERROR:
-                    fprintf(stdout, "%s\n binary version: %s (creates archive version: %s)\n", name, BEDOPS::revision(), avStr);
+                    fprintf(stdout, "%s\n  binary version: %s (%s) (creates archive version: %s)\n", name, BEDOPS::revision(), application_type, avStr);
                     break;
                 case STARCHCAT_FATAL_ERROR:
                 case STARCHCAT_HELP_ERROR:
                 default:
-                    fprintf(stderr, "%s\n citation: %s\n version:  %s\n authors:  %s\n%s\n", name, BEDOPS::citation(), BEDOPS::revision(), authors, usage);
+                    fprintf(stderr, "%s\n  citation: %s\n  version:  %s (%s)\n  authors:  %s\n%s\n", name, BEDOPS::citation(), BEDOPS::revision(), application_type, authors, usage);
                     break;
             }
         }
@@ -4706,8 +4834,8 @@ STARCHCAT_printUsage (int errorType)
     }
 }
 
-void 
-STARCHCAT_printRevision () 
+void
+STARCHCAT_printRevision()
 {
 #ifdef DEBUG
     fprintf (stderr, "\n--- STARCHCAT_printRevision() ---\n");
@@ -4722,15 +4850,15 @@ STARCHCAT_printRevision ()
 
     if (avStr != NULL) {
         int result = sprintf (avStr, "%d.%d.%d", STARCH_MAJOR_VERSION, STARCH_MINOR_VERSION, STARCH_REVISION_VERSION);
-        if (result != -1) {            
-            fprintf(stderr, "%s\n binary version: %s (creates archive version: %s)\n", name, BEDOPS::revision(), avStr);
+        if (result != -1) {
+            fprintf(stderr, "%s\n  binary version: %s (%s) (creates archive version: %s)\n", name, BEDOPS::revision(), application_type, avStr);
             free(avStr);
         }
     }
 }
 
 Boolean
-STARCHCAT_isArchiveConcurrent (const ArchiveVersion *av) 
+STARCHCAT_isArchiveConcurrent(const ArchiveVersion *av)
 {
 #ifdef DEBUG
     fprintf (stderr, "\n--- STARCHCAT_isArchiveConcurrent() ---\n");
@@ -4740,12 +4868,12 @@ STARCHCAT_isArchiveConcurrent (const ArchiveVersion *av)
         (av->minor == STARCH_MINOR_VERSION) && 
         (av->revision == STARCH_REVISION_VERSION))
         return kStarchTrue;
-    
+
     return kStarchFalse;
 }
 
 Boolean
-STARCHCAT_isArchiveNewerThan (const ArchiveVersion *av, const ArchiveVersion *comp)
+STARCHCAT_isArchiveNewerThan(const ArchiveVersion *av, const ArchiveVersion *comp)
 {
 #ifdef DEBUG
     fprintf (stderr, "\n--- STARCHCAT_isArchiveNewerThan() ---\n");
@@ -4760,13 +4888,13 @@ STARCHCAT_isArchiveNewerThan (const ArchiveVersion *av, const ArchiveVersion *co
            (av->minor == comp->minor) &&
            (av->revision > comp->revision) ) 
        )
-        return kStarchTrue;    
-        
+        return kStarchTrue;
+
     return kStarchFalse;
 }
 
 Boolean
-STARCHCAT_isArchiveConcurrentOrOlder (const ArchiveVersion *av) 
+STARCHCAT_isArchiveConcurrentOrOlder(const ArchiveVersion *av)
 {
 #ifdef DEBUG
     fprintf (stderr, "\n--- STARCHCAT_isArchiveConcurrentOrOlder() ---\n");
@@ -4778,12 +4906,12 @@ STARCHCAT_isArchiveConcurrentOrOlder (const ArchiveVersion *av)
            (av->revision <= STARCH_REVISION_VERSION) )
        )
         return kStarchTrue;
-    
+
     return kStarchFalse;
 }
 
 Boolean
-STARCHCAT_isArchiveOlder (const ArchiveVersion *av) 
+STARCHCAT_isArchiveOlder(const ArchiveVersion *av)
 {
 #ifdef DEBUG
     fprintf (stderr, "\n--- STARCHCAT_isArchiveOlder() ---\n");
@@ -4795,12 +4923,12 @@ STARCHCAT_isArchiveOlder (const ArchiveVersion *av)
            (av->revision <= STARCH_REVISION_VERSION) )
        )
         return kStarchTrue;
-    
+
     return kStarchFalse;
 }
 
 Boolean
-STARCHCAT_isArchiveNewer (const ArchiveVersion *av) 
+STARCHCAT_isArchiveNewer(const ArchiveVersion *av)
 {
 #ifdef DEBUG
     fprintf (stderr, "\n--- STARCHCAT_isArchiveNewer() ---\n");
@@ -4810,12 +4938,12 @@ STARCHCAT_isArchiveNewer (const ArchiveVersion *av)
     if (((av->major == STARCH_MAJOR_VERSION) && (av->minor > STARCH_MINOR_VERSION) && (av->revision >= STARCH_REVISION_VERSION)) ||
          (av->major > STARCH_MAJOR_VERSION))
         return kStarchTrue;
-    
+
     return kStarchFalse;
 }
 
 Boolean
-STARCHCAT_allocMetadataJSONObjects (json_t ***mdJSONs, const unsigned int numRecs) 
+STARCHCAT_allocMetadataJSONObjects(json_t ***mdJSONs, const unsigned int numRecs)
 {
 #ifdef DEBUG
     fprintf(stderr, "\n--- STARCHCAT_allocMetadataJSONObjects() ---\n");
@@ -4839,7 +4967,7 @@ STARCHCAT_allocMetadataJSONObjects (json_t ***mdJSONs, const unsigned int numRec
 }
 
 Boolean
-STARCHCAT_freeMetadataJSONObjects (json_t ***mdJSONs, const unsigned int numRecs)
+STARCHCAT_freeMetadataJSONObjects(json_t ***mdJSONs, const unsigned int numRecs)
 {
 #ifdef DEBUG
     fprintf(stderr, "\n--- STARCHCAT_freeMetadataJSONObjects() ---\n");
@@ -4848,12 +4976,12 @@ STARCHCAT_freeMetadataJSONObjects (json_t ***mdJSONs, const unsigned int numRecs
 
     for (idx = 0U; idx < numRecs; idx++)
         json_decref(*(*mdJSONs + idx));
-    
+
     return kStarchTrue;
 }
 
 Boolean
-STARCHCAT_checkMetadataJSONVersions (json_t ***mdJSONs, const unsigned int numRecs)
+STARCHCAT_checkMetadataJSONVersions(json_t ***mdJSONs, const unsigned int numRecs)
 {
 #ifdef DEBUG
     fprintf(stderr, "\n--- STARCHCAT_checkMetadataJSONVersions() ---\n");
@@ -4911,7 +5039,7 @@ STARCHCAT_checkMetadataJSONVersions (json_t ***mdJSONs, const unsigned int numRe
 #endif
                     }
                     streamArchiveVersion = NULL;
-                }            
+                }
             }
             streamArchive = NULL;
         }
@@ -4936,7 +5064,7 @@ STARCHCAT_checkMetadataJSONVersions (json_t ***mdJSONs, const unsigned int numRe
 }
 
 int
-STARCHCAT2_mergeChromosomeStreams (const ChromosomeSummaries *chrSums, const CompressionType outputType, const char *note, size_t *cumulativeOutputSize, const Boolean generatePerChrSignatureFlag, const Boolean reportProgressFlag, const LineCountType reportProgressN) 
+STARCHCAT2_mergeChromosomeStreams(const ChromosomeSummaries *chrSums, const CompressionType outputType, const char *note, size_t *cumulativeOutputSize, const Boolean generatePerChrSignatureFlag, const Boolean reportProgressFlag, const LineCountType reportProgressN)
 {
 #ifdef DEBUG
     fprintf(stderr, "\n--- STARCHCAT2_mergeChromosomeStreams() ---\n");
@@ -4947,7 +5075,7 @@ STARCHCAT2_mergeChromosomeStreams (const ChromosomeSummaries *chrSums, const Com
     CompressionType inputType;
     MetadataRecord *inputRecord = NULL;
     char *inputChr = NULL;
-    Metadata *outputMd = NULL;    
+    Metadata *outputMd = NULL;
     Metadata *headOutputMd = NULL;
     Boolean firstOutputMdFlag = kStarchTrue;
     Boolean hFlag = kStarchFalse; /* starchcat does not currently support headers */
@@ -4976,7 +5104,9 @@ STARCHCAT2_mergeChromosomeStreams (const ChromosomeSummaries *chrSums, const Com
         fprintf(stderr, "ERROR: Could not allocate space to archive version test struct.\n");
         return STARCHCAT_EXIT_FAILURE;
     }
-    av120->major = 1, av120->minor = 2, av120->revision = 0;
+    av120->major = 1;
+    av120->minor = 2;
+    av120->revision = 0;
 
     /*
         When we initially built the chromosome list, we applied a 
@@ -5251,18 +5381,24 @@ STARCHCAT2_mergeChromosomeStreams (const ChromosomeSummaries *chrSums, const Com
     fflush(stdout);
 
     /* cleanup */
-    if (dynamicMdBuffer)
-        free(dynamicMdBuffer), dynamicMdBuffer = NULL;
-    if (base64EncodedSha1Digest)
-        free(base64EncodedSha1Digest), base64EncodedSha1Digest = NULL;
-    if (av120)
-        free(av120), av120 = NULL;
+    if (dynamicMdBuffer) {
+        free(dynamicMdBuffer);
+        dynamicMdBuffer = NULL;
+    }
+    if (base64EncodedSha1Digest) {
+        free(base64EncodedSha1Digest);
+        base64EncodedSha1Digest = NULL;
+    }
+    if (av120) {
+        free(av120);
+        av120 = NULL;
+    }
 
     return STARCHCAT_EXIT_SUCCESS;
 }
 
-int 
-STARCHCAT2_setupBzip2OutputStream (BZFILE **bzStream, FILE *outStream) 
+int
+STARCHCAT2_setupBzip2OutputStream(BZFILE **bzStream, FILE *outStream)
 {
 #ifdef DEBUG
     fprintf(stderr, "\n--- STARCHCAT2_setupBzip2OutputStream() ---\n");
@@ -5305,7 +5441,7 @@ STARCHCAT2_setupBzip2OutputStream (BZFILE **bzStream, FILE *outStream)
 }
 
 int
-STARCHCAT2_setupGzipOutputStream (z_stream *zStream) 
+STARCHCAT2_setupGzipOutputStream(z_stream *zStream)
 {
 #ifdef DEBUG
     fprintf(stderr, "\n--- STARCHCAT2_setupGzipOutputStream() ---\n");
@@ -5342,7 +5478,7 @@ STARCHCAT2_setupGzipOutputStream (z_stream *zStream)
             default: {
                 fprintf(stderr, "ERROR: Unknown error with deflateInit() (err: %d)\n", zError);
                 break;
-            }            
+            }
         }
         return STARCHCAT_EXIT_FAILURE;
     }
@@ -5350,8 +5486,8 @@ STARCHCAT2_setupGzipOutputStream (z_stream *zStream)
     return STARCHCAT_EXIT_SUCCESS;
 }
 
-int      
-STARCHCAT2_testSummaryForChromosomeExistence (const char *chrName, const ChromosomeSummary *chrSummary, const size_t recIndex)
+int
+STARCHCAT2_testSummaryForChromosomeExistence(const char *chrName, const ChromosomeSummary *chrSummary, const size_t recIndex)
 {
 #ifdef DEBUG
     fprintf(stderr, "\n--- STARCHCAT2_testSummaryForChromosomeExistence() ---\n");
@@ -5374,8 +5510,8 @@ STARCHCAT2_testSummaryForChromosomeExistence (const char *chrName, const Chromos
     return STARCHCAT_EXIT_FAILURE;
 }
 
-int      
-STARCHCAT2_setupInitialFileOffsets (const char *chrName, const ChromosomeSummary *chrSummary, const size_t recIndex)
+int
+STARCHCAT2_setupInitialFileOffsets(const char *chrName, const ChromosomeSummary *chrSummary, const size_t recIndex)
 {
 #ifdef DEBUG
     fprintf(stderr, "\n--- STARCHCAT2_setupInitialFileOffsets() ---\n");
@@ -5411,8 +5547,8 @@ STARCHCAT2_setupInitialFileOffsets (const char *chrName, const ChromosomeSummary
     return STARCHCAT_EXIT_SUCCESS;
 }
 
-int      
-STARCHCAT2_setupBzip2InputStream (const size_t recIdx, const ChromosomeSummary *chrSummary, BZFILE **bzStream)
+int
+STARCHCAT2_setupBzip2InputStream(const size_t recIdx, const ChromosomeSummary *chrSummary, BZFILE **bzStream)
 {
 #ifdef DEBUG
     fprintf(stderr, "\n--- STARCHCAT2_setupBzip2InputStream() ---\n");
@@ -5422,11 +5558,11 @@ STARCHCAT2_setupBzip2InputStream (const size_t recIdx, const ChromosomeSummary *
     MetadataRecord *inRec = NULL;
     FILE *inFp = NULL;
     int bzError = BZ_OK;
-    
+
     inRecs = chrSummary->records;
-    inRec = inRecs[recIdx]; 
+    inRec = inRecs[recIdx];
     inFp = inRec->fp;
-    
+
     *bzStream = BZ2_bzReadOpen(&bzError, inFp, STARCH_BZ_VERBOSITY, STARCH_BZ_SMALL, NULL, 0);
 
     if (!*bzStream) {
@@ -5462,13 +5598,13 @@ STARCHCAT2_setupBzip2InputStream (const size_t recIdx, const ChromosomeSummary *
     return STARCHCAT_EXIT_SUCCESS;
 }
 
-int      
-STARCHCAT2_setupGzipInputStream (z_stream *zStream)
+int
+STARCHCAT2_setupGzipInputStream(z_stream *zStream)
 {
 #ifdef DEBUG
     fprintf(stderr, "\n--- STARCHCAT2_setupGzipInputStream() ---\n");
 #endif
-    
+
     int zError = Z_OK;
 
     zStream->zalloc = Z_NULL;
@@ -5488,7 +5624,7 @@ STARCHCAT2_setupGzipInputStream (z_stream *zStream)
 }
 
 int
-STARCHCAT2_breakdownBzip2InputStream (BZFILE **bzStream)
+STARCHCAT2_breakdownBzip2InputStream(BZFILE **bzStream)
 {
 #ifdef DEBUG
     fprintf(stderr, "\n--- STARCHCAT2_breakdownBzip2InputStream() ---\n");
@@ -5507,7 +5643,7 @@ STARCHCAT2_breakdownBzip2InputStream (BZFILE **bzStream)
 }
 
 int
-STARCHCAT2_breakdownGzipInputStream (z_stream *zStream)
+STARCHCAT2_breakdownGzipInputStream(z_stream *zStream)
 {
 #ifdef DEBUG
     fprintf(stderr, "\n--- STARCHCAT2_breakdownGzipInputStream() ---\n");
@@ -5525,8 +5661,8 @@ STARCHCAT2_breakdownGzipInputStream (z_stream *zStream)
     return STARCHCAT_EXIT_SUCCESS;
 }
 
-int      
-STARCHCAT2_breakdownBzip2OutputStream (BZFILE **bzStream, uint64_t *bzOutBytesConsumed, uint64_t *bzOutBytesWritten)
+int
+STARCHCAT2_breakdownBzip2OutputStream(BZFILE **bzStream, uint64_t *bzOutBytesConsumed, uint64_t *bzOutBytesWritten)
 {
 #ifdef DEBUG
     fprintf(stderr, "\n--- STARCHCAT2_breakdownBzip2OutputStream() ---\n");
@@ -5570,12 +5706,12 @@ STARCHCAT2_breakdownBzip2OutputStream (BZFILE **bzStream, uint64_t *bzOutBytesCo
 }
 
 int
-STARCHCAT2_breakdownGzipOutputStream (z_stream *zStream) 
+STARCHCAT2_breakdownGzipOutputStream(z_stream *zStream)
 {
 #ifdef DEBUG
     fprintf(stderr, "\n--- STARCHCAT2_breakdownGzipOutputStream() ---\n");
 #endif    
-    
+
     z_stream *zStreamPtr = zStream;
     int zError = Z_OK;
 
@@ -5606,8 +5742,8 @@ STARCHCAT2_breakdownGzipOutputStream (z_stream *zStream)
     return STARCHCAT_EXIT_SUCCESS;
 }
 
-int      
-STARCHCAT2_fillExtractionBufferFromBzip2Stream (Boolean *eofFlag, char *recordChromosome, char *extractionBuffer, size_t *nExtractionBuffer, BZFILE **bzStream, size_t *nBzRead, char *bzRemainderBuf, size_t *nBzRemainderBuf, TransformState *t_state)
+int
+STARCHCAT2_fillExtractionBufferFromBzip2Stream(Boolean *eofFlag, char *recordChromosome, char *extractionBuffer, size_t *nExtractionBuffer, BZFILE **bzStream, size_t *nBzRead, char *bzRemainderBuf, size_t *nBzRemainderBuf, TransformState *t_state)
 {
 #ifdef DEBUG
     fprintf(stderr, "\n--- STARCHCAT2_fillExtractionBufferFromBzip2Stream() (%s) ---\n", recordChromosome);
@@ -5800,7 +5936,7 @@ STARCHCAT2_fillExtractionBufferFromBzip2Stream (Boolean *eofFlag, char *recordCh
                                                       retransformedLineBuffer, 
                                                       &nRetransformedLineBuffer, 
                                                       &nRetransformedLineBufferPosition );
-                              
+
                 /* resize the extraction buffer, if we're getting too close to the maximum size of a line */
 #ifdef __cplusplus
                 if (static_cast<unsigned int>( *nExtractionBuffer - *t_nExtractionBufferPos ) < TOKENS_MAX_LENGTH) {
@@ -5866,20 +6002,26 @@ STARCHCAT2_fillExtractionBufferFromBzip2Stream (Boolean *eofFlag, char *recordCh
     *nBzRemainderBuf = bzCharIndex;
 
     /* cleanup */
-    if (bzReadBuf)
-        free(bzReadBuf), bzReadBuf = NULL;
-    
-    if (bzLineBuf)
-        free(bzLineBuf), bzLineBuf = NULL;
-    
-    if (retransformedLineBuffer)
-        free(retransformedLineBuffer), retransformedLineBuffer = NULL;
+    if (bzReadBuf) {
+        free(bzReadBuf);
+        bzReadBuf = NULL;
+    }
+
+    if (bzLineBuf) {
+        free(bzLineBuf);
+        bzLineBuf = NULL;
+    }
+
+    if (retransformedLineBuffer) {
+        free(retransformedLineBuffer);
+        retransformedLineBuffer = NULL;
+    }
 
     return STARCHCAT_EXIT_SUCCESS;
 }
 
-int      
-STARCHCAT2_fillExtractionBufferFromGzipStream (Boolean *eofFlag, FILE **inputFp, char *recordChromosome, char *extractionBuffer, size_t *nExtractionBuffer, z_stream *zStream, size_t *nZRead, char **zRemainderBuf, size_t *nZRemainderBuf, TransformState *t_state)
+int
+STARCHCAT2_fillExtractionBufferFromGzipStream(Boolean *eofFlag, FILE **inputFp, char *recordChromosome, char *extractionBuffer, size_t *nExtractionBuffer, z_stream *zStream, size_t *nZRead, char **zRemainderBuf, size_t *nZRemainderBuf, TransformState *t_state)
 {
 #ifdef DEBUG
     fprintf(stderr, "\n--- STARCHCAT2_fillExtractionBufferFromGzipStream() ---\n");
@@ -5994,8 +6136,10 @@ STARCHCAT2_fillExtractionBufferFromGzipStream (Boolean *eofFlag, FILE **inputFp,
 #endif
 
     if (zStream->avail_in == 0) {
-        free(zInBuf), zInBuf = NULL;
-        free(zReadBuf), zReadBuf = NULL;
+        free(zInBuf);
+        zInBuf = NULL;
+        free(zReadBuf);
+        zReadBuf = NULL;
         *eofFlag = kStarchTrue;
         return STARCHCAT_EXIT_SUCCESS;
     }
@@ -6058,7 +6202,7 @@ STARCHCAT2_fillExtractionBufferFromGzipStream (Boolean *eofFlag, FILE **inputFp,
             memset(*zRemainderBuf, 0, *nZRemainderBuf);
             *nZRemainderBuf = 0;
         }
-    
+
         *t_nExtractionBuffer = 0;
         *t_nExtractionBufferPos = 0;
 
@@ -6176,25 +6320,31 @@ STARCHCAT2_fillExtractionBufferFromGzipStream (Boolean *eofFlag, FILE **inputFp,
 #endif
 
     /* cleanup */
-    if (zInBuf)
-        free(zInBuf), zInBuf = NULL;
+    if (zInBuf) {
+        free(zInBuf);
+        zInBuf = NULL;
+    }
 
-    if (zReadBuf)
-        free(zReadBuf), zReadBuf = NULL;
+    if (zReadBuf) {
+        free(zReadBuf);
+        zReadBuf = NULL;
+    }
 
-    if (retransformedLineBuffer)
-        free(retransformedLineBuffer), retransformedLineBuffer = NULL;
+    if (retransformedLineBuffer) {
+        free(retransformedLineBuffer);
+        retransformedLineBuffer = NULL;
+    }
 
     return STARCHCAT_EXIT_SUCCESS;
 }
 
-int      
-STARCHCAT2_extractBedLine (Boolean *eobFlag, char *extractionBuffer, int *extractionBufferOffset, char **extractedElement) 
+int
+STARCHCAT2_extractBedLine(Boolean *eobFlag, char *extractionBuffer, int *extractionBufferOffset, char **extractedElement) 
 {
 #ifdef DEBUG
     fprintf(stderr, "\n--- STARCHCAT2_extractBedLine() ---\n");
 #endif
-    
+
 #ifdef __cplusplus
     size_t previousOffset = static_cast<size_t>( *extractionBufferOffset );
 #else
@@ -6224,8 +6374,8 @@ STARCHCAT2_extractBedLine (Boolean *eobFlag, char *extractionBuffer, int *extrac
     return STARCHCAT_EXIT_SUCCESS;
 }
 
-int      
-STARCHCAT2_parseCoordinatesFromBedLineV2 (Boolean *eobFlag, const char *extractedElement, SignedCoordType *start, SignedCoordType *stop)
+int
+STARCHCAT2_parseCoordinatesFromBedLineV2(Boolean *eobFlag, const char *extractedElement, SignedCoordType *start, SignedCoordType *stop)
 {
 #ifdef DEBUG
     fprintf(stderr, "\n--- STARCHCAT2_parseCoordinatesFromBedLineV2() ---\n");
@@ -6238,7 +6388,7 @@ STARCHCAT2_parseCoordinatesFromBedLineV2 (Boolean *eobFlag, const char *extracte
         *eobFlag = kStarchTrue;
         return STARCHCAT_EXIT_SUCCESS;
     }
-    
+
     errno = 0;
     int fieldIdx = 0;
     int charIdx = 0;
@@ -6251,7 +6401,8 @@ STARCHCAT2_parseCoordinatesFromBedLineV2 (Boolean *eobFlag, const char *extracte
     while (extractedElement[charIdx] != '\0') {
         if (extractedElement[charIdx] == tab) {
             withinFieldIdx = 0;
-            fieldIdx++, charIdx++;
+            fieldIdx++;
+            charIdx++;
             continue;
         }
         switch (fieldIdx) {
@@ -6270,7 +6421,7 @@ STARCHCAT2_parseCoordinatesFromBedLineV2 (Boolean *eobFlag, const char *extracte
         }
         charIdx++;
     }
-    
+
 #ifdef __cplusplus
     result = static_cast<SignedCoordType>( strtoll(startStr, NULL, STARCH_RADIX) );
 #else
@@ -6310,8 +6461,8 @@ STARCHCAT2_parseCoordinatesFromBedLineV2 (Boolean *eobFlag, const char *extracte
     return STARCH_EXIT_SUCCESS;
 }
 
-int      
-STARCHCAT2_parseCoordinatesFromBedLineV2p2 (Boolean *eobFlag, const char *extractedElement, SignedCoordType *start, SignedCoordType *stop, char **remainder)
+int
+STARCHCAT2_parseCoordinatesFromBedLineV2p2(Boolean *eobFlag, const char *extractedElement, SignedCoordType *start, SignedCoordType *stop, char **remainder)
 {
 #ifdef DEBUG
     fprintf(stderr, "\n--- STARCHCAT2_parseCoordinatesFromBedLineV2p2() ---\n");
@@ -6324,7 +6475,7 @@ STARCHCAT2_parseCoordinatesFromBedLineV2p2 (Boolean *eobFlag, const char *extrac
         *eobFlag = kStarchTrue;
         return STARCHCAT_EXIT_SUCCESS;
     }
-    
+
     errno = 0;
     int fieldIdx = 0;
     int charIdx = 0;
@@ -6364,7 +6515,7 @@ STARCHCAT2_parseCoordinatesFromBedLineV2p2 (Boolean *eobFlag, const char *extrac
         }
         charIdx++;
     }
-    
+
 #ifdef __cplusplus
     result = static_cast<SignedCoordType>( strtoll(startStr, NULL, STARCH_RADIX) );
 #else
@@ -6404,7 +6555,7 @@ STARCHCAT2_parseCoordinatesFromBedLineV2p2 (Boolean *eobFlag, const char *extrac
     return STARCH_EXIT_SUCCESS;
 }
 
-int      
+int
 STARCHCAT2_addLowestBedElementToCompressionBuffer (char *compressionBuffer, const char *extractedElement, LineCountType *compressionLineCount)
 {
 #ifdef DEBUG
@@ -6421,15 +6572,22 @@ STARCHCAT2_addLowestBedElementToCompressionBuffer (char *compressionBuffer, cons
     return STARCH_EXIT_SUCCESS;
 }
 
-int      
+int
 STARCHCAT2_transformCompressionBuffer (const char *compBuf, char *retransBuf, TransformState *retransState)
 {
 #ifdef DEBUG
     fprintf(stderr, "\n--- STARCHCAT2_transformCompressionBuffer() ---\n");
 #endif
 
+#if CLANG_COMPILER
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wpointer-bool-conversion"
+#endif
     if ((!retransState->r_chromosome) || (strlen(retransState->r_chromosome) == 0))
         return STARCH_EXIT_FAILURE;
+#if CLANG_COMPILER
+#pragma clang diagnostic pop
+#endif
 
     static const char tab                                  = '\t';
     size_t nCompBuf                                        = strlen(compBuf);
@@ -6539,7 +6697,7 @@ STARCHCAT2_transformCompressionBuffer (const char *compBuf, char *retransBuf, Tr
                     }
                 }
                 *nRetransBuf = strlen(retransBuf);
-                
+
                 /* statistics */
                 *retransLastPosition = *retransStop;
 #ifdef __cplusplus
@@ -6575,16 +6733,20 @@ STARCHCAT2_transformCompressionBuffer (const char *compBuf, char *retransBuf, Tr
         }
     }
 
-    if (retransChromosome) 
-        free(retransChromosome), retransChromosome = NULL;
-    if (retransRemainder)
-        free(retransRemainder), retransRemainder = NULL;
+    if (retransChromosome) {
+        free(retransChromosome);
+        retransChromosome = NULL;
+    }
+    if (retransRemainder) {
+        free(retransRemainder);
+        retransRemainder = NULL;
+    }
 
     return STARCH_EXIT_SUCCESS;
 }
 
 int
-STARCHCAT2_squeezeRetransformedOutputBufferToBzip2Stream (BZFILE **bzStream, char *transformedBuffer)
+STARCHCAT2_squeezeRetransformedOutputBufferToBzip2Stream(BZFILE **bzStream, char *transformedBuffer)
 {
 #ifdef DEBUG
     fprintf(stderr, "\n--- STARCHCAT2_squeezeRetransformedOutputBufferToBzip2Stream() ---\n");
@@ -6592,8 +6754,8 @@ STARCHCAT2_squeezeRetransformedOutputBufferToBzip2Stream (BZFILE **bzStream, cha
 
     int bzError = BZ_OK;
     size_t nTransformedBuffer = 0;
-    
-    if (transformedBuffer) 
+
+    if (transformedBuffer)
         nTransformedBuffer = strlen(transformedBuffer);
 
     if ((transformedBuffer) && (*bzStream) && (nTransformedBuffer > 0)) {
@@ -6683,8 +6845,8 @@ STARCHCAT2_squeezeRetransformedOutputBufferToGzipStream (z_stream *zStream, cons
     return STARCH_EXIT_SUCCESS;
 }
 
-int      
-STARCHCAT2_resetCompressionBuffer (char *compressionBuffer, LineCountType *compressionLineCount)
+int
+STARCHCAT2_resetCompressionBuffer(char *compressionBuffer, LineCountType *compressionLineCount)
 {
 #ifdef DEBUG
     fprintf(stderr, "\n--- STARCHCAT2_resetCompressionBuffer() ---\n");
@@ -6696,8 +6858,8 @@ STARCHCAT2_resetCompressionBuffer (char *compressionBuffer, LineCountType *compr
     return STARCH_EXIT_SUCCESS;
 }
 
-int      
-STARCHCAT2_finalizeMetadata (Metadata **outMd, char *finalChromosome, char *finalOutTagFn, uint64_t finalStreamSize, LineCountType finalLineCount, uint64_t finalTotalNonUniqueBases, uint64_t finalTotalUniqueBases, Boolean finalDuplicateElementExists, Boolean finalNestedElementExists, char *finalSignature, LineLengthType finalLineMaxStringLength)
+int
+STARCHCAT2_finalizeMetadata(Metadata **outMd, char *finalChromosome, char *finalOutTagFn, uint64_t finalStreamSize, LineCountType finalLineCount, uint64_t finalTotalNonUniqueBases, uint64_t finalTotalUniqueBases, Boolean finalDuplicateElementExists, Boolean finalNestedElementExists, char *finalSignature, LineLengthType finalLineMaxStringLength)
 {
 #ifdef DEBUG
     fprintf(stderr, "\n--- STARCHCAT2_finalizeMetadata() ---\n");
diff --git a/applications/bed/starch/src/starchcat.h b/applications/bed/starch/src/starchcat.h
index 3d1076e..762cefe 100644
--- a/applications/bed/starch/src/starchcat.h
+++ b/applications/bed/starch/src/starchcat.h
@@ -47,6 +47,16 @@ namespace starch {
   using namespace Bed;
 #endif
 
+#if BEDOPS_BINARY_TYPE == 0
+static const char* application_type = "typical";
+#else
+#if BEDOPS_BINARY_TYPE == 1
+static const char* application_type = "megarow";
+#else
+static const char* application_type = "typical";
+#endif
+#endif
+
 #define STARCHCAT_EXIT_FAILURE 0
 #define STARCHCAT_EXIT_SUCCESS 1
 #define STARCHCAT_FATAL_ERROR -1
@@ -57,6 +67,9 @@ namespace starch {
 #define STARCHCAT_RETRANSFORM_BUFFER_SIZE 1024*1024
 #define STARCHCAT_FIELD_BUFFER_MAX_LENGTH 16
 
+#define GCC_COMPILER (defined(__GNUC__) && !defined(__clang__))
+#define CLANG_COMPILER defined(__clang__)
+
 /*
     This is simply a struct containing a starch file's
     metadata, pathname and other data useful for our 
diff --git a/applications/bed/starch/src/starchcluster_gnuParallel.tcsh b/applications/bed/starch/src/starchcluster_gnuParallel.tcsh
index 4e36f13..613f22a 100755
--- a/applications/bed/starch/src/starchcluster_gnuParallel.tcsh
+++ b/applications/bed/starch/src/starchcluster_gnuParallel.tcsh
@@ -2,7 +2,7 @@
 
 # author  : sjn and apr
 # date    : Feb 2012
-# version : v2.4.26
+# version : v2.4.28
 
 #
 #    BEDOPS
diff --git a/applications/bed/starch/src/starchcluster_sge.tcsh b/applications/bed/starch/src/starchcluster_sge.tcsh
index 9ffb750..62c0700 100755
--- a/applications/bed/starch/src/starchcluster_sge.tcsh
+++ b/applications/bed/starch/src/starchcluster_sge.tcsh
@@ -2,7 +2,7 @@
 
 # author  : sjn and apr
 # date    : Feb 2012
-# version : v2.4.26
+# version : v2.4.28
 
 #
 #    BEDOPS
diff --git a/applications/bed/starch/src/starchcluster_slurm.tcsh b/applications/bed/starch/src/starchcluster_slurm.tcsh
index e8a955f..7503da2 100755
--- a/applications/bed/starch/src/starchcluster_slurm.tcsh
+++ b/applications/bed/starch/src/starchcluster_slurm.tcsh
@@ -2,7 +2,7 @@
 
 # author  : sjn and apr
 # date    : 13 Sep 2016
-# version : v2.4.26
+# version : v2.4.28
 
 #
 #    BEDOPS
diff --git a/applications/bed/starch/src/starchstrip.c b/applications/bed/starch/src/starchstrip.c
index 4650900..9a7cb8d 100644
--- a/applications/bed/starch/src/starchstrip.c
+++ b/applications/bed/starch/src/starchstrip.c
@@ -44,12 +44,12 @@ namespace {
 #endif
 
 int
-main (int argc, char** argv)
+main(int argc, char** argv)
 {
 #ifdef DEBUG
     fprintf(stderr, "\n--- starchstrip main() - enter ---\n");
 #endif
-    
+
     setlocale(LC_ALL, "POSIX");
     STARCHSTRIP_init_globals();
     STARCHSTRIP_init_command_line_options(argc, argv);
@@ -97,11 +97,11 @@ STARCHSTRIP_write_updated_metadata(FILE* os)
     }
 
     /* archive version and creation timestamp are NULL, in order to write default values */
-    md_json_buffer = STARCH_generateJSONMetadata(starchstrip_globals.output_records, 
-                                                 starchstrip_globals.archive_type, 
-                                                 starchstrip_globals.archive_version, 
-                                                 NULL, 
-                                                 starchstrip_globals.archive_note, 
+    md_json_buffer = STARCH_generateJSONMetadata(starchstrip_globals.output_records,
+                                                 starchstrip_globals.archive_type,
+                                                 starchstrip_globals.archive_version,
+                                                 NULL,
+                                                 starchstrip_globals.archive_note,
                                                  starchstrip_globals.archive_header_flag);
     if (!md_json_buffer) {
         fprintf(stderr, "Error: Could not write JSON-formatted metadata to buffer\n");
@@ -112,18 +112,18 @@ STARCHSTRIP_write_updated_metadata(FILE* os)
 
 #ifdef __cplusplus
     STARCH_SHA1_All(reinterpret_cast<const unsigned char *>( md_json_buffer ), strlen(md_json_buffer), sha1_digest);
-    STARCH_encodeBase64(&base64_encoded_sha1_digest, 
-            static_cast<const size_t>( STARCH2_MD_FOOTER_BASE64_ENCODED_SHA1_LENGTH ), 
-            reinterpret_cast<const unsigned char *>( sha1_digest ), 
+    STARCH_encodeBase64(&base64_encoded_sha1_digest,
+            static_cast<const size_t>( STARCH2_MD_FOOTER_BASE64_ENCODED_SHA1_LENGTH ),
+            reinterpret_cast<const unsigned char *>( sha1_digest ),
             static_cast<const size_t>( STARCH2_MD_FOOTER_SHA1_LENGTH ));
-    sprintf(footer_cumulative_record_size_buffer, "%020llu", static_cast<unsigned long long>( starchstrip_globals.cumulative_output_size )); 
+    sprintf(footer_cumulative_record_size_buffer, "%020llu", static_cast<unsigned long long>( starchstrip_globals.cumulative_output_size ));
 #else
     STARCH_SHA1_All((const unsigned char *) md_json_buffer, strlen(md_json_buffer), sha1_digest);
-    STARCH_encodeBase64(&base64_encoded_sha1_digest, 
-            (const size_t) STARCH2_MD_FOOTER_BASE64_ENCODED_SHA1_LENGTH, 
-            (const unsigned char *) sha1_digest, 
+    STARCH_encodeBase64(&base64_encoded_sha1_digest,
+            (const size_t) STARCH2_MD_FOOTER_BASE64_ENCODED_SHA1_LENGTH,
+            (const unsigned char *) sha1_digest,
             (const size_t) STARCH2_MD_FOOTER_SHA1_LENGTH);
-    sprintf(footer_cumulative_record_size_buffer, "%020llu", (unsigned long long) starchstrip_globals.cumulative_output_size); 
+    sprintf(footer_cumulative_record_size_buffer, "%020llu", (unsigned long long) starchstrip_globals.cumulative_output_size);
 #endif
 
     memcpy(footer_buffer, footer_cumulative_record_size_buffer, strlen(footer_cumulative_record_size_buffer));
@@ -141,8 +141,10 @@ STARCHSTRIP_write_updated_metadata(FILE* os)
     fflush(os);
 
     /* cleanup */
-    free(md_json_buffer), md_json_buffer = NULL;
-    free(base64_encoded_sha1_digest), base64_encoded_sha1_digest = NULL;
+    free(md_json_buffer);
+    md_json_buffer = NULL;
+    free(base64_encoded_sha1_digest);
+    base64_encoded_sha1_digest = NULL;
 
 #ifdef DEBUG
     fprintf(stderr, "--- STARCHSTRIP_write_updated_metadata() - exit  ---\n");
@@ -213,11 +215,11 @@ STARCHSTRIP_write_chromosome_streams(FILE* os)
 
 #ifdef __cplusplus
                 if (records_added == 0) {
-                    output_records_tail = STARCH_createMetadata( const_cast<char *>( iter->chromosome ), 
-                                                                 iter->filename, 
-                                                                 iter->size, 
-                                                                 iter->lineCount, 
-                                                                 iter->totalNonUniqueBases, 
+                    output_records_tail = STARCH_createMetadata( const_cast<char *>( iter->chromosome ),
+                                                                 iter->filename,
+                                                                 iter->size,
+                                                                 iter->lineCount,
+                                                                 iter->totalNonUniqueBases,
                                                                  iter->totalUniqueBases,
                                                                  iter->duplicateElementExists,
                                                                  iter->nestedElementExists,
@@ -226,12 +228,12 @@ STARCHSTRIP_write_chromosome_streams(FILE* os)
                     starchstrip_globals.output_records = output_records_tail;
                 }
                 else {
-                    output_records_tail = STARCH_addMetadata( output_records_tail, 
-                                                              const_cast<char *>( iter->chromosome ), 
-                                                              iter->filename, 
-                                                              iter->size, 
-                                                              iter->lineCount, 
-                                                              iter->totalNonUniqueBases, 
+                    output_records_tail = STARCH_addMetadata( output_records_tail,
+                                                              const_cast<char *>( iter->chromosome ),
+                                                              iter->filename,
+                                                              iter->size,
+                                                              iter->lineCount,
+                                                              iter->totalNonUniqueBases,
                                                               iter->totalUniqueBases,
                                                               iter->duplicateElementExists,
                                                               iter->nestedElementExists,
@@ -240,11 +242,11 @@ STARCHSTRIP_write_chromosome_streams(FILE* os)
                 }
 #else
                 if (records_added == 0) {
-                    output_records_tail = STARCH_createMetadata( (char *) iter->chromosome, 
-                                                                 iter->filename, 
-                                                                 iter->size, 
-                                                                 iter->lineCount, 
-                                                                 iter->totalNonUniqueBases, 
+                    output_records_tail = STARCH_createMetadata( (char *) iter->chromosome,
+                                                                 iter->filename,
+                                                                 iter->size,
+                                                                 iter->lineCount,
+                                                                 iter->totalNonUniqueBases,
                                                                  iter->totalUniqueBases,
                                                                  iter->duplicateElementExists,
                                                                  iter->nestedElementExists,
@@ -253,12 +255,12 @@ STARCHSTRIP_write_chromosome_streams(FILE* os)
                     starchstrip_globals.output_records = output_records_tail;
                 }
                 else {
-                    output_records_tail = STARCH_addMetadata( output_records_tail, 
-                                                             (char *) iter->chromosome, 
-                                                             iter->filename, 
-                                                             iter->size, 
-                                                             iter->lineCount, 
-                                                             iter->totalNonUniqueBases, 
+                    output_records_tail = STARCH_addMetadata( output_records_tail,
+                                                             (char *) iter->chromosome,
+                                                             iter->filename,
+                                                             iter->size,
+                                                             iter->lineCount,
+                                                             iter->totalNonUniqueBases,
                                                              iter->totalUniqueBases,
                                                              iter->duplicateElementExists,
                                                              iter->nestedElementExists,
@@ -300,7 +302,8 @@ STARCHSTRIP_write_header(FILE* os)
             fprintf(stderr, "Error: Could not write archive header to output file stream\n");
             exit(EIO); /* Input/output error (POSIX.1) */
         }
-        free(archive_header), archive_header = NULL;
+        free(archive_header);
+        archive_header = NULL;
         starchstrip_globals.cumulative_output_size += STARCH2_MD_HEADER_BYTE_LENGTH;
     }
     else {
@@ -475,7 +478,6 @@ STARCHSTRIP_check_chromosome_stream_names()
             }
         }
     }
-    
 
 #ifdef DEBUG
     fprintf(stderr, "--- STARCHSTRIP_check_chromosome_stream_names() - exit  ---\n");
@@ -489,7 +491,7 @@ STARCHSTRIP_check_archive_version()
     fprintf(stderr, "--- STARCHSTRIP_check_archive_version() - enter ---\n");
 #endif
 
-    if ((starchstrip_globals.archive_version->major < starchstrip_archive_version_major_minimum) 
+    if ((starchstrip_globals.archive_version->major < starchstrip_archive_version_major_minimum)
         ||
         ((starchstrip_globals.archive_version->major == starchstrip_archive_version_major_minimum) && (starchstrip_globals.archive_version->minor < starchstrip_archive_version_minor_minimum))) {
         fprintf(stderr, "Error: Archive must be v2.1 or greater -- use 'starchcat' to update archive, if needed\n");
@@ -508,21 +510,21 @@ STARCHSTRIP_init_archive_metadata()
     fprintf(stderr, "--- STARCHSTRIP_init_archive_metadata() - enter ---\n");
 #endif
 
-    if (STARCH_readJSONMetadata( &starchstrip_globals.archive_metadata_json, 
-                                 &starchstrip_globals.archive_fp, 
+    if (STARCH_readJSONMetadata( &starchstrip_globals.archive_metadata_json,
+                                 &starchstrip_globals.archive_fp,
 #ifdef __cplusplus
-                                 reinterpret_cast<const char *>( starchstrip_globals.archive_fn ), 
+                                 reinterpret_cast<const char *>( starchstrip_globals.archive_fn ),
 #else
-                                 (const char *) starchstrip_globals.archive_fn, 
-#endif
-                                 &starchstrip_globals.archive_records, 
-                                 &starchstrip_globals.archive_type, 
-                                 &starchstrip_globals.archive_version, 
-                                 &starchstrip_globals.archive_timestamp, 
-                                 &starchstrip_globals.archive_note, 
-                                 &starchstrip_globals.archive_metadata_offset, 
-                                 &starchstrip_globals.archive_header_flag, 
-                                 starchstrip_globals.archive_suppress_error_msgs, 
+                                 (const char *) starchstrip_globals.archive_fn,
+#endif
+                                 &starchstrip_globals.archive_records,
+                                 &starchstrip_globals.archive_type,
+                                 &starchstrip_globals.archive_version,
+                                 &starchstrip_globals.archive_timestamp,
+                                 &starchstrip_globals.archive_note,
+                                 &starchstrip_globals.archive_metadata_offset,
+                                 &starchstrip_globals.archive_header_flag,
+                                 starchstrip_globals.archive_suppress_error_msgs,
                                  starchstrip_globals.archive_preserve_json_ref) != STARCH_EXIT_SUCCESS) {
         fprintf(stderr, "Error: Could not read metadata from archive -- use 'unstarch --is-starch' to test if archive is valid\n");
         exit(EINVAL); /* Invalid argument (POSIX.1) */
@@ -648,11 +650,11 @@ STARCHSTRIP_init_chromosomes_list()
 #endif
 }
 
-static int 
+static int
 STARCHSTRIP_compare_chromosome_names(const void* a, const void* b)
 {
 #ifdef __cplusplus
-    return strcmp(*(const char**) a, *(const char**) b);
+    return strcmp((static_cast<const char*>(a)), (static_cast<const char*>(b)));
 #else
     return strcmp(*(const char**) a, *(const char**) b);
 #endif
@@ -701,26 +703,50 @@ STARCHSTRIP_delete_globals()
 #endif
 
     for (size_t idx = 0; idx < starchstrip_globals.chromosomes_num; ++idx) {
-        free(starchstrip_globals.chromosomes[idx]), starchstrip_globals.chromosomes[idx] = NULL;
+        free(starchstrip_globals.chromosomes[idx]);
+        starchstrip_globals.chromosomes[idx] = NULL;
     }
-    free(starchstrip_globals.chromosomes), starchstrip_globals.chromosomes = NULL;
+    free(starchstrip_globals.chromosomes);
+    starchstrip_globals.chromosomes = NULL;
     starchstrip_globals.chromosomes_num = 0;
-    
-    free(starchstrip_globals.chromosomes_str), starchstrip_globals.chromosomes_str = NULL;
+
+    free(starchstrip_globals.chromosomes_str);
+    starchstrip_globals.chromosomes_str = NULL;
 
     for (size_t idx = 0; idx < starchstrip_globals.chromosomes_to_process_num; ++idx) {
-        free(starchstrip_globals.chromosomes_to_process[idx]), starchstrip_globals.chromosomes_to_process[idx] = NULL;
+        free(starchstrip_globals.chromosomes_to_process[idx]);
+        starchstrip_globals.chromosomes_to_process[idx] = NULL;
     }
-    free(starchstrip_globals.chromosomes_to_process), starchstrip_globals.chromosomes_to_process = NULL;
+    free(starchstrip_globals.chromosomes_to_process);
+    starchstrip_globals.chromosomes_to_process = NULL;
     starchstrip_globals.chromosomes_to_process_num = 0;
 
-    free(starchstrip_globals.archive_fn), starchstrip_globals.archive_fn = NULL;
-    if (starchstrip_globals.archive_metadata_json) { json_decref(starchstrip_globals.archive_metadata_json), starchstrip_globals.archive_metadata_json = NULL; }
-    if (starchstrip_globals.archive_fp) { fclose(starchstrip_globals.archive_fp), starchstrip_globals.archive_fp = NULL; }
-    if (starchstrip_globals.archive_records) { STARCH_freeMetadata(&starchstrip_globals.archive_records), starchstrip_globals.archive_records = NULL; }
-    if (starchstrip_globals.archive_version) { free(starchstrip_globals.archive_version), starchstrip_globals.archive_version = NULL; }
-    if (starchstrip_globals.archive_timestamp) { free(starchstrip_globals.archive_timestamp), starchstrip_globals.archive_timestamp = NULL; } 
-    if (starchstrip_globals.archive_note) { free(starchstrip_globals.archive_note), starchstrip_globals.archive_note = NULL; }
+    free(starchstrip_globals.archive_fn);
+    starchstrip_globals.archive_fn = NULL;
+    if (starchstrip_globals.archive_metadata_json) {
+        json_decref(starchstrip_globals.archive_metadata_json);
+        starchstrip_globals.archive_metadata_json = NULL;
+    }
+    if (starchstrip_globals.archive_fp) {
+        fclose(starchstrip_globals.archive_fp);
+        starchstrip_globals.archive_fp = NULL;
+    }
+    if (starchstrip_globals.archive_records) {
+        STARCH_freeMetadata(&starchstrip_globals.archive_records);
+        starchstrip_globals.archive_records = NULL;
+    }
+    if (starchstrip_globals.archive_version) {
+        free(starchstrip_globals.archive_version);
+        starchstrip_globals.archive_version = NULL;
+    }
+    if (starchstrip_globals.archive_timestamp) {
+        free(starchstrip_globals.archive_timestamp);
+        starchstrip_globals.archive_timestamp = NULL;
+    }
+    if (starchstrip_globals.archive_note) {
+        free(starchstrip_globals.archive_note);
+        starchstrip_globals.archive_note = NULL;
+    }
 
     STARCH_freeMetadata(&starchstrip_globals.output_records);
 
@@ -848,13 +874,14 @@ STARCHSTRIP_print_version(FILE* os)
 #endif
 
     fprintf(os,
-            "%s\n"              \
-            "  citation: %s\n"  \
-            "  version:  %s\n"  \
+            "%s\n"                   \
+            "  citation: %s\n"       \
+            "  version:  %s (%s)\n"  \
             "  authors:  %s\n",
             name,
             BEDOPS::citation(),
             BEDOPS::revision(),
+            application_type,
             authors);
 
 #ifdef DEBUG
@@ -870,14 +897,15 @@ STARCHSTRIP_print_usage(FILE* os)
 #endif
 
     fprintf(os,
-            "%s\n"             \
-            "  citation: %s\n" \
-            "  version:  %s\n" \
-            "  authors:  %s\n" \
+            "%s\n"                  \
+            "  citation: %s\n"      \
+            "  version:  %s (%s)\n" \
+            "  authors:  %s\n"      \
             "%s\n",
             name,
             BEDOPS::citation(),
             BEDOPS::revision(),
+            application_type,
             authors,
             usage);
 
@@ -886,7 +914,7 @@ STARCHSTRIP_print_usage(FILE* os)
 #endif
 }
 
-static Boolean 
+static Boolean
 STARCHSTRIP_file_exists(char* fn)
 {
   struct stat buf;
diff --git a/applications/bed/starch/src/starchstrip.h b/applications/bed/starch/src/starchstrip.h
index 6ed19a1..34f36b2 100644
--- a/applications/bed/starch/src/starchstrip.h
+++ b/applications/bed/starch/src/starchstrip.h
@@ -68,6 +68,16 @@ static const char *usage = "\n" \
     "    --version                       Show binary version.\n\n" \
     "    --help                          Show this usage message.\n";
 
+#if BEDOPS_BINARY_TYPE == 0
+static const char* application_type = "typical";
+#else
+#if BEDOPS_BINARY_TYPE == 1
+static const char* application_type = "megarow";
+#else
+static const char* application_type = "typical";
+#endif
+#endif
+
 static struct globals {
     char* chromosomes_str;
     char** chromosomes;
diff --git a/applications/bed/starch/src/unstarch.c b/applications/bed/starch/src/unstarch.c
index 1bf649e..d10811a 100644
--- a/applications/bed/starch/src/unstarch.c
+++ b/applications/bed/starch/src/unstarch.c
@@ -54,8 +54,8 @@ namespace {
 } //  unnamed
 #endif
 
-int 
-main(int argc, char **argv) 
+int
+main(int argc, char **argv)
 {
 #ifdef DEBUG
     fprintf(stderr, "\n--- unstarch main() enter ---\n");
@@ -93,7 +93,7 @@ main(int argc, char **argv)
 
     setlocale(LC_ALL, "POSIX");
     if (UNSTARCH_parseCommandLineInputs( argc, argv, &whichChromosome, &inFile, &option, &parseValue ) != 0) {
-        switch (parseValue) {            
+        switch (parseValue) {
             case 0: {
                 resultValue = EXIT_FAILURE;
                 break;
@@ -209,15 +209,15 @@ main(int argc, char **argv)
         }
     }
 
-    if ((resultValue == 0) || 
-        (resultValue == UNSTARCH_ARCHIVE_VERSION_ERROR) || 
+    if ((resultValue == 0) ||
+        (resultValue == UNSTARCH_ARCHIVE_VERSION_ERROR) ||
         (resultValue == UNSTARCH_ARCHIVE_CREATION_TIMESTAMP_ERROR) ||
-        (resultValue == UNSTARCH_ELEMENT_COUNT_ALL_ERROR) || 
-        (resultValue == UNSTARCH_ELEMENT_COUNT_CHR_ERROR) || 
-        (resultValue == UNSTARCH_BASES_COUNT_ALL_ERROR) || 
-        (resultValue == UNSTARCH_BASES_COUNT_CHR_ERROR) || 
-        (resultValue == UNSTARCH_BASES_UNIQUE_COUNT_ALL_ERROR) || 
-        (resultValue == UNSTARCH_BASES_UNIQUE_COUNT_CHR_ERROR) || 
+        (resultValue == UNSTARCH_ELEMENT_COUNT_ALL_ERROR) ||
+        (resultValue == UNSTARCH_ELEMENT_COUNT_CHR_ERROR) ||
+        (resultValue == UNSTARCH_BASES_COUNT_ALL_ERROR) ||
+        (resultValue == UNSTARCH_BASES_COUNT_CHR_ERROR) ||
+        (resultValue == UNSTARCH_BASES_UNIQUE_COUNT_ALL_ERROR) ||
+        (resultValue == UNSTARCH_BASES_UNIQUE_COUNT_CHR_ERROR) ||
         (resultValue == UNSTARCH_LIST_CHROMOSOMES_ERROR) ||
         (resultValue == UNSTARCH_ARCHIVE_NOTE_ERROR) ||
         (resultValue == UNSTARCH_ARCHIVE_COMPRESSION_TYPE_ERROR) ||
@@ -232,21 +232,21 @@ main(int argc, char **argv)
         (resultValue == UNSTARCH_ELEMENT_MAX_STRING_LENGTH_CHR_ERROR) ||
         (resultValue == UNSTARCH_ELEMENT_MAX_STRING_LENGTH_ALL_ERROR))
     {
-        if (STARCH_readJSONMetadata( &metadataJSON, 
-                     &inFilePtr, 
+        if (STARCH_readJSONMetadata( &metadataJSON,
+                     &inFilePtr,
 #ifdef __cplusplus
-                     reinterpret_cast<const char *>( inFile ), 
+                     reinterpret_cast<const char *>( inFile ),
 #else
-                     (const char *) inFile, 
+                     (const char *) inFile,
 #endif
-                     &records, 
-                     &type, 
-                     &archiveVersion, 
-                     &archiveTimestamp, 
-                     &note, 
-                     &metadataOffset, 
-                     &headerFlag, 
-                     suppressErrorMsgs, 
+                     &records,
+                     &type,
+                     &archiveVersion,
+                     &archiveTimestamp,
+                     &note,
+                     &metadataOffset,
+                     &headerFlag,
+                     suppressErrorMsgs,
                      preserveJSONRef) != STARCH_EXIT_SUCCESS) {
             fprintf(stderr, "ERROR: Could not read metadata\n");
             resultValue = EXIT_FAILURE;
@@ -255,21 +255,21 @@ main(int argc, char **argv)
     else if (resultValue == UNSTARCH_IS_STARCH_ARCHIVE_ERROR)
     {
         /* we suppress warnings from STARCH_readJSONMetadata() */
-        if (STARCH_readJSONMetadata( &metadataJSON, 
-                     &inFilePtr, 
+        if (STARCH_readJSONMetadata( &metadataJSON,
+                     &inFilePtr,
 #ifdef __cplusplus
-                     reinterpret_cast<const char *>( inFile ), 
+                     reinterpret_cast<const char *>( inFile ),
 #else
-                     (const char *) inFile, 
+                     (const char *) inFile,
 #endif
-                     &records, 
-                     &type, 
-                     &archiveVersion, 
-                     &archiveTimestamp, 
-                     &note, 
-                     &metadataOffset, 
-                     &headerFlag, 
-                     kStarchTrue, 
+                     &records,
+                     &type,
+                     &archiveVersion,
+                     &archiveTimestamp,
+                     &note,
+                     &metadataOffset,
+                     &headerFlag,
+                     kStarchTrue,
                      kStarchTrue) != STARCH_EXIT_SUCCESS) {
             fprintf(stdout, "0\n"); /* false -- no valid metadata, therefore not a starch archive */
             return EXIT_FAILURE;
@@ -281,21 +281,21 @@ main(int argc, char **argv)
     }
     else if ( (resultValue == UNSTARCH_METADATA_SHA1_SIGNATURE_ERROR) || (resultValue == UNSTARCH_SIGNATURE_ERROR) || (resultValue == UNSTARCH_SIGNATURE_VERIFY_ERROR) )
     {
-        if (STARCH_readJSONMetadata( &metadataJSON, 
-                     &inFilePtr, 
+        if (STARCH_readJSONMetadata( &metadataJSON,
+                     &inFilePtr,
 #ifdef __cplusplus
-                     reinterpret_cast<const char *>( inFile ), 
+                     reinterpret_cast<const char *>( inFile ),
 #else
-                     (const char *) inFile, 
+                     (const char *) inFile,
 #endif
-                     &records, 
-                     &type, 
-                     &archiveVersion, 
-                     &archiveTimestamp, 
-                     &note, 
-                     &metadataOffset, 
-                     &headerFlag, 
-                     suppressErrorMsgs, 
+                     &records,
+                     &type,
+                     &archiveVersion,
+                     &archiveTimestamp,
+                     &note,
+                     &metadataOffset,
+                     &headerFlag,
+                     suppressErrorMsgs,
                      kStarchTrue) != STARCH_EXIT_SUCCESS) {
             fprintf(stderr, "ERROR: Could not read metadata\n");
             resultValue = EXIT_FAILURE;
@@ -312,17 +312,19 @@ main(int argc, char **argv)
 #endif
         if (jsonString) {
 #ifdef __cplusplus
-            STARCH_SHA1_All(reinterpret_cast<const unsigned char *>( reinterpret_cast<unsigned char *>( jsonString ) ), 
-                strlen(jsonString), 
-                mdHashBuffer);        
+            STARCH_SHA1_All(reinterpret_cast<const unsigned char *>( reinterpret_cast<unsigned char *>( jsonString ) ),
+                strlen(jsonString),
+                mdHashBuffer);
 #else
-            STARCH_SHA1_All((const unsigned char *) jsonString, 
+            STARCH_SHA1_All((const unsigned char *) jsonString,
                 strlen(jsonString),
-                mdHashBuffer);        
+                mdHashBuffer);
 #endif
-            free(jsonString), jsonString = NULL;
-            json_decref(metadataJSON), metadataJSON = NULL;
-        }   
+            free(jsonString);
+            jsonString = NULL;
+            json_decref(metadataJSON);
+            metadataJSON = NULL;
+        }
         else {
             fprintf(stderr, "ERROR: Could not encode JSON structure into string representation\n");
             resultValue = EXIT_FAILURE;
@@ -358,24 +360,24 @@ main(int argc, char **argv)
         else if (option && (strcmp(option, "version") == 0))
             resultValue = UNSTARCH_VERSION_ERROR;
         else if (option && ((strcmp(option, "archiveVersion") == 0) || (strcmp(option, "archive-version") == 0)))
-            resultValue = UNSTARCH_ARCHIVE_VERSION_ERROR;        
+            resultValue = UNSTARCH_ARCHIVE_VERSION_ERROR;
         else {
             if ((STARCH_MAJOR_VERSION == 1) || (archiveVersion->major == 1)) {
                 switch (type) {
                     case kBzip2: {
 #ifdef __cplusplus
-                        if (UNSTARCH_extractDataWithBzip2(&inFilePtr, 
-                                                          NULL, 
-                                                          whichChromosome, 
-                                                          reinterpret_cast<const Metadata *>( records ), 
-                                                          static_cast<const unsigned long long>( metadataOffset ), 
+                        if (UNSTARCH_extractDataWithBzip2(&inFilePtr,
+                                                          NULL,
+                                                          whichChromosome,
+                                                          reinterpret_cast<const Metadata *>( records ),
+                                                          static_cast<const unsigned long long>( metadataOffset ),
                                                           static_cast<const Boolean>( headerFlag )) != 0) {
 #else
-                        if (UNSTARCH_extractDataWithBzip2(&inFilePtr, 
-                                                          NULL, 
-                                                          whichChromosome, 
-                                                          (const Metadata *) records, 
-                                                          (const unsigned long long) metadataOffset, 
+                        if (UNSTARCH_extractDataWithBzip2(&inFilePtr,
+                                                          NULL,
+                                                          whichChromosome,
+                                                          (const Metadata *) records,
+                                                          (const unsigned long long) metadataOffset,
                                                           (const Boolean) headerFlag) != 0) {
 #endif
                             fprintf(stderr, "ERROR: Backend extraction failed (bzip2)\n");
@@ -385,18 +387,18 @@ main(int argc, char **argv)
                     }
                     case kGzip: {
 #ifdef __cplusplus
-                        if (UNSTARCH_extractDataWithGzip(&inFilePtr, 
-                                                         NULL, 
-                                                         whichChromosome, 
-                                                         reinterpret_cast<const Metadata *>( records ), 
-                                                         static_cast<const unsigned long long>( metadataOffset ), 
+                        if (UNSTARCH_extractDataWithGzip(&inFilePtr,
+                                                         NULL,
+                                                         whichChromosome,
+                                                         reinterpret_cast<const Metadata *>( records ),
+                                                         static_cast<const unsigned long long>( metadataOffset ),
                                                          static_cast<const Boolean>( headerFlag )) != 0) {
 #else
-                        if (UNSTARCH_extractDataWithGzip(&inFilePtr, 
-                                                         NULL, 
-                                                         whichChromosome, 
-                                                         (const Metadata *) records, 
-                                                         (const unsigned long long) metadataOffset, 
+                        if (UNSTARCH_extractDataWithGzip(&inFilePtr,
+                                                         NULL,
+                                                         whichChromosome,
+                                                         (const Metadata *) records,
+                                                         (const unsigned long long) metadataOffset,
                                                          (const Boolean) headerFlag) != 0) {
 #endif
                             fprintf(stderr, "ERROR: Backend extraction failed (gzip)\n");
@@ -415,18 +417,18 @@ main(int argc, char **argv)
                 switch (type) {
                     case kBzip2: {
 #ifdef __cplusplus
-                        if (UNSTARCH_extractDataWithBzip2(&inFilePtr, 
-                                                          NULL, 
-                                                          whichChromosome, 
-                                                          reinterpret_cast<const Metadata *>( records ), 
-                                                          static_cast<const unsigned long long>( sizeof(starchRevision2HeaderBytes) ), 
+                        if (UNSTARCH_extractDataWithBzip2(&inFilePtr,
+                                                          NULL,
+                                                          whichChromosome,
+                                                          reinterpret_cast<const Metadata *>( records ),
+                                                          static_cast<const unsigned long long>( sizeof(starchRevision2HeaderBytes) ),
                                                           static_cast<const Boolean>( headerFlag )) != 0) {
 #else
-                        if (UNSTARCH_extractDataWithBzip2(&inFilePtr, 
-                                                          NULL, 
-                                                          whichChromosome, 
-                                                          (const Metadata *) records, 
-                                                          (const unsigned long long) sizeof(starchRevision2HeaderBytes), 
+                        if (UNSTARCH_extractDataWithBzip2(&inFilePtr,
+                                                          NULL,
+                                                          whichChromosome,
+                                                          (const Metadata *) records,
+                                                          (const unsigned long long) sizeof(starchRevision2HeaderBytes),
                                                           (const Boolean) headerFlag) != 0) {
 #endif
                             fprintf(stderr, "ERROR: Backend extraction failed (bzip2)\n");
@@ -436,18 +438,18 @@ main(int argc, char **argv)
                     }
                     case kGzip: {
 #ifdef __cplusplus
-                        if (UNSTARCH_extractDataWithGzip(&inFilePtr, 
-                                                         NULL, 
-                                                         whichChromosome, 
-                                                         reinterpret_cast<const Metadata *>( records ), 
-                                                         static_cast<const unsigned long long>( sizeof(starchRevision2HeaderBytes) ), 
+                        if (UNSTARCH_extractDataWithGzip(&inFilePtr,
+                                                         NULL,
+                                                         whichChromosome,
+                                                         reinterpret_cast<const Metadata *>( records ),
+                                                         static_cast<const unsigned long long>( sizeof(starchRevision2HeaderBytes) ),
                                                          static_cast<const Boolean>( headerFlag )) != 0) {
 #else
-                        if (UNSTARCH_extractDataWithGzip(&inFilePtr, 
-                                                         NULL, 
-                                                         whichChromosome, 
-                                                         (const Metadata *) records, 
-                                                         (const unsigned long long) sizeof(starchRevision2HeaderBytes), 
+                        if (UNSTARCH_extractDataWithGzip(&inFilePtr,
+                                                         NULL,
+                                                         whichChromosome,
+                                                         (const Metadata *) records,
+                                                         (const unsigned long long) sizeof(starchRevision2HeaderBytes),
                                                          (const Boolean) headerFlag) != 0) {
 #endif
                             fprintf(stderr, "ERROR: Backend extraction failed (gzip)\n");
@@ -464,12 +466,12 @@ main(int argc, char **argv)
             }
             else if (STARCH_MAJOR_VERSION > 2) {
                 fprintf(stderr, "ERROR: Unstarch does not support extracting archives in this major version release (built as: %d.%d.%d)\n", STARCH_MAJOR_VERSION, STARCH_MINOR_VERSION, STARCH_REVISION_VERSION); // this is preserved for future-proofing test builds of Starch binaries
-                exit(EXIT_FAILURE);                
+                exit(EXIT_FAILURE);
             }
         }
     }
 
-    else if (resultValue == EXIT_FAILURE) 
+    else if (resultValue == EXIT_FAILURE)
         UNSTARCH_printUsage(EXIT_FAILURE);
 
     else if (resultValue == UNSTARCH_HELP_ERROR) {
@@ -549,7 +551,7 @@ main(int argc, char **argv)
                     UNSTARCH_printLineCountForChromosome(records, whichChromosome);
                 else {
                     fprintf(stderr, "ERROR: Archive version (%d.%d.%d) does not support element counting (starchcat the archive to bring its version to v1.3.0 or greater)\n", archiveVersion->major, archiveVersion->minor, archiveVersion->revision);
-                    resultValue = EXIT_FAILURE;                    
+                    resultValue = EXIT_FAILURE;
                 }
                 break;
             }
@@ -559,8 +561,8 @@ main(int argc, char **argv)
                     UNSTARCH_printLineCountForAllChromosomes(records);
                 else {
                     fprintf(stderr, "ERROR: Archive version (%d.%d.%d) does not support element counting (starchcat the archive to bring its version to v1.3.0 or greater)\n", archiveVersion->major, archiveVersion->minor, archiveVersion->revision);
-                    resultValue = EXIT_FAILURE;                    
-                }                
+                    resultValue = EXIT_FAILURE;
+                }
                 break;
             }
             case UNSTARCH_BASES_COUNT_CHR_ERROR: {
@@ -569,7 +571,7 @@ main(int argc, char **argv)
                     UNSTARCH_printNonUniqueBaseCountForChromosome(records, whichChromosome);
                 else {
                     fprintf(stderr, "ERROR: Archive version (%d.%d.%d) does not support base counting (starchcat the archive to bring its version to v1.4.0 or greater)\n", archiveVersion->major, archiveVersion->minor, archiveVersion->revision);
-                    resultValue = EXIT_FAILURE;                    
+                    resultValue = EXIT_FAILURE;
                 }
                 break;
             }
@@ -579,7 +581,7 @@ main(int argc, char **argv)
                     UNSTARCH_printNonUniqueBaseCountForAllChromosomes(records);
                 else {
                     fprintf(stderr, "ERROR: Archive version (%d.%d.%d) does not support base counting (starchcat the archive to bring its version to v1.4.0 or greater)\n", archiveVersion->major, archiveVersion->minor, archiveVersion->revision);
-                    resultValue = EXIT_FAILURE;                    
+                    resultValue = EXIT_FAILURE;
                 }
                 break;
             }
@@ -589,7 +591,7 @@ main(int argc, char **argv)
                     UNSTARCH_printUniqueBaseCountForChromosome(records, whichChromosome);
                 else {
                     fprintf(stderr, "ERROR: Archive version (%d.%d.%d) does not support base counting (starchcat the archive to bring its version to v1.4.0 or greater)\n", archiveVersion->major, archiveVersion->minor, archiveVersion->revision);
-                    resultValue = EXIT_FAILURE;                    
+                    resultValue = EXIT_FAILURE;
                 }
                 break;
             }
@@ -599,10 +601,10 @@ main(int argc, char **argv)
                     UNSTARCH_printUniqueBaseCountForAllChromosomes(records);
                 else {
                     fprintf(stderr, "ERROR: Archive version (%d.%d.%d) does not support base counting (starchcat the archive to bring its version to v1.4.0 or greater)\n", archiveVersion->major, archiveVersion->minor, archiveVersion->revision);
-                    resultValue = EXIT_FAILURE;                    
+                    resultValue = EXIT_FAILURE;
                 }
                 break;
-            }            
+            }
             case UNSTARCH_ARCHIVE_CREATION_TIMESTAMP_ERROR: {
                 if (((archiveVersion->major == 1) && (archiveVersion->minor >= 5)) ||
                     ((archiveVersion->major == 2) && (archiveVersion->minor >= 0))) {
@@ -612,9 +614,9 @@ main(int argc, char **argv)
                         return EXIT_FAILURE;
                     }
 #ifdef __cplusplus
-                    UNSTARCH_printArchiveTimestamp(const_cast<const char *>( archiveTimestamp )); 
+                    UNSTARCH_printArchiveTimestamp(const_cast<const char *>( archiveTimestamp ));
 #else
-                    UNSTARCH_printArchiveTimestamp((const char *)archiveTimestamp); 
+                    UNSTARCH_printArchiveTimestamp((const char *)archiveTimestamp);
 #endif
                 }
                 else {
@@ -762,23 +764,23 @@ main(int argc, char **argv)
             case UNSTARCH_SIGNATURE_VERIFY_ERROR: {
                 if ((archiveVersion->major == 2) && (archiveVersion->minor >= 2)) {
                     if (whichChromosome) {
-                        signatureVerificationFlag = UNSTARCH_verifySignature(&inFilePtr, 
+                        signatureVerificationFlag = UNSTARCH_verifySignature(&inFilePtr,
                                                                              records,
 #ifdef __cplusplus
-                                                                             static_cast<const unsigned long long>( sizeof(starchRevision2HeaderBytes) ), 
+                                                                             static_cast<const unsigned long long>( sizeof(starchRevision2HeaderBytes) ),
 #else
-                                                                             (const unsigned long long) sizeof(starchRevision2HeaderBytes), 
+                                                                             (const unsigned long long) sizeof(starchRevision2HeaderBytes),
 #endif
                                                                              whichChromosome,
                                                                              type);
                     }
                     else {
-                        signatureVerificationFlag = UNSTARCH_verifyAllSignatures(&inFilePtr, 
-                                                                                 records, 
+                        signatureVerificationFlag = UNSTARCH_verifyAllSignatures(&inFilePtr,
+                                                                                 records,
 #ifdef __cplusplus
-                                                                                 static_cast<const unsigned long long>( sizeof(starchRevision2HeaderBytes) ), 
+                                                                                 static_cast<const unsigned long long>( sizeof(starchRevision2HeaderBytes) ),
 #else
-                                                                                 (const unsigned long long) sizeof(starchRevision2HeaderBytes), 
+                                                                                 (const unsigned long long) sizeof(starchRevision2HeaderBytes),
 #endif
                                                                                  type);
                     }
@@ -815,8 +817,8 @@ main(int argc, char **argv)
     if ((resultValue == UNSTARCH_SIGNATURE_VERIFY_ERROR) && (signatureVerificationFlag == kStarchFalse)) {
         resultValue = EXIT_FAILURE;
     }
-    else if ((resultValue == UNSTARCH_HELP_ERROR) || 
-        (resultValue == UNSTARCH_VERSION_ERROR) || 
+    else if ((resultValue == UNSTARCH_HELP_ERROR) ||
+        (resultValue == UNSTARCH_VERSION_ERROR) ||
         (resultValue == UNSTARCH_ARCHIVE_VERSION_ERROR) ||
         (resultValue == UNSTARCH_ARCHIVE_CREATION_TIMESTAMP_ERROR) ||
         (resultValue == UNSTARCH_ELEMENT_COUNT_CHR_ERROR) ||
@@ -839,26 +841,25 @@ main(int argc, char **argv)
         (resultValue == UNSTARCH_SIGNATURE_ERROR) ||
         (resultValue == UNSTARCH_SIGNATURE_VERIFY_ERROR) ||
         (resultValue == UNSTARCH_ELEMENT_MAX_STRING_LENGTH_CHR_ERROR) ||
-        (resultValue == UNSTARCH_ELEMENT_MAX_STRING_LENGTH_ALL_ERROR) ) 
+        (resultValue == UNSTARCH_ELEMENT_MAX_STRING_LENGTH_ALL_ERROR) )
     {
         resultValue = EXIT_SUCCESS;
     }
-        
 
     /* cleanup */
     if (option)
         free(option);
     if (whichChromosome)
-        free(whichChromosome);     
+        free(whichChromosome);
     if (inFile)
-        free(inFile);     
+        free(inFile);
     if (inFilePtr)
-        fclose(inFilePtr);     
+        fclose(inFilePtr);
     if (records)
         STARCH_freeMetadata(&records);
     if (archiveVersion)
         free(archiveVersion);
-    if (archiveTimestamp) 
+    if (archiveTimestamp)
         free(archiveTimestamp);
 
 #ifdef DEBUG
@@ -1032,21 +1033,21 @@ UNSTARCH_parseCommandLineInputs(int argc, char **argv, char **chr, char **fn, ch
 #endif
 
 
-    if ( (! *fn)                                               || 
-         (! *chr)                                              || 
-         (strcmp(*fn, "-") == 0)                               || 
-         (strcmp(*fn, "--list") == 0)                          || 
-         (strcmp(*fn, "--listJSON") == 0)                      || 
-         (strcmp(*fn, "--list-json") == 0)                     || 
-         (strcmp(*fn, "--list-json-no-trailing-newline") == 0) || 
-         (strcmp(*fn, "--note") == 0)                          || 
-         (strcmp(*fn, "--archive-type") == 0)                  || 
-         (strcmp(*fn, "--archive-version") == 0)               || 
-         (strcmp(*fn, "--archive-timestamp") == 0)             || 
-         (strcmp(*fn, "--sha1-signature") == 0)                || 
-         (strcmp(*fn, "--signature") == 0)                     || 
-         (strcmp(*fn, "--verify-signature") == 0)              || 
-         (strcmp(*fn, "--is-starch") == 0) ) 
+    if ( (! *fn)                                               ||
+         (! *chr)                                              ||
+         (strcmp(*fn, "-") == 0)                               ||
+         (strcmp(*fn, "--list") == 0)                          ||
+         (strcmp(*fn, "--listJSON") == 0)                      ||
+         (strcmp(*fn, "--list-json") == 0)                     ||
+         (strcmp(*fn, "--list-json-no-trailing-newline") == 0) ||
+         (strcmp(*fn, "--note") == 0)                          ||
+         (strcmp(*fn, "--archive-type") == 0)                  ||
+         (strcmp(*fn, "--archive-version") == 0)               ||
+         (strcmp(*fn, "--archive-timestamp") == 0)             ||
+         (strcmp(*fn, "--sha1-signature") == 0)                ||
+         (strcmp(*fn, "--signature") == 0)                     ||
+         (strcmp(*fn, "--verify-signature") == 0)              ||
+         (strcmp(*fn, "--is-starch") == 0) )
     {
         if (ftr1)
             free(ftr1);
@@ -1062,7 +1063,7 @@ UNSTARCH_parseCommandLineInputs(int argc, char **argv, char **chr, char **fn, ch
 
     *optn = (ftr1) ? STARCH_strdup(ftr1) : ((ftr2) ? STARCH_strdup(ftr2) : NULL);
 
-    if (*optn) {        
+    if (*optn) {
         if (strcmp(*optn, "help") == 0) {
             *pval = UNSTARCH_HELP_ERROR;
             return *pval;
@@ -1070,7 +1071,7 @@ UNSTARCH_parseCommandLineInputs(int argc, char **argv, char **chr, char **fn, ch
         else if (strcmp(*optn, "version") == 0) {
             *pval = UNSTARCH_VERSION_ERROR;
             return *pval;
-        }    
+        }
         else if (strcmp(*optn, "is-starch") == 0) {
             *pval = UNSTARCH_IS_STARCH_ARCHIVE_ERROR;
             return *pval;
@@ -1118,7 +1119,7 @@ UNSTARCH_parseCommandLineInputs(int argc, char **argv, char **chr, char **fn, ch
         else if (strcmp(*optn, "bases") == 0) {
             *pval = (strcmp(*chr, "--bases") == 0) ? UNSTARCH_BASES_COUNT_ALL_ERROR : UNSTARCH_BASES_COUNT_CHR_ERROR;
             return *pval;
-        }        
+        }
         else if (strcmp(*optn, "bases-uniq") == 0) {
             *pval = (strcmp(*chr, "--bases-uniq") == 0) ? UNSTARCH_BASES_UNIQUE_COUNT_ALL_ERROR : UNSTARCH_BASES_UNIQUE_COUNT_CHR_ERROR;
             return *pval;
@@ -1139,9 +1140,9 @@ UNSTARCH_parseCommandLineInputs(int argc, char **argv, char **chr, char **fn, ch
             *pval = (strcmp(*chr, "--has-nested") == 0) ? UNSTARCH_ELEMENT_NESTED_ALL_INT_ERROR : UNSTARCH_ELEMENT_NESTED_CHR_INT_ERROR;
             return *pval;
         }
-        else if ((strcmp(*optn, "list") != 0) && 
-                 (strcmp(*optn, "listJSON") != 0) && 
-                 (strcmp(*optn, "list-json") != 0) && 
+        else if ((strcmp(*optn, "list") != 0) &&
+                 (strcmp(*optn, "listJSON") != 0) &&
+                 (strcmp(*optn, "list-json") != 0) &&
                  (strcmp(*optn, "list-json-no-trailing-newline") != 0) ) {
             fprintf(stderr, "ERROR: Wrong option specified\n");
             return UNSTARCH_FATAL_ERROR;
@@ -1151,8 +1152,8 @@ UNSTARCH_parseCommandLineInputs(int argc, char **argv, char **chr, char **fn, ch
     return EXIT_SUCCESS;
 }
 
-void 
-UNSTARCH_printUsage(int errorType) 
+void
+UNSTARCH_printUsage(int errorType)
 {
 #ifdef DEBUG
     fprintf(stderr, "\n--- UNSTARCH_printUsage() ---\n");
@@ -1170,13 +1171,14 @@ UNSTARCH_printUsage(int errorType)
                 case EXIT_FAILURE:
                 case UNSTARCH_HELP_ERROR:
                 default:
-                    fprintf(stderr, 
-                "%s\n citation: %s\n binary version: %s (extracts archive version: %s or older)\n authors: %s\n%s\n", 
-                name, 
-                BEDOPS::citation(), 
-                BEDOPS::revision(), 
-                avStr, 
-                authors, 
+                    fprintf(stderr,
+                "%s\n  citation: %s\n  binary version: %s (%s) (extracts archive version: %s or older)\n  authors: %s\n%s\n",
+                name,
+                BEDOPS::citation(),
+                BEDOPS::revision(),
+                application_type,
+                avStr,
+                authors,
                 usage);
                     break;
             }
@@ -1185,8 +1187,8 @@ UNSTARCH_printUsage(int errorType)
     }
 }
 
-void 
-UNSTARCH_printRevision() 
+void
+UNSTARCH_printRevision()
 {
 #ifdef DEBUG
     fprintf(stderr, "\n--- UNSTARCH_printRevision() ---\n");
@@ -1200,27 +1202,28 @@ UNSTARCH_printRevision()
     if (avStr != NULL) {
         int result = sprintf(avStr, "%d.%d.%d", STARCH_MAJOR_VERSION, STARCH_MINOR_VERSION, STARCH_REVISION_VERSION);
         if (result != -1)
-            fprintf(stdout, 
-            "%s\n binary version: %s (extracts archive version: %s or older)\n", 
-            name, 
-            BEDOPS::revision(), 
+            fprintf(stdout,
+            "%s\n  binary version: %s (%s) (extracts archive version: %s or older)\n",
+            name,
+            BEDOPS::revision(),
+            application_type,
             avStr);
         free(avStr);
     }
 }
 
-void 
-UNSTARCH_printArchiveVersion(const ArchiveVersion *av) 
+void
+UNSTARCH_printArchiveVersion(const ArchiveVersion *av)
 {
 #ifdef DEBUG
     fprintf(stderr, "\n--- UNSTARCH_printArchiveVersion() ---\n");
 #endif
     if (av)
-        fprintf(stdout, 
-        "%s\n archive version: %d.%d.%d\n", 
-        name, 
-        av->major, 
-        av->minor, 
+        fprintf(stdout,
+        "%s\n  archive version: %d.%d.%d\n",
+        name,
+        av->major,
+        av->minor,
         av->revision);
 }
 
@@ -1231,8 +1234,8 @@ UNSTARCH_printArchiveTimestamp(const char *at)
     fprintf(stderr, "\n--- UNSTARCH_printArchiveTimestamp() ---\n");
 #endif
     if (at)
-        fprintf(stdout, 
-        "%s\n", 
+        fprintf(stdout,
+        "%s\n",
         at);
 }
 
@@ -1243,23 +1246,23 @@ UNSTARCH_printNote(const char *note)
     fprintf(stderr, "\n--- UNSTARCH_printNote() ---\n");
 #endif
     if (note)
-        fprintf(stdout, 
-        "%s\n", 
+        fprintf(stdout,
+        "%s\n",
         note);
 }
 
 void
-UNSTARCH_printCompressionType(const CompressionType t) 
+UNSTARCH_printCompressionType(const CompressionType t)
 {
 #ifdef DEBUG
     fprintf(stderr, "\n--- UNSTARCH_printCompressionType() ---\n");
 #endif
     switch (t) {
         case kBzip2:
-            fprintf(stdout, "%s\n archive compression type: bzip2\n", name);
+            fprintf(stdout, "%s\n  archive compression type: bzip2\n", name);
             break;
         case kGzip:
-            fprintf(stdout, "%s\n archive compression type: gzip\n", name);
+            fprintf(stdout, "%s\n  archive compression type: gzip\n", name);
             break;
         case kUndefined:
             fprintf(stdout, "ERROR: compression type is undefined\n");
@@ -1282,14 +1285,14 @@ UNSTARCH_printMetadataSha1Signature(unsigned char *sha1Buffer)
 #endif
 
 #ifdef __cplusplus
-    STARCH_encodeBase64(&jsonBase64String, 
-            static_cast<const size_t>( STARCH2_MD_FOOTER_BASE64_ENCODED_SHA1_LENGTH ), 
-            const_cast<const unsigned char *>( sha1Buffer ), 
+    STARCH_encodeBase64(&jsonBase64String,
+            static_cast<const size_t>( STARCH2_MD_FOOTER_BASE64_ENCODED_SHA1_LENGTH ),
+            const_cast<const unsigned char *>( sha1Buffer ),
             static_cast<const size_t>( sha1BufferLength ));
 #else
-    STARCH_encodeBase64(&jsonBase64String, 
-            (const size_t) STARCH2_MD_FOOTER_BASE64_ENCODED_SHA1_LENGTH, 
-            (const unsigned char *) sha1Buffer, 
+    STARCH_encodeBase64(&jsonBase64String,
+            (const size_t) STARCH2_MD_FOOTER_BASE64_ENCODED_SHA1_LENGTH,
+            (const unsigned char *) sha1Buffer,
             (const size_t) sha1BufferLength);
 #endif
 
@@ -1298,7 +1301,8 @@ UNSTARCH_printMetadataSha1Signature(unsigned char *sha1Buffer)
         exit(-1);
     }
     fprintf(stdout, "%s\n", jsonBase64String);
-    free(jsonBase64String), jsonBase64String = NULL;
+    free(jsonBase64String);
+    jsonBase64String = NULL;
 }
 
 #ifdef __cplusplus
diff --git a/applications/bed/starch/src/unstarch.h b/applications/bed/starch/src/unstarch.h
index 24fac49..470771e 100644
--- a/applications/bed/starch/src/unstarch.h
+++ b/applications/bed/starch/src/unstarch.h
@@ -94,7 +94,6 @@ static const char *usage = "\n" \
     "                                     chr\"). If <chromosome> is specified but\n" \
     "                                     is not in the output list, nothing is\n" \
     "                                     returned.\n\n" \
-    
     "    --note                           Show descriptive note, if available.\n\n" \
     "    --signature                      Display the Base64-encoded SHA-1 data\n" \
     "                                     integrity signature for specified\n" \
@@ -117,14 +116,24 @@ static const char *usage = "\n" \
     "    --version                        Show binary version.\n\n" \
     "    --help                           Show this usage message.\n";
 
+#if BEDOPS_BINARY_TYPE == 0
+static const char* application_type = "typical";
+#else
+#if BEDOPS_BINARY_TYPE == 1
+static const char* application_type = "megarow";
+#else
+static const char* application_type = "typical";
+#endif
+#endif
+
 #ifdef __cplusplus
 namespace starch {
 #endif
 
-int                  UNSTARCH_parseCommandLineInputs(int argc, 
-                                                    char **argv, 
-                                                    char **chr, 
-                                                    char **fn, 
+int                  UNSTARCH_parseCommandLineInputs(int argc,
+                                                    char **argv,
+                                                    char **chr,
+                                                    char **fn,
                                                     char **optn,
                                                      int *pval);
 void                 UNSTARCH_printUsage(int t);
diff --git a/applications/other/switch-BEDOPS-binary-type b/applications/other/switch-BEDOPS-binary-type
new file mode 100755
index 0000000..e5b33ae
--- /dev/null
+++ b/applications/other/switch-BEDOPS-binary-type
@@ -0,0 +1,76 @@
+#!/bin/bash
+# author : sjn + apr
+# date : July.2017
+
+BINDIR=$(dirname $0)
+
+CMD="switch-BEDOPS-binary-type"
+
+help()
+{
+    echo "Switch the BEDOPS binary build from typical to megarow, or vice versa"
+    echo "Usage: ${CMD} [ --help ] [ --typical | --megarow ]" >&2
+    exit $1
+}
+
+TYPICAL=false
+MEGAROW=false
+EXTENSION="null"
+
+OPTSPEC=":tmh-:"
+while getopts "$OPTSPEC" OPTCHAR; do
+    case "${OPTCHAR}" in
+        -)
+            case "${OPTARG}" in
+                typical)
+                    TYPICAL=true
+                    EXTENSION="-typical"
+                    ;;
+                megarow)
+                    MEGAROW=true
+                    EXTENSION="-megarow"
+                    ;;
+                help)
+                    help 0
+                    ;;
+                *)
+                    help 1
+                    ;;
+            esac;;
+        t)
+            TYPICAL=true
+            EXTENSION="-typical"
+            ;;
+        m)
+            MEGAROW=true
+            EXTENSION="-megarow"
+            ;;
+        h)
+            help 0
+            ;;
+        *)
+            help 1
+            ;;
+    esac
+done
+
+if [[ $# -eq 0 ]]
+then
+    help 1
+fi
+
+# XOR
+if [[ ("${TYPICAL}" && !"${MEGAROW}") || (!"${TYPICAL}" && "${MEGAROW}") ]] 
+then
+    VARNAME=$(find ${BINDIR}/ -maxdepth 1 -mindepth 1 -type f -name \*${EXTENSION})
+    for V in ${VARNAME} 
+    do
+        BV=$(basename "$V")
+        NAME=`echo $BV | sed "s/${EXTENSION}//"`
+        ln -sf ${V} ${BINDIR}/${NAME}
+    done
+else
+    help 1
+fi
+
+exit 0
\ No newline at end of file
diff --git a/docs/conf.py b/docs/conf.py
index 5273a2a..dab9187 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -52,7 +52,7 @@ copyright = u'2011-2017, Shane Neph, Alex Reynolds'
 # The short X.Y version.
 version = '2.4'
 # The full version, including alpha/beta/rc tags.
-release = '2.4.26'
+release = '2.4.28'
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.
diff --git a/docs/content/installation.rst b/docs/content/installation.rst
index 7bea093..478773f 100644
--- a/docs/content/installation.rst
+++ b/docs/content/installation.rst
@@ -11,19 +11,14 @@ BEDOPS is available to users as :ref:`pre-built binaries <installation_via_packa
 Via pre-built packages
 ======================
 
-Pre-built binaries offer the easiest and fastest installation option for users of BEDOPS. At this time, we offer binaries for 32- and 64-bit versions of Linux and OS X (Intel) platforms.
+Pre-built binaries offer the easiest and fastest installation option for users of BEDOPS. At this time, we offer binaries for 64-bit versions of Linux and OS X (Intel) platforms. 32-bit binaries can be built via source code by adjusting compile-time variables.
 
 -----
 Linux
 -----
 
-1. Download the current 32- or 64-bit package for Linux from `Github BEDOPS Releases <https://github.com/bedops/bedops/releases>`_.
-2. Extract the package to a location of your choice. 
-   In the case of 32-bit Linux: ::
-
-       $ tar jxvf bedops_linux_i386-vx.y.z.tar.bz2
-
-   In the case of 64-bit Linux: ::
+1. Download the current 64-bit package for Linux from `Github BEDOPS Releases <https://github.com/bedops/bedops/releases>`_.
+2. Extract the package to a location of your choice. In the case of 64-bit Linux: ::
 
        $ tar jxvf bedops_linux_x86_64-vx.y.z.tar.bz2
 
@@ -124,7 +119,7 @@ Compilation of BEDOPS on Linux requires GCC 4.8.2 (both ``gcc`` and ``g++`` and
      $ cd bedops
      $ make
 
-.. tip:: BEDOPS now supports parallel builds. If you are compiling on a multicore or multiprocessor workstation, use ``make -j N`` where ``N`` is ``2``, ``4`` or however many cores or processors you have, in order to parallelize and speed up the build process.
+.. tip:: BEDOPS supports parallel builds, which speeds up compilation considerably. If you are compiling on a multicore or multiprocessor workstation, edit the ``JPARALLEL`` variable in the top-level Makefile, or override it, specifying the number of cores or processors you wish to use to compile.
 
 5. Once the build is complete, install compiled binaries and scripts to a local ``bin`` folder: 
 
@@ -146,9 +141,9 @@ Compilation of BEDOPS on Linux requires GCC 4.8.2 (both ``gcc`` and ``g++`` and
 Mac OS X
 --------
 
-In Mac OS X, you have two options to install BEDOPS via source code: Compile the code manually, or use the Homebrew package manager to manage installation of a prebuilt pacakge.
+In Mac OS X, you have a few options to install BEDOPS via source code: Compile the code manually, or use the Bioconda or Homebrew package manager to manage installation.
 
-Compilation of BEDOPS on Mac OS X via either procedure requires Clang/LLVM 3.5 or greater, which includes support for `C++11 <http://en.wikipedia.org/wiki/C%2B%2B11>`_ features required by core BEDOPS tools. Other tools may be required as described in the installation documentation that follows. GNU GCC is no longer required for compilation on OS X hosts.
+Compilation of BEDOPS on Mac OS X requires Clang/LLVM 3.5 or greater, which includes support for `C++11 <http://en.wikipedia.org/wiki/C%2B%2B11>`_ features required by core BEDOPS tools. Other tools may be required as described in the installation documentation that follows. GNU GCC is no longer required for compilation on OS X hosts.
 
 ^^^^^^^^^^^^^^^^^^
 Manual compilation
@@ -159,10 +154,10 @@ Manual compilation
    ::
 
      $ clang -v
-     Apple LLVM version 6.0 (clang-600.0.56) (based on LLVM 3.5svn)
+     Apple LLVM version 8.0.0 (clang-800.0.42.1)
      ...
 
-   For Mac OS X users, we recommend installing `Apple Xcode <https://developer.apple.com/xcode/>`_ and its Command Line Tools, via the ``Preferences > Downloads`` option within Xcode. At the time of this writing, Xcode 6.1.1 includes the necessary command-line tools to compile BEDOPS.
+   For Mac OS X users, we recommend installing `Apple Xcode <https://developer.apple.com/xcode/>`_ and its Command Line Tools, via the ``Preferences > Downloads`` option within Xcode. At the time of this writing, Xcode 8.2.1 (8C1002) includes the necessary command-line tools to compile BEDOPS.
 
 2. Install a ``git`` client of your choice, if you do not already have one installed. Github offers an `installation guide <https://help.github.com/articles/set-up-git#platform-all>`_.
 
@@ -179,7 +174,7 @@ Manual compilation
      $ cd bedops
      $ make
 
-.. tip:: BEDOPS now supports parallel builds. If you are compiling on a multicore or multiprocessor workstation, use ``make -j N`` where ``N`` is ``2``, ``4`` or however many cores or processors you have, in order to parallelize and speed up the build process.
+.. tip:: BEDOPS supports parallel builds, which speeds up compilation considerably. If you are compiling on a multicore or multiprocessor workstation, edit the ``JPARALLEL`` variable in the top-level Makefile, or override it, specifying the number of cores or processors you wish to use to compile.
 
 5. Once the build is complete, install compiled binaries and scripts to a local ``bin`` folder: 
 
@@ -196,6 +191,33 @@ Manual compilation
    Change this destination folder, as needed.
 
 ^^^^^^^^^^^^^^^^^^^^^^^^^
+Installation via Bioconda
+^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Bioconda is a bioinformatics resource that extends the Conda package manager with scientific software packages, including BEDOPS. We aim to keep the recipe concurrent with the present release; occasionally, it may be a minor version behind.
+
+What follows are steps taken from the `Bioconda installation page <https://bioconda.github.io/>`_. Use this guide for the most current set of instructions, which we briefly cover here:
+
+1. Follow the instructions on `Conda's website <http://conda.pydata.org/miniconda.html>`_ to install the Miniconda package, which installs the ``conda`` command-line tool.
+
+2. If you have not already done so, add the Conda channels that Bioconda depends upon:
+
+   ::
+
+      $ (conda config --add channels r)
+      $ conda config --add channels defaults
+      $ conda config --add channels conda-forge
+      $ conda config --add channels bioconda
+
+3. Install the BEDOPS package:
+
+   ::
+
+      $ conda install bedops
+
+`Other recipes <https://bioconda.github.io/recipes.html#recipes>`_ are available for installation, as well.
+   
+^^^^^^^^^^^^^^^^^^^^^^^^^
 Installation via Homebrew
 ^^^^^^^^^^^^^^^^^^^^^^^^^
 
@@ -206,10 +228,10 @@ Homebrew is a popular package management toolkit for Mac OS X. It facilitates ea
    ::
 
      $ clang -v
-     Apple LLVM version 6.0 (clang-600.0.56) (based on LLVM 3.5svn)
+     Apple LLVM version 8.0.0 (clang-800.0.42.1)
      ...
 
-   For Mac OS X users, we recommend installing `Apple Xcode <https://developer.apple.com/xcode/>`_ and its Command Line Tools, via the ``Preferences > Downloads`` option within Xcode. At the time of this writing, Xcode 6.1.1 includes the necessary command-line tools to compile BEDOPS.
+   For Mac OS X users, we recommend installing `Apple Xcode <https://developer.apple.com/xcode/>`_ and its Command Line Tools, via the ``Preferences > Downloads`` option within Xcode. At the time of this writing, Xcode 8.2.1 (8C1002) includes the necessary command-line tools to compile BEDOPS.
 
 2. Follow the instructions listed on the `Homebrew site <http://brew.sh>`_ to install the basic package manager components.
 
@@ -370,7 +392,7 @@ Building an OS X installer package for redistribution
 
      $ productsign --timestamp --sign "Developer ID Installer: Foo B. Baz" /tmp/BEDOPS.X.Y.Z.unsigned.pkg /tmp/BEDOPS.X.Y.Z.signed.pkg
 
-9. Compress the signed ``pkg`` file and publish via GitHub releases (see :ref:`release preparation <release>` for information about publishing the installer).
+9. Compress the signed ``pkg`` file (via OS X zip, for instance) and publish via GitHub releases (see :ref:`release preparation <release>` for information about publishing the installer).
 
 .. |--| unicode:: U+2013   .. en dash
 .. |---| unicode:: U+2014  .. em dash, trimming surrounding whitespace
diff --git a/docs/content/reference/file-management/compression.rst b/docs/content/reference/file-management/compression.rst
index 1519e13..07fd68b 100644
--- a/docs/content/reference/file-management/compression.rst
+++ b/docs/content/reference/file-management/compression.rst
@@ -9,4 +9,4 @@ Compression
    compression/starchsplit
    compression/starch-specification
    compression/starch-diff
-   
\ No newline at end of file
+   
diff --git a/docs/content/reference/file-management/compression/starch-diff.rst b/docs/content/reference/file-management/compression/starch-diff.rst
index 03bba1f..fe2b4d7 100644
--- a/docs/content/reference/file-management/compression/starch-diff.rst
+++ b/docs/content/reference/file-management/compression/starch-diff.rst
@@ -39,7 +39,7 @@ Use the ``--help`` option to list all options:
 
     starch-diff
       citation: http://bioinformatics.oxfordjournals.org/content/28/14/1919.abstract
-      version:  2.4.26
+      version:  2.4.28
       authors:  Alex Reynolds and Shane Neph
 
       $ starch-diff [ --chr <chr> ] starch-file-1 starch-file-2 [ starch-file-3 ... ]
diff --git a/docs/content/reference/file-management/compression/starch.rst b/docs/content/reference/file-management/compression/starch.rst
index 6e1a6ab..860cf07 100644
--- a/docs/content/reference/file-management/compression/starch.rst
+++ b/docs/content/reference/file-management/compression/starch.rst
@@ -49,7 +49,7 @@ Use the ``--help`` option to list all options:
 
   starch
    citation: http://bioinformatics.oxfordjournals.org/content/28/14/1919.abstract
-   binary version: 2.4.26 (creates archive version: 2.2.0)
+   binary version: 2.4.28 (creates archive version: 2.2.0)
    authors:  Alex Reynolds and Shane Neph
 
   USAGE: starch [ --note="foo bar..." ]
diff --git a/docs/content/reference/file-management/compression/starchcat.rst b/docs/content/reference/file-management/compression/starchcat.rst
index bdfcb29..f3f6906 100644
--- a/docs/content/reference/file-management/compression/starchcat.rst
+++ b/docs/content/reference/file-management/compression/starchcat.rst
@@ -57,7 +57,7 @@ Use the ``--help`` option to list all options:
 
   starchcat
    citation: http://bioinformatics.oxfordjournals.org/content/28/14/1919.abstract
-   version:  2.4.26
+   version:  2.4.28
    authors:  Alex Reynolds and Shane Neph
 
   USAGE: starchcat [ --note="..." ]
diff --git a/docs/content/reference/file-management/compression/starchstrip.rst b/docs/content/reference/file-management/compression/starchstrip.rst
index 5113f98..0a134c2 100644
--- a/docs/content/reference/file-management/compression/starchstrip.rst
+++ b/docs/content/reference/file-management/compression/starchstrip.rst
@@ -39,7 +39,7 @@ Use the ``--help`` option to list all options:
 
   starchstrip
     citation: http://bioinformatics.oxfordjournals.org/content/28/14/1919.abstract
-    version:  2.4.26
+    version:  2.4.28
     authors:  Alex Reynolds and Shane Neph
 
   USAGE: starchstrip [ --include | --exclude ] <chromosome-list> <starch-file>
@@ -98,4 +98,4 @@ As a second example, we can instead use the ``--exclude`` operand to copy over a
 
 .. |--| unicode:: U+2013   .. en dash
 .. |---| unicode:: U+2014  .. em dash, trimming surrounding whitespace
-   :trim:
\ No newline at end of file
+   :trim:
diff --git a/docs/content/reference/file-management/compression/unstarch.rst b/docs/content/reference/file-management/compression/unstarch.rst
index 294f359..d551328 100644
--- a/docs/content/reference/file-management/compression/unstarch.rst
+++ b/docs/content/reference/file-management/compression/unstarch.rst
@@ -43,7 +43,7 @@ Use the ``--help`` option to list all options:
 
   unstarch
    citation: http://bioinformatics.oxfordjournals.org/content/28/14/1919.abstract
-   binary version: 2.4.26 (extracts archive version: 2.2.0 or older)
+   binary version: 2.4.28 (extracts archive version: 2.2.0 or older)
    authors: Alex Reynolds and Shane Neph
 
   USAGE: unstarch [ <chromosome> ]  [ --elements | 
diff --git a/docs/content/reference/file-management/conversion/gtf2bed.rst b/docs/content/reference/file-management/conversion/gtf2bed.rst
index f0c2bf1..51f7ad4 100644
--- a/docs/content/reference/file-management/conversion/gtf2bed.rst
+++ b/docs/content/reference/file-management/conversion/gtf2bed.rst
@@ -41,18 +41,18 @@ To demonstrate these scripts, we use a sample GTF input called ``foo.gtf`` (see
 
 ::
 
-  chr20      protein_coding  exon    9874841 9874841 .       +       .       gene_id "ENSBTAG00000020601"; transcript_id "ENSBTAT0000002.4.26"; gene_name "ZNF366";
-  chr20      protein_coding  CDS     9873504 9874841 .       +       0       gene_id "ENSBTAG00000020601"; transcript_id "ENSBTAT0000002.4.26"; gene_name "ZNF366";
-  chr20      protein_coding  exon    9877488 9877679 .       +       .       gene_id "ENSBTAG00000020601"; transcript_id "ENSBTAT0000002.4.26";
+  chr20      protein_coding  exon    9874841 9874841 .       +       .       gene_id "ENSBTAG00000020601"; transcript_id "ENSBTAT0000002.4.28"; gene_name "ZNF366";
+  chr20      protein_coding  CDS     9873504 9874841 .       +       0       gene_id "ENSBTAG00000020601"; transcript_id "ENSBTAT0000002.4.28"; gene_name "ZNF366";
+  chr20      protein_coding  exon    9877488 9877679 .       +       .       gene_id "ENSBTAG00000020601"; transcript_id "ENSBTAT0000002.4.28";
 
 We can convert it to sorted BED data in the following manner:
 
 ::
 
   $ gtf2bed < foo.gtf
-  chr20   9874840 9874841 ZNF366  .       +       protein_coding  exon    .       gene_id "ENSBTAG00000020601"; transcript_id "ENSBTAT0000002.4.26"; gene_name "ZNF366"; zero_length_insertion "True";
-  chr20   9873503 9874841 ZNF366  .       +       protein_coding  CDS     0       gene_id "ENSBTAG00000020601"; transcript_id "ENSBTAT0000002.4.26"; gene_name "ZNF366";
-  chr20   9877487 9877679 ENSBTAG00000020601      .       +       protein_coding  exon    .       gene_id "ENSBTAG00000020601"; transcript_id "ENSBTAT0000002.4.26";
+  chr20   9874840 9874841 ZNF366  .       +       protein_coding  exon    .       gene_id "ENSBTAG00000020601"; transcript_id "ENSBTAT0000002.4.28"; gene_name "ZNF366"; zero_length_insertion "True";
+  chr20   9873503 9874841 ZNF366  .       +       protein_coding  CDS     0       gene_id "ENSBTAG00000020601"; transcript_id "ENSBTAT0000002.4.28"; gene_name "ZNF366";
+  chr20   9877487 9877679 ENSBTAG00000020601      .       +       protein_coding  exon    .       gene_id "ENSBTAG00000020601"; transcript_id "ENSBTAT0000002.4.28";
 
 .. tip:: After, say, performing set or statistical operations with :ref:`bedops`, :ref:`bedmap` etc., converting data back to GTF is accomplished through an ``awk`` statement that re-orders columns and shifts the coordinate index:
 
diff --git a/docs/content/reference/file-management/conversion/psl2bed.rst b/docs/content/reference/file-management/conversion/psl2bed.rst
index 0e4763d..4999bb5 100644
--- a/docs/content/reference/file-management/conversion/psl2bed.rst
+++ b/docs/content/reference/file-management/conversion/psl2bed.rst
@@ -57,7 +57,7 @@ To demonstrate these scripts, we use a sample PSL input called ``foo.psl`` (see
   30      0       0       0       0       0       0       0       +       foo     50      14      44      chr6    171115067       127685756       127685786       1       30,     14,     127685756,
   30      0       0       0       0       0       0       0       +       foo     50      14      44      chr6    171115067       93161871        93161901        1       30,     14,     93161871,
   31      0       0       0       0       0       0       0       +       foo     50      13      44      chr5    180915260       119897315       119897346       1       31,     13,     119897315,
-  30      0       0       0       0       0       0       0       +       foo     50      14      44      chr5    180915260       1232.4.26       1232.4.265       1       30,     14,     1232.4.26,
+  30      0       0       0       0       0       0       0       +       foo     50      14      44      chr5    180915260       1232.4.28       1232.4.285       1       30,     14,     1232.4.28,
   ...
 
 We can convert it to sorted BED data in the following manner:
diff --git a/docs/content/reference/file-management/conversion/vcf2bed.rst b/docs/content/reference/file-management/conversion/vcf2bed.rst
index 342f393..382c162 100644
--- a/docs/content/reference/file-management/conversion/vcf2bed.rst
+++ b/docs/content/reference/file-management/conversion/vcf2bed.rst
@@ -54,7 +54,7 @@ In addition, using any of these three custom options automatically results in pr
 ::
 
   #CHROM POS     ID        REF    ALT     QUAL FILTER INFO                              FORMAT      NA00001        NA00002        NA00003
-  20     12.4.267 microsat1 GTC    G,GTCT  50   PASS   NS=3;DP=9;AA=G                    GT:GQ:DP    0/1:35:4       0/2:17:2       1/1:40:3
+  20     12.4.287 microsat1 GTC    G,GTCT  50   PASS   NS=3;DP=9;AA=G                    GT:GQ:DP    0/1:35:4       0/2:17:2       1/1:40:3
 
 When using ``--snvs``, ``--insertions`` or ``--deletions``, this record is split into two distinct BED records and filtered depending on which custom option was chosen. The ``--insertions`` option would only export the single-base position of the insertion in this mixed variant, while ``--deletions`` would show the deletion.
 
diff --git a/docs/content/reference/file-management/sorting/sort-bed.rst b/docs/content/reference/file-management/sorting/sort-bed.rst
index 2ae6be6..7dc3b4c 100644
--- a/docs/content/reference/file-management/sorting/sort-bed.rst
+++ b/docs/content/reference/file-management/sorting/sort-bed.rst
@@ -43,7 +43,7 @@ The ``--help`` option is fairly basic, but describes the usage:
 
   sort-bed
     citation: http://bioinformatics.oxfordjournals.org/content/28/14/1919.abstract
-    version:  2.4.26
+    version:  2.4.28
     authors:  Scott Kuehn
 
   USAGE: sort-bed [--help] [--version] [--check-sort] [--max-mem <val>] [--tmpdir <path>] <file1.bed> <file2.bed> <...>
diff --git a/docs/content/reference/set-operations/bedextract.rst b/docs/content/reference/set-operations/bedextract.rst
index 625c972..3736c93 100644
--- a/docs/content/reference/set-operations/bedextract.rst
+++ b/docs/content/reference/set-operations/bedextract.rst
@@ -60,7 +60,7 @@ The ``--help`` option describes the functionality available to the end user:
 
   bedextract
     citation: http://bioinformatics.oxfordjournals.org/content/28/14/1919.abstract
-    version:  2.4.20
+    version:  2.4.27 (typical)
     authors:  Shane Neph & Alex Reynolds
 
       Every input file must be sorted per sort-bed.
diff --git a/docs/content/reference/set-operations/bedops.rst b/docs/content/reference/set-operations/bedops.rst
index c1c3abd..1f5cea8 100644
--- a/docs/content/reference/set-operations/bedops.rst
+++ b/docs/content/reference/set-operations/bedops.rst
@@ -53,7 +53,7 @@ The ``--help`` option describes the set operation and other options available to
 
   bedops
     citation: http://bioinformatics.oxfordjournals.org/content/28/14/1919.abstract
-    version:  2.4.26
+    version:  2.4.28
     authors:  Shane Neph & Scott Kuehn
 
         USAGE: bedops [process-flags] <operation> <File(s)>*
diff --git a/docs/content/reference/set-operations/closest-features.rst b/docs/content/reference/set-operations/closest-features.rst
index 6ea27ef..ddf906c 100644
--- a/docs/content/reference/set-operations/closest-features.rst
+++ b/docs/content/reference/set-operations/closest-features.rst
@@ -45,7 +45,7 @@ The ``--help`` option describes the various operations and options available to
 
   closest-features
     citation: http://bioinformatics.oxfordjournals.org/content/28/14/1919.abstract
-    version:  2.4.26
+    version:  2.4.28
     authors:  Shane Neph & Scott Kuehn
 
   USAGE: closest-features [Process-Flags] <input-file> <query-file>
diff --git a/docs/content/reference/statistics/bedmap.rst b/docs/content/reference/statistics/bedmap.rst
index 7ea7fad..986d2a4 100644
--- a/docs/content/reference/statistics/bedmap.rst
+++ b/docs/content/reference/statistics/bedmap.rst
@@ -48,7 +48,7 @@ The ``--help`` option describes the various mapping and analytical operations an
 
   bedmap
     citation: http://bioinformatics.oxfordjournals.org/content/28/14/1919.abstract
-    version:  2.4.26
+    version:  2.4.28
     authors:  Shane Neph & Scott Kuehn
 
    USAGE: bedmap [process-flags] [overlap-option] <operation(s)...> <ref-file> [map-file]
@@ -72,6 +72,7 @@ The ``--help`` option describes the various mapping and analytical operations an
                                 --bp-ovr, --range, --fraction-both, and --exact overlap options only.
         --header              Accept headers (VCF, GFF, SAM, BED, WIG) in any input file.
         --help                Print this message and exit successfully.
+        --min-memory          Minimize memory usage (slower).
         --multidelim <delim>  Change delimiter of multi-value output columns from ';' to <delim>.
         --prec <int>          Change the post-decimal precision of scores to <int>.  0 <= <int>.
         --sci                 Use scientific notation for score outputs.
@@ -420,9 +421,9 @@ As an example of using the ``--echo-map-id`` operator in a biological context, w
 ::
 
   chr1    4534161 4534177 -V_GRE_C        4.20586e-06     -       CGTACACACAGTTCTT
-  chr1    4534192.4.264205 -V_STAT_Q6      2.21622e-06     -       AGCACTTCTGGGA
+  chr1    4534192.4.284205 -V_STAT_Q6      2.21622e-06     -       AGCACTTCTGGGA
   chr1    4534209 4534223 +V_HNF4_Q6_01   6.93604e-06     +       GGACCAGAGTCCAC
-  chr1    4962522.4.262540 -V_GCNF_01      9.4497e-06      -       CCCAAGGTCAAGATAAAG
+  chr1    4962522.4.282540 -V_GCNF_01      9.4497e-06      -       CCCAAGGTCAAGATAAAG
   chr1    4962529 4962539 +V_NUR77_Q5     8.43564e-06     +       TTGACCTTGG
   ...
 
@@ -674,9 +675,9 @@ To demonstrate their use, we revisit the ``Motifs`` dataset, which includes *p*-
 ::
 
   chr1    4534161 4534177 -V_GRE_C        4.20586e-06     -       CGTACACACAGTTCTT
-  chr1    4534192.4.264205 -V_STAT_Q6      2.21622e-06     -       AGCACTTCTGGGA
+  chr1    4534192.4.284205 -V_STAT_Q6      2.21622e-06     -       AGCACTTCTGGGA
   chr1    4534209 4534223 +V_HNF4_Q6_01   6.93604e-06     +       GGACCAGAGTCCAC
-  chr1    4962522.4.262540 -V_GCNF_01      9.4497e-06      -       CCCAAGGTCAAGATAAAG
+  chr1    4962522.4.282540 -V_GCNF_01      9.4497e-06      -       CCCAAGGTCAAGATAAAG
   chr1    4962529 4962539 +V_NUR77_Q5     8.43564e-06     +       TTGACCTTGG
   ...
 
diff --git a/docs/content/release.rst b/docs/content/release.rst
index 812d498..93b7436 100644
--- a/docs/content/release.rst
+++ b/docs/content/release.rst
@@ -15,15 +15,15 @@ Preparing a major, minor or maintenance release of BEDOPS from a development bra
 
    a. Close out open documentation or feature issues, making necessary pushes to the current development branch.
 
-   b. If any issues can't be closed out, rename the assigned version tag to the next anticipated release version (*e.g.*, *v2.4.26* to *v2p5p0*, etc.)
+   b. If any issues can't be closed out, rename the assigned version tag to the next anticipated release version (*e.g.*, *v2.4.28* to *v2p5p0*, etc.)
 
 2. Pull the most recent commit for the development branch to a local folder on build hosts (Linux with sufficiently old kernel, current OS X, etc.).
 
    a. Follow the :ref:`Installation (via source code) <installation_via_source_code>` documentation to build BEDOPS for the given platform. 
 
-      1) For Linux, we build two versions, one 64-bit and one 32-bit. It may help to use `VirtualBox <https://www.virtualbox.org>`_ or a similar virtualization host to set up and run different (and consistent) versions of Linux build hosts.
+      1) For Linux, we build a 64-bit version. It may help to use `VirtualBox <https://www.virtualbox.org>`_ or a similar virtualization host to set up and run different (and consistent) versions of Linux build hosts.
 
-      2) For Mac OS X, we currently build the Mac target with whatever the modern Xcode and current OS X release happens to be (currently, command-line tools that ship with Xcode 7 and OS X El Capitan/10.11). If things work correctly, build flags generate "fat" binaries that should run on 10.7 and newer OS releases.
+      2) For Mac OS X, we currently build the Mac target with whatever the modern Xcode and current OS X release happens to be (currently, command-line tools that ship with Xcode 8 and OS X Sierra/10.12). If things work correctly, build flags generate 64-bit binaries that should run on 10.10 and newer OS releases.
 
    b. For all platforms, run test suites for various tools and conversion scripts; tests should pass on supported platforms. If not, add an Issue ticket, fix it, close it and start over with the build/test process.
 
@@ -34,9 +34,8 @@ Preparing a major, minor or maintenance release of BEDOPS from a development bra
    ::
 
      bedops_linux_x86_64-vX.Y.Z.tar.bz2 (64-bit)
-     bedops_linux_i386-vX.Y.Z.tar.bz2 (32-bit)
 
-   Run ``shasum -a 256`` on each tarball to get its SHA256 hash (store this SHA256 hash in a file for later retrieval).
+   Run ``shasum -a 256`` on the tarball to get its SHA256 hash (store this SHA256 hash in a file for later retrieval).
 
    For the OS X Installer, use ``productsign`` per :ref:`OS X Installer <installation_os_x_installer_construction>` documentation to digitally sign the package. Compress the Installer with the Finder or `zip`:
 
@@ -44,7 +43,7 @@ Preparing a major, minor or maintenance release of BEDOPS from a development bra
 
      BEDOPS.X.Y.Z.pkg.zip
 
-   The *X.Y.Z* scheme should follow the development branch name, *e.g.* 2.4.26, etc.
+   The *X.Y.Z* scheme should follow the development branch name, *e.g.* 2.4.28, etc.
 
 3. Collect tarballs and zipped Installer in one location for later addition with web browser, via BEDOPS Github web site.
 
@@ -63,7 +62,7 @@ Release
 
    Ideally, whatever steps are used to merge the development branch into the master branch should preserve the overall commit history.
 
-   As before, the *X.Y.Z* scheme should follow the development branch name, *e.g.* 2.4.26, etc.
+   As before, the *X.Y.Z* scheme should follow the development branch name, *e.g.* 2.4.28, etc.
 
 2. Add a `new release <https://github.com/bedops/bedops/releases/new>`_ via the Github site. Or click on the `Draft a new release <https://github.com/bedops/bedops/releases>`_ button from the Github Releases page.
 
@@ -85,8 +84,7 @@ Release
 
      ### Linux
      **bedops_linux_x86_64-vX.Y.Z.tar.bz2** (64-bit, SHA256: ``abcd1234``)
-     **bedops_linux_i386-vX.Y.Z.tar.bz2** (32-bit, SHA256: ``abcd1234``)
-     This package of BEDOPS vX.Y.Z binaries is for Linux 64- and 32-bit hosts. Pick the installer that matches your host architecture. If your host can run 64-bit binaries, we recommend downloading the 64-bit package.
+     This package of BEDOPS vX.Y.Z binaries is for Linux 64-bit hosts. Those who require 32-bit binaries will need to build them from source code.
 
      For installation instructions, please read [§2.1.1. Linux] (http://bedops.readthedocs.io/en/latest/content/installation.html#linux) of the BEDOPS Installation document.
 
@@ -94,11 +92,11 @@ Release
 
      ### Mac OS X
      **BEDOPS.X.Y.Z.pkg.zip**
-     This package of BEDOPS vX.Y.Z binaries is a digitally-signed installer for OS X (10.7 - 10.12) running on Intel-based Macs.
+     This package of BEDOPS vX.Y.Z is a digitally-signed installer for 64-bit binaries that run under OS X (10.10 - 10.12) on Intel-based Macs.
 
      For installation instructions, please read [§2.1.2. Mac OS X] (http://bedops.readthedocs.io/en/latest/content/installation.html#mac-os-x) of the BEDOPS Installation document.
 
-   d. Attach per-platform binaries to this release by dragging each of them into the field underneath the description text. It can take a few moments for the web browser to upload each binary into the release page, so be patient. There should be at least three binaries: two for Linux 64- and 32-bit, and one for (fat) Mac OS X.
+   d. Attach per-platform binaries to this release by dragging each of them into the field underneath the description text. It can take a few moments for the web browser to upload each binary into the release page, so be patient. There should be at least two binary packages: one for Linux 64-bit, and one for Mac OS X.
 
    e. Click the *Publish Release* button.
 
diff --git a/docs/content/revision-history.rst b/docs/content/revision-history.rst
index 3d70388..ef7ff80 100644
--- a/docs/content/revision-history.rst
+++ b/docs/content/revision-history.rst
@@ -12,6 +12,122 @@ Current version
 ===============
 
 -------
+v2.4.28
+-------
+
+Released: **August 18, 2017**
+
+* :ref:`bedmap <bedmap>`
+
+  * Patched `issue 191 <https://github.com/bedops/bedops/issues/191>`_ where :code:`--wmean` option was not recognized.
+
+* :ref:`bedextract <bedextract>`
+
+  * Updated documentation with fixed usage statement.
+
+* :ref:`sort-bed <sort-bed>`
+
+  * Patched typo in :code:`update-sort-bed-starch-slurm.py` script.
+
+  * Fixed bug with :code:`--max-mem` on properly ordering things on fourth and subsequent columns, when the genomic intervals are the same.
+
+* :ref:`starch <starch>`
+
+  * Updated Makefiles to remove `lib` on `clean` target and to help prevent :code:`ARCH` variable from getting clobbered by third-party package managers.
+
+* Build process
+
+  * Updated the OS X installer XML to resolve missing asset links.
+  
+  * Updated the :code:`module_binaries` target to copy over :code:`starchcluster_*` and :code:`starch-diff` assets for :code:`modules` distributions.
+
+=================
+Previous versions
+=================
+
+-------
+v2.4.27
+-------
+
+Released: **July 17, 2017**
+
+This revision of BEDOPS includes significant performance improvements for core tools: :code:`bedops`, :code:`bedmap`, and :code:`closest-features`. Performance tests were done with whole-genome TRANSFAC FIMO scans, with cache purges in between trials. 
+
+Pre-built binaries for Darwin and GNU/Linux targets include both the default :code:`typical` and :code:`megarow` builds of BEDOPS. The program names that you are accustomed to will remain as-is, but the binaries will exist as symbolic links pointing to the :code:`typical` builds. These links can be repointed to the :code:`megarow` builds by calling :code:`switch-BEDOPS-binary-type --megarow`, which will set the usual BEDOPS binaries to link to the :code:`megarow` builds. One can run :cod [...]
+
+The top-level Makefile includes some new variables for those who choose to build from source. The :code:`JPARALLEL` variable sets the number of CPUs to use in parallel when compiling BEDOPS, which can speed compilation time dramatically. The :code:`MASSIVE_REST_EXP`, :code:`MASSIVE_ID_EXP`, and :code:`MASSIVE_CHROM_EXP` are used when building the :code:`megarow` to support any required row lengths (build using :code:`make megarow`).  These are the exponents (the *n* in 2:sup:n) for holdi [...]
+
+To simplify distribution and support, we have removed pre-built 32-bit program versions in this release. These can be built from source by specifying the correct :code:`ARCH` value in the top-level Makefile. For OS X, our package installer now requires OS X version 10.10 or greater.
+
+Application-level notes follow:
+
+* :ref:`bedops <bedops>`
+
+  * Performance of :code:`bedops` tool improved, doing typical work in **76.5%** of the time of all previous versions.
+
+  * Performance of :code:`-u`/:code:`--everything` has improved, doing the same work in only **55.6%** of the time of previous versions when given a large number of input files.
+
+  * The :code:`megarow` build of this application handles input files with very long rows (4M+ characters). Such input might arise from conversion of very-long-read BAM files to BED via :code:`bam2bed`, such as those that may come from Nanopore or PacBio MinION platforms. This build requires more runtime memory than the default (:code:`typical`) build. Pertinent variables for :code:`megarow` execution can be modified through the make system without changing source.
+
+* :ref:`bedmap <bedmap>`
+
+  * Performance of :code:`bedmap` tool improved, doing the same work in **86.7%** of the time of all previous versions.
+
+  * Automatically use :code:`--faster` option when :code:`--exact` is used as the overlap criterion, or if the input files are formatted as Starch archives, no fully-nested elements exist in the archives, and the overlap criterion supports :code:`--faster` (such as :code:`--bp-ovr`, :code:`--exact`, and :code:`--range`).
+
+  * The :code:`megarow` build target handles input files with very long rows (4M+ characters). Such input might arise from conversion of very-long-read BAM files to BED via :code:`bam2bed`, such as those that may come from Nanopore or PacBio MinION platforms. This build requires more runtime memory than the default (:code:`typical`) build. Pertinent variables for :code:`megarow` execution can be modified through the make system without changing source.
+
+  * New :code:`--min-memory` option for use when the reference file has very large regions, and the map file has many small regions that fall within those larger regions. One example is when :code:`--range 100000` is used and the map file consists of whole-genome motif scan hits.  Memory overhead can be reduced to that used by all previous versions, up to and including v2.4.26.
+
+  * Added :code:`--faster` automatically when :code:`--exact` is used, which is robust even when nested elements exist in inputs.  Similarly, :code:`--faster` is used automatically when inputs are Starch-formatted archives, none of which have nested elements (see :code:`unstarch --has-nested`) when the overlap criterion allows for :code:`--faster`.
+
+* :ref:`closest-features <closest-features>`
+
+  * Performance of :code:`closest-features` tool has been improved, doing the same work in **87.7%** of the time of all previous versions.
+
+  * The :code:`megarow` build target is available to compile a version of the program that can handle input files with very long rows (4M+ characters).  This requires more runtime memory than the default build.  Pertinent variables can be modified through the make system without editing source.
+
+* :ref:`convert2bed <convert2bed>`
+
+  Numerous internal changes, including giving line functors the ability to resize the destination (write) buffer in mid-stream, along with increased integration with BEDOPS-wide constants. Destination buffer resizing is particularly useful when converting very-long-read BAM files containing numerous D (deletion) operations, such as when used with the new :code:`--split-with-deletions` option.
+
+  * :ref:`psl2bed <psl2bed>`
+
+    * Migrated storage of PSL conversion state from stack to heap, which helps address segmentation faults on OS X (thanks to rmartson at Biostars for the bug report).
+
+  * :ref:`bam2bed <bam2bed>` and :ref:`sam2bed <sam2bed>`
+
+    * Increased thread I/O heap buffer size to reduce likelihood of overflows while parsing reads from Nanopore and PacBio platforms.
+
+    * Added :code:`--split-with-deletions` option to split spliced junctions by :code:`N` and :code:`D` CIGAR operations. The :code:`--split` option now splits only on :code:`N` operations.
+
+    * Added :code:`--reduced` option to print first six columns of BED data to standard output.
+
+  * :ref:`gff2bed <gff2bed>`
+
+    * Resolved issue parsing GFF input with :code:`##FASTA` directive.
+
+* :ref:`sort-bed <sort-bed>`
+
+  * The :code:`megarow` build target is available to compile a version of the program that can handle input files with very long rows (4M+ characters).  This requires more runtime memory than the default build.  The pertinent variables can be modified through the make system without changing source.  This is useful for converting ultra-long reads from Nanopore and PacBio sequencing platforms to BED via :code:`bam2bed` / :code:`convert2bed`.
+  
+* :ref:`starch <starch>`
+
+  * Fixed a potential segmentation fault result with :code:`--header` usage.
+  
+* Starch C++ API
+
+  * Fixed output from :code:`bedops -u` (:code:`--everything`, or multiset union) on two or more Starch archives, where the remainder string was not being cleared correctly.
+  
+* :ref:`starch-diff <starch_diff>`
+  
+  * Improved usage statement to clarify output (cf. `Issue 180 <https://github.com/bedops/bedops/issues/180>`_).
+
+* Clang warnings
+
+  * Resolved compilation warnings for several binaries.
+
+-------
 v2.4.26
 -------
 
@@ -49,10 +165,6 @@ Released: **March 14, 2017**
 
   * Resolved segmentation fault with certain inputs, in follow-up to `this BEDOPS Forum post <http://bedops.uwencode.org/forum/index.php?topic=136.0>`_. Thanks to zebasilio for the report and feedback.
 
-=================
-Previous versions
-=================
-
 -------
 v2.4.25
 -------
diff --git a/docs/content/usage-examples/snps-within-dhses.rst b/docs/content/usage-examples/snps-within-dhses.rst
index ae741ac..4ffec47 100644
--- a/docs/content/usage-examples/snps-within-dhses.rst
+++ b/docs/content/usage-examples/snps-within-dhses.rst
@@ -30,7 +30,7 @@ The output of this :ref:`bedmap` statement might look something like this:
 
 ::
 
-  chr1    10799576    10799577    rs12046278  Systolic_blood_pressure Cardiovascular|chr1 10799460    10799610    MCV-1   9.18063
+  chr1    10799576    10799577    rs12.4.288  Systolic_blood_pressure Cardiovascular|chr1 10799460    10799610    MCV-1   9.18063
 
 The output is delimited by pipe symbols (``|``), showing the reference element (SNP) and the mapped element (DHS). 
 
diff --git a/docs/index.rst b/docs/index.rst
index 151b8a8..8dcaa62 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -57,23 +57,22 @@ Contents
       <div class="col_element">
          <img src="_images/linux_v2.png" style="height:26px; width: auto !important; margin-bottom:10px;">
          <ul style="list-style-type:square; font-size:smaller; margin-left:0; margin-right:0px; padding-right:0px; padding-left:20px;">
-            <li><a href="https://github.com/bedops/bedops/releases/download/v2.4.26/bedops_linux_x86_64-v2.4.26.tar.bz2">x86-64 (64-bit)</a> binaries</li>
-            <li><a href="https://github.com/bedops/bedops/releases/download/v2.4.26/bedops_linux_i386-v2.4.26.tar.bz2">i386 (32-bit)</a> binaries</li>
+            <li><a href="https://github.com/bedops/bedops/releases/download/v2.4.28/bedops_linux_x86_64-v2.4.28.tar.bz2">x86-64 (64-bit)</a> binaries</li>
             <li><a href="content/installation.html#linux">Installation instructions</a> for Linux hosts</li>
          </ul>
       </div>
       <div class="col_element">
          <img src="_images/macosx_v2.png" style="height:26px; width: auto !important; margin-bottom:10px;">
          <ul style="list-style-type:square; font-size:smaller; margin-left:0; margin-right:0px; padding-right:0px; padding-left:20px;">
-            <li><a href="https://github.com/bedops/bedops/releases/download/v2.4.26/BEDOPS.2.4.26.pkg.zip">Intel (32-/64-bit, 10.7-10.12)</a> installer package</li>
+            <li><a href="https://github.com/bedops/bedops/releases/download/v2.4.28/BEDOPS.2.4.28.pkg.zip">Intel (64-bit, 10.10-10.12)</a> installer package</li>
             <li><a href="content/installation.html#mac-os-x">Installation instructions</a> for Mac OS X hosts</li>
          </ul>
       </div>
       <div class="col_element">
          <img src="_images/source_v2.png" style="height:26px; width: auto !important; margin-bottom:10px;">
          <ul style="list-style-type:square; font-size:smaller; margin-left:0; margin-right:0px; padding-right:0px; padding-left:20px;">
-            <li><a href="https://github.com/bedops/bedops/archive/v2.4.26.tar.gz">Source code</a> (tar.gz)</li>
-            <li><a href="https://github.com/bedops/bedops/archive/v2.4.26.zip">Source code</a> (zip)</li>
+            <li><a href="https://github.com/bedops/bedops/archive/v2.4.28.tar.gz">Source code</a> (tar.gz)</li>
+            <li><a href="https://github.com/bedops/bedops/archive/v2.4.28.zip">Source code</a> (zip)</li>
             <li><a href="content/installation.html#installation-via-source-code">Compilation instructions</a></li>
          </ul>
       </div>
@@ -96,8 +95,7 @@ Contents
 .. |linux_downloads| raw:: html
 
    <ul style="list-style-type:square; font-size:smaller; margin:10px; padding:0;">
-   <li><a href="https://github.com/bedops/bedops/releases/download/v2.4.26/bedops_linux_x86_64-v2.4.26.tar.bz2">x86-64 (64-bit)</a> binaries</li>
-   <li><a href="https://github.com/bedops/bedops/releases/download/v2.4.26/bedops_linux_i386-v2.4.26.tar.bz2">i386 (32-bit)</a> binaries</li>
+   <li><a href="https://github.com/bedops/bedops/releases/download/v2.4.28/bedops_linux_x86_64-v2.4.28.tar.bz2">x86-64 (64-bit)</a> binaries</li>
    <li><a href="content/installation.html#linux">Installation instructions</a> for Linux hosts</li>
    </ul>
 
@@ -111,7 +109,7 @@ Contents
 .. |macosx_downloads| raw:: html
 
    <ul style="list-style-type:square; font-size:smaller; margin:10px; padding:0;">
-   <li><a href="https://github.com/bedops/bedops/releases/download/v2.4.26/BEDOPS.2.4.26.pkg.zip">Intel (32-/64-bit, 10.7-10.10)</a> installer package</li>
+   <li><a href="https://github.com/bedops/bedops/releases/download/v2.4.28/BEDOPS.2.4.28.pkg.zip">Intel (64-bit, 10.10-10.12)</a> installer package</li>
    <li><a href="content/installation.html#mac-os-x">Installation instructions</a> for Mac OS X hosts</li>
    </ul>
 
@@ -125,8 +123,8 @@ Contents
 .. |source_downloads| raw:: html
 
    <ul style="list-style-type:square; font-size:smaller; margin:10px; padding:0;">
-   <li><a href="https://github.com/bedops/bedops/archive/v2.4.26.tar.gz">Source code</a> (tar.gz)</li>
-   <li><a href="https://github.com/bedops/bedops/archive/v2.4.26.zip">Source code</a> (zip)</li>
+   <li><a href="https://github.com/bedops/bedops/archive/v2.4.28.tar.gz">Source code</a> (tar.gz)</li>
+   <li><a href="https://github.com/bedops/bedops/archive/v2.4.28.zip">Source code</a> (zip)</li>
    <li><a href="content/installation.html#installation-via-source-code">Compilation instructions</a></li>
    </ul>
 
diff --git a/interfaces/general-headers/algorithm/bed/FindBedRange.hpp b/interfaces/general-headers/algorithm/bed/FindBedRange.hpp
index 3b9ea5c..3d84acb 100644
--- a/interfaces/general-headers/algorithm/bed/FindBedRange.hpp
+++ b/interfaces/general-headers/algorithm/bed/FindBedRange.hpp
@@ -33,11 +33,15 @@
 #include "data/bed/BedDistances.hpp"
 #include "data/bed/BedTypes.hpp"
 #include "suite/BEDOPS.Constants.hpp"
+#include "utility/PooledMemory.hpp"
 
 namespace Bed {
 
   typedef Bed::SignedCoordType ByteOffset;
 
+  template <class BedType, std::size_t SZ>
+  class bed_check_iterator;
+
   namespace extract_details {
 
     template <typename BedType>
@@ -56,7 +60,17 @@ namespace Bed {
 
     typedef Bed::B3Rest QueryBedType;   // file 1
     typedef QueryBedType TargetBedType; // file 2 -> must be same type as QueryBedType
-    typedef std::map< QueryBedType, ByteOffset, CompBed<QueryBedType> > MType;
+    typedef std::map<QueryBedType, ByteOffset, CompBed<QueryBedType>> MType;
+
+    template <typename BedType, std::size_t Sz>
+    inline
+    void remove(Bed::bed_check_iterator<BedType*, Sz>& b, BedType* p)
+      { b.get_pool().release(p); }
+
+    template <typename Iter, typename BedType>
+    inline
+    void remove(Iter, BedType* b)
+      { delete b; }
 
   } // namespace extract_details
 
@@ -67,8 +81,10 @@ namespace Bed {
   template <typename TargetIter, typename Op>
   std::pair<bool, ByteOffset> find_bed_range(FILE* qfile, TargetIter titer, TargetIter teof, Op op) {
 
-    extract_details::TargetBedType reference;
-    extract_details::QueryBedType last, current;
+    TargetIter orig = titer;
+    auto reference = new extract_details::TargetBedType;
+    auto last = new extract_details::QueryBedType;
+    auto current = new extract_details::QueryBedType;
     Bed::Overlapping overlap, lessthan, greaterthan; // any overlap
     ByteOffset prev_pos = 0, cur_pos = 0, start_pos = 0, end_pos = 0;
     extract_details::MType bounds;
@@ -85,16 +101,16 @@ namespace Bed {
     while ( titer != teof ) {
       extract_details::TargetBedType* const refelement = *titer++;
       if ( donequery ) { // read through and delete items in [titer,teof) for posterity
-        delete refelement;
+        extract_details::remove(orig, refelement);
         continue;
-      } else if ( !first && (greaterthan(&last, refelement) > 0) ) { // last lower_bound is still applicable
-        delete refelement;
+      } else if ( !first && (greaterthan(last, refelement) > 0) ) { // last lower_bound is still applicable
+        extract_details::remove(orig, refelement);
         continue;
       }
 
       // only use reference where you need to compare to starting base.  Otherwise, use refelement.
-      reference = *refelement;
-      reference.end(reference.start()+1);
+      *reference = *refelement;
+      reference->end(reference->start()+1);
 
       start_pos = std::ftell(qfile);
       while ( true ) {
@@ -137,21 +153,21 @@ namespace Bed {
 
         // read in the line; incrementing to start of next QueryBedType element.
         prev_pos = std::ftell(qfile);
-        current.readline(qfile);
+        current->readline(qfile);
         cur_pos = std::ftell(qfile);
-        bounds.insert(std::make_pair(current, prev_pos));
+        bounds.insert(std::make_pair(*current, prev_pos));
 
         // compare 'current' to starting base
-        if ( lessthan(&current, &reference) < 0 ) {
+        if ( lessthan(current, reference) < 0 ) {
           count = (end_pos - cur_pos);
 
           start_pos = cur_pos;
           if ( 0 == count ) {
             if ( end_pos != at_end ) {
               prev_pos = cur_pos;
-              current.readline(qfile);
+              current->readline(qfile);
               cur_pos = std::ftell(qfile);
-              bounds.insert(std::make_pair(current, prev_pos));
+              bounds.insert(std::make_pair(*current, prev_pos));
             } else {
               prev_pos = at_end;
             }
@@ -166,24 +182,31 @@ namespace Bed {
 
       // spit elements in range
       if ( didWork ) {
-        while ( prev_pos != at_end && extract_details::check_overlap(&current, refelement) ) {
-          op(&current);
+        while ( prev_pos != at_end && extract_details::check_overlap(current, refelement) ) {
+          op(current);
           prev_pos = std::ftell(qfile);
           if ( prev_pos != at_end )
-            current.readline(qfile);
+            current->readline(qfile);
         } // while
       }
 
       if ( refelement )
-        delete refelement;
+        extract_details::remove(orig, refelement);
 
       std::fseek(qfile, prev_pos, SEEK_SET); // because start_pos = std::ftell(qfile); on next go-around
       if ( prev_pos == at_end )
         donequery = true;
-      last = current;
+      *last = *current;
       first = false;
     } // while
 
+    if ( reference )
+      delete reference;
+    if ( last )
+      delete last;
+    if ( current )
+      delete current;
+
     return std::make_pair(!first, prev_pos);
   }
 
diff --git a/interfaces/general-headers/algorithm/visitors/Visitors.hpp b/interfaces/general-headers/algorithm/visitors/Visitors.hpp
index ab43927..7eeff32 100644
--- a/interfaces/general-headers/algorithm/visitors/Visitors.hpp
+++ b/interfaces/general-headers/algorithm/visitors/Visitors.hpp
@@ -31,8 +31,8 @@ namespace Visitors {
   // Visitor that should be inherited when using sweep() algorithm.
   template <typename Ref, typename Map = Ref>
   struct Visitor {
-    typedef const Ref RefType;
-    typedef const Map MapType;
+    typedef Ref RefType;
+    typedef Map MapType;
 
     // interface for sweep()
     inline bool ManagesOwnMemory() const { return(false); }
diff --git a/interfaces/general-headers/algorithm/visitors/bed/BedBaseVisitor.hpp b/interfaces/general-headers/algorithm/visitors/bed/BedBaseVisitor.hpp
index 23b62b5..bfb8aa2 100644
--- a/interfaces/general-headers/algorithm/visitors/bed/BedBaseVisitor.hpp
+++ b/interfaces/general-headers/algorithm/visitors/bed/BedBaseVisitor.hpp
@@ -118,8 +118,8 @@ namespace Visitors {
   template <typename BedDist, typename Ref, typename Map = Ref>
   struct BedBaseVisitor {
      typedef BedDist DistType;
-     typedef const Ref RefType;
-     typedef const Map MapType;
+     typedef Ref RefType;
+     typedef Map MapType;
 
   protected:
      // typedefs
@@ -133,8 +133,8 @@ namespace Visitors {
 
      inline void OnStart(RefType* t) {
        // Give derived class the new reference
-       SetReference(t);
        ref_ = t;
+       SetReference(t);
      }
 
      inline void OnAdd(MapType* u) {
@@ -198,7 +198,7 @@ namespace Visitors {
            ++winIter;
          }
        } // while
-  
+
        auto cacheIter = cache_.begin();
        while ( cacheIter != cache_.end() ) {
          if ( 0 == dist_.Map2Ref(*cacheIter, ref_) ) {
diff --git a/interfaces/general-headers/algorithm/visitors/helpers/ProcessBedVisitorRow.hpp b/interfaces/general-headers/algorithm/visitors/helpers/ProcessBedVisitorRow.hpp
index f73c628..93e784a 100644
--- a/interfaces/general-headers/algorithm/visitors/helpers/ProcessBedVisitorRow.hpp
+++ b/interfaces/general-headers/algorithm/visitors/helpers/ProcessBedVisitorRow.hpp
@@ -29,6 +29,7 @@
 #include <type_traits>
 
 #include "algorithm/visitors/helpers/ProcessVisitorRow.hpp"
+#include "data/bed/Bed.hpp"
 #include "data/bed/BedCompare.hpp"
 #include "data/measurement/NaN.hpp"
 #include "utility/Formats.hpp"
@@ -204,13 +205,16 @@ namespace Visitors {
       }
 
       void operator()(const Signal::NaN& s) const {
-        throw(std::string("Unable to process a 'NAN' with PrintAllScorePrecision."));
+        PrintTypes::Print("");
       }
 
     protected:
       template <typename T>
       typename std::enable_if<T::UseRest, void>::type printRest(T* t) const {
-        PrintTypes::Print(t->rest()); // already includes '\t' out front
+        // PrintTypes::Print(t->rest()); // already includes '\t' out front
+        // t->full_rest() now includes t->id() and t->measurement(), exclude here
+        if ( t->full_rest()[0] != '\0' && t->rest_offset() >= 0 )
+          PrintTypes::Print(t->full_rest() + t->rest_offset());
       }
 
       template <typename T>
@@ -349,8 +353,21 @@ namespace Visitors {
       void operator()(T* t) const {
         static char const* id = "id-";
         static unsigned long rowID = 0;
+        static unsigned long subRowID = 0;
+        static T last;
+        static Bed::GenomicRestCompare<T> grc;
+        if ( !grc(&last, t) && !grc(t, &last) ) { // equal
+          static constexpr unsigned long sz = 1000;
+          static char formatted[sz+1];
+          formatted[0] = '\0';
+          std::snprintf(formatted, sz, "%s%lu.%06lu", id, rowID, ++subRowID);
+          PrintTypes::Print(formatted);
+          return;
+        }
+        last = *t;
         PrintTypes::Print(id);
         PrintTypes::Print(++rowID);
+        subRowID = 0;
       }
     };
 
diff --git a/interfaces/general-headers/algorithm/visitors/numerical/ExtremeVisitor.hpp b/interfaces/general-headers/algorithm/visitors/numerical/ExtremeVisitor.hpp
index f9c0fdc..f84e9c3 100644
--- a/interfaces/general-headers/algorithm/visitors/numerical/ExtremeVisitor.hpp
+++ b/interfaces/general-headers/algorithm/visitors/numerical/ExtremeVisitor.hpp
@@ -114,7 +114,7 @@ namespace Visitors {
       if ( !m_.empty() )
         pt_.operator()(onTies.breakTie(m_));
       else
-        pt_.operator()(nan);      
+        pt_.operator()(nan);
     }
 
 
diff --git a/interfaces/general-headers/algorithm/visitors/other/MultiVisitor.hpp b/interfaces/general-headers/algorithm/visitors/other/MultiVisitor.hpp
index d32b68e..e3f5683 100644
--- a/interfaces/general-headers/algorithm/visitors/other/MultiVisitor.hpp
+++ b/interfaces/general-headers/algorithm/visitors/other/MultiVisitor.hpp
@@ -68,14 +68,14 @@ namespace Visitors {
         pAll_(processAll), cnt_(0)
       { /* */ }
 
-    void Add(MapType const* u) {
-      void (BaseClass::*memberFuncPtr)(MapType const*) = &BaseClass::Add;
+    void Add(MapType* u) {
+      void (BaseClass::*memberFuncPtr)(MapType*) = &BaseClass::Add;
       std::for_each(t_.begin(), t_.end(), std::bind2nd(std::mem_fun(memberFuncPtr), u));
       ++cnt_;
     }
     
-    void Delete(MapType const* u) {
-      void (BaseClass::*memberFuncPtr)(MapType const*) = &BaseClass::Delete;
+    void Delete(MapType* u) {
+      void (BaseClass::*memberFuncPtr)(MapType*) = &BaseClass::Delete;
       std::for_each(t_.begin(), t_.end(), std::bind2nd(std::mem_fun(memberFuncPtr), u));
       --cnt_;
     }
@@ -97,8 +97,8 @@ namespace Visitors {
       pRows_.operator()();
     }
 
-    void SetReference(RefType const* t) {
-      void (BaseClass::*memberFuncPtr)(RefType const*) = &BaseClass::SetReference;
+    void SetReference(RefType* t) {
+      void (BaseClass::*memberFuncPtr)(RefType*) = &BaseClass::SetReference;
       std::for_each(t_.begin(), t_.end(), std::bind2nd(std::mem_fun(memberFuncPtr), t));
     }
 
diff --git a/interfaces/general-headers/data/bed/AllocateIterator_BED_starch.hpp b/interfaces/general-headers/data/bed/AllocateIterator_BED_starch.hpp
index 8b87a53..dd0be33 100644
--- a/interfaces/general-headers/data/bed/AllocateIterator_BED_starch.hpp
+++ b/interfaces/general-headers/data/bed/AllocateIterator_BED_starch.hpp
@@ -21,8 +21,8 @@
 //    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 //
 
-#ifndef SPECIAL_STARCH_ALLOCATE_NEW_ITERATOR_CHR_SPECIFIC_HPP
-#define SPECIAL_STARCH_ALLOCATE_NEW_ITERATOR_CHR_SPECIFIC_HPP
+#ifndef SPECIAL_STARCH_ALLOCATE_NEW_ITERATOR_CHR_SPECIFIC_POOL_HPP
+#define SPECIAL_STARCH_ALLOCATE_NEW_ITERATOR_CHR_SPECIFIC_POOL_HPP
 
 #include <algorithm>
 #include <cstddef>
@@ -30,37 +30,43 @@
 #include <cstdlib>
 #include <cstring>
 #include <iterator>
+#include <type_traits>
 
 #include <sys/stat.h>
 
+#include "utility/PooledMemory.hpp"
+
 #include "algorithm/bed/FindBedRange.hpp"
 #include "algorithm/visitors/helpers/ProcessVisitorRow.hpp"
 #include "data/bed/Bed.hpp"
 #include "data/starch/starchApi.hpp"
+#include "suite/BEDOPS.Constants.hpp"
 #include "utility/FPWrap.hpp"
 
 namespace Bed {
 
-  template <class BedType>
+  template <class BedType, std::size_t SZ=Bed::CHUNKSZ>
   class allocate_iterator_starch_bed;
-  
-  template <class BedType>
-  class allocate_iterator_starch_bed<BedType*> {
-  
+
+  template <class BedType, std::size_t SZ>
+  class allocate_iterator_starch_bed<BedType*, SZ> {
+
   public:
     typedef std::forward_iterator_tag iterator_category;
     typedef BedType*                  value_type;
     typedef std::ptrdiff_t            difference_type;
     typedef BedType**                 pointer;
     typedef BedType*&                 reference;
-  
-    allocate_iterator_starch_bed() : fp_(NULL), _M_ok(false), _M_value(0), is_starch_(false), all_(false), archive_(NULL) { chr_[0] = '\0'; }
+
+    allocate_iterator_starch_bed() : fp_(NULL), _M_ok(false), _M_value(0), is_starch_(false),
+                                     all_(false), archive_(NULL), pool_(NULL) { chr_[0] = '\0'; }
 
     template <typename ErrorType>
-    allocate_iterator_starch_bed(Ext::FPWrap<ErrorType>& fp, const std::string& chr = "all") /* this ASSUMES fp is open and meaningful */
+    allocate_iterator_starch_bed(Ext::FPWrap<ErrorType>& fp, Ext::PooledMemory<BedType, SZ>& p,
+                                      const std::string& chr = "all") /* this ASSUMES fp is open and meaningful */
       : fp_(fp), _M_ok(fp_ && !std::feof(fp_)), _M_value(0),
         is_starch_(_M_ok && (fp_ != stdin) && starch::Starch::isStarch(fp_)),
-        all_(0 == std::strcmp(chr.c_str(), "all")), archive_(NULL) {
+        all_(0 == std::strcmp(chr.c_str(), "all")), archive_(NULL), pool_(&p) {
 
       chr_[0] = '\0';
       std::size_t sz = std::min(chr.size(), static_cast<std::size_t>(Bed::MAXCHROMSIZE));
@@ -85,18 +91,18 @@ namespace Bed {
       if ( (fp_ == stdin || is_namedpipe) && !all_ ) { // BED, chrom-specific, using stdin
         // stream through until we find what we want
         while ( (_M_ok = (fp_ && !std::feof(fp_))) ) {
-          _M_value = new BedType(fp_);
+          _M_value = pool_->construct(fp_);
           if ( 0 == std::strcmp(_M_value->chrom(), chr_) ) {
             _M_ok = (fp_ && !std::feof(fp_));
             break;
           }
-          delete _M_value;
+          pool_->release(_M_value);
         } // while
         if ( !_M_ok && fp_ )
           fp_ = NULL;
         return;
       }
-  
+
       if ( is_starch_ ) { // starch archive can deal with all or specific chromosomes
         const bool perLineUsage = true;
         archive_ = new starch::Starch(fp_, chr_, perLineUsage);
@@ -120,7 +126,7 @@ namespace Bed {
         if ( 0 == std::strcmp(bt->chrom(), chr_) ) {
           delete bt;
           std::rewind(fp_);
-          _M_value = new BedType(fp_);
+          _M_value = pool_->construct(fp_);
           _M_ok = (_M_ok && fp_ && !std::feof(fp_));
           if ( !_M_ok && fp_ )
             fp_ = NULL;
@@ -144,7 +150,7 @@ namespace Bed {
               Bed::extract_details::QueryBedType q(fp_);
               std::fseek(fp_, b, SEEK_SET);
               if ( 0 == std::strcmp(q.chrom(), chr_) ) {
-                _M_value = new BedType(fp_);
+                _M_value = pool_->construct(fp_);
                 _M_ok = (_M_ok && fp_ && !std::feof(fp_));
                 if ( !_M_ok && fp_ )
                   fp_ = NULL;
@@ -159,7 +165,7 @@ namespace Bed {
           } // while
         }
       } else { // BED, process everything
-        _M_value = new BedType(fp_);
+        _M_value = pool_->construct(fp_);
         _M_ok = (_M_ok && fp_ && !std::feof(fp_));
         if ( !_M_ok && fp_ )
           fp_ = NULL;
@@ -172,7 +178,7 @@ namespace Bed {
     allocate_iterator_starch_bed& operator++() { 
       if ( _M_ok ) {
         if ( !is_starch_ ) {
-          _M_value = new BedType(fp_);
+          _M_value = pool_->construct(fp_);
           _M_ok = !std::feof(fp_) && (all_ || 0 == std::strcmp(_M_value->chrom(), chr_));
           // very small leak in event that !all_ and _M_value->chrom() is not chr_
           //   too expensive to check
@@ -187,10 +193,10 @@ namespace Bed {
     }
   
     allocate_iterator_starch_bed operator++(int)  {
-      allocate_iterator_starch_bed __tmp = *this;
+      auto __tmp = *this;
       if ( _M_ok ) {
         if ( !is_starch_ ) {
-          _M_value = new BedType(fp_);
+          _M_value = pool_->construct(fp_);
           _M_ok = !std::feof(fp_) && (all_ || 0 == std::strcmp(_M_value->chrom(), chr_));
           // very small leak in event that !all_ and _M_value->chrom() is not chr_
           //   too expensive to check
@@ -210,13 +216,21 @@ namespace Bed {
                 (!_M_ok || fp_ == __x.fp_)
               ); 
     }
-  
+
+    bool has_nested() const { /* only known for Starch archives */
+      if ( is_starch_ )
+        return archive_->getAllChromosomesHaveNestedElement();
+      return true; // assumption for BED
+    }
+
+    Ext::PooledMemory<BedType, SZ>& get_pool() { return *pool_; }
+
   private:
     inline BedType* get_starch() {
       static std::string line;
       if ( archive_ == NULL || !archive_->extractBEDLine(line) )
         return(0);
-      return(new BedType(line.c_str()));
+      return(pool_->construct(line.c_str()));
     }
   
   private:
@@ -227,22 +241,23 @@ namespace Bed {
     bool is_starch_;
     const bool all_;
     starch::Starch* archive_;
+    Ext::PooledMemory<BedType, SZ>* pool_;
   };
   
-  template <class BedType>
+  template <class BedType, std::size_t sz>
   inline bool 
-  operator==(const allocate_iterator_starch_bed<BedType>& __x,
-             const allocate_iterator_starch_bed<BedType>& __y) {
+  operator==(const allocate_iterator_starch_bed<BedType, sz>& __x,
+             const allocate_iterator_starch_bed<BedType, sz>& __y) {
     return __x._M_equal(__y);
   }
   
-  template <class BedType>
+  template <class BedType, std::size_t sz>
   inline bool 
-  operator!=(const allocate_iterator_starch_bed<BedType>& __x,
-             const allocate_iterator_starch_bed<BedType>& __y) {
+  operator!=(const allocate_iterator_starch_bed<BedType, sz>& __x,
+             const allocate_iterator_starch_bed<BedType, sz>& __y) {
     return !__x._M_equal(__y);
   }
 
 } // namespace Bed
 
-#endif // SPECIAL_STARCH_ALLOCATE_NEW_ITERATOR_CHR_SPECIFIC_HPP
+#endif // SPECIAL_STARCH_ALLOCATE_NEW_ITERATOR_CHR_SPECIFIC_POOL_HPP
diff --git a/interfaces/general-headers/data/bed/AllocateIterator_BED_starch.hpp b/interfaces/general-headers/data/bed/AllocateIterator_BED_starch_minmem.hpp
similarity index 85%
copy from interfaces/general-headers/data/bed/AllocateIterator_BED_starch.hpp
copy to interfaces/general-headers/data/bed/AllocateIterator_BED_starch_minmem.hpp
index 8b87a53..d1d781d 100644
--- a/interfaces/general-headers/data/bed/AllocateIterator_BED_starch.hpp
+++ b/interfaces/general-headers/data/bed/AllocateIterator_BED_starch_minmem.hpp
@@ -21,8 +21,8 @@
 //    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 //
 
-#ifndef SPECIAL_STARCH_ALLOCATE_NEW_ITERATOR_CHR_SPECIFIC_HPP
-#define SPECIAL_STARCH_ALLOCATE_NEW_ITERATOR_CHR_SPECIFIC_HPP
+#ifndef SPECIAL_STARCH_ALLOCATE_NEW_ITERATOR_CHR_SPECIFIC_MINMEM_HPP
+#define SPECIAL_STARCH_ALLOCATE_NEW_ITERATOR_CHR_SPECIFIC_MINMEM_HPP
 
 #include <algorithm>
 #include <cstddef>
@@ -35,18 +35,18 @@
 
 #include "algorithm/bed/FindBedRange.hpp"
 #include "algorithm/visitors/helpers/ProcessVisitorRow.hpp"
-#include "data/bed/Bed.hpp"
+#include "data/bed/Bed_minmem.hpp"
 #include "data/starch/starchApi.hpp"
 #include "utility/FPWrap.hpp"
 
 namespace Bed {
 
   template <class BedType>
-  class allocate_iterator_starch_bed;
-  
+  class allocate_iterator_starch_bed_mm;
+
   template <class BedType>
-  class allocate_iterator_starch_bed<BedType*> {
-  
+  class allocate_iterator_starch_bed_mm<BedType*> {
+
   public:
     typedef std::forward_iterator_tag iterator_category;
     typedef BedType*                  value_type;
@@ -54,10 +54,10 @@ namespace Bed {
     typedef BedType**                 pointer;
     typedef BedType*&                 reference;
   
-    allocate_iterator_starch_bed() : fp_(NULL), _M_ok(false), _M_value(0), is_starch_(false), all_(false), archive_(NULL) { chr_[0] = '\0'; }
+    allocate_iterator_starch_bed_mm() : fp_(NULL), _M_ok(false), _M_value(0), is_starch_(false), all_(false), archive_(NULL) { chr_[0] = '\0'; }
 
     template <typename ErrorType>
-    allocate_iterator_starch_bed(Ext::FPWrap<ErrorType>& fp, const std::string& chr = "all") /* this ASSUMES fp is open and meaningful */
+    allocate_iterator_starch_bed_mm(Ext::FPWrap<ErrorType>& fp, const std::string& chr = "all") /* this ASSUMES fp is open and meaningful */
       : fp_(fp), _M_ok(fp_ && !std::feof(fp_)), _M_value(0),
         is_starch_(_M_ok && (fp_ != stdin) && starch::Starch::isStarch(fp_)),
         all_(0 == std::strcmp(chr.c_str(), "all")), archive_(NULL) {
@@ -169,7 +169,7 @@ namespace Bed {
     reference operator*() { return _M_value; }
     pointer operator->() { return &(operator*()); }
   
-    allocate_iterator_starch_bed& operator++() { 
+    allocate_iterator_starch_bed_mm& operator++() { 
       if ( _M_ok ) {
         if ( !is_starch_ ) {
           _M_value = new BedType(fp_);
@@ -186,8 +186,8 @@ namespace Bed {
       return *this;
     }
   
-    allocate_iterator_starch_bed operator++(int)  {
-      allocate_iterator_starch_bed __tmp = *this;
+    allocate_iterator_starch_bed_mm operator++(int)  {
+      allocate_iterator_starch_bed_mm __tmp = *this;
       if ( _M_ok ) {
         if ( !is_starch_ ) {
           _M_value = new BedType(fp_);
@@ -204,12 +204,18 @@ namespace Bed {
       return __tmp;
     }
   
-    bool _M_equal(const allocate_iterator_starch_bed& __x) const {
+    bool _M_equal(const allocate_iterator_starch_bed_mm& __x) const {
        return (
                 (_M_ok == __x._M_ok) &&
                 (!_M_ok || fp_ == __x.fp_)
               ); 
     }
+
+    bool has_nested() const { /* only known for Starch archives */
+      if ( is_starch_ )
+        return archive_->getAllChromosomesHaveNestedElement();
+      return true; // assumption for BED
+    }
   
   private:
     inline BedType* get_starch() {
@@ -231,18 +237,18 @@ namespace Bed {
   
   template <class BedType>
   inline bool 
-  operator==(const allocate_iterator_starch_bed<BedType>& __x,
-             const allocate_iterator_starch_bed<BedType>& __y) {
+  operator==(const allocate_iterator_starch_bed_mm<BedType>& __x,
+             const allocate_iterator_starch_bed_mm<BedType>& __y) {
     return __x._M_equal(__y);
   }
   
   template <class BedType>
   inline bool 
-  operator!=(const allocate_iterator_starch_bed<BedType>& __x,
-             const allocate_iterator_starch_bed<BedType>& __y) {
+  operator!=(const allocate_iterator_starch_bed_mm<BedType>& __x,
+             const allocate_iterator_starch_bed_mm<BedType>& __y) {
     return !__x._M_equal(__y);
   }
 
 } // namespace Bed
 
-#endif // SPECIAL_STARCH_ALLOCATE_NEW_ITERATOR_CHR_SPECIFIC_HPP
+#endif // SPECIAL_STARCH_ALLOCATE_NEW_ITERATOR_CHR_SPECIFIC_MINMEM_HPP
diff --git a/interfaces/general-headers/data/bed/Bed.hpp b/interfaces/general-headers/data/bed/Bed.hpp
index 809d204..8c83e9e 100644
--- a/interfaces/general-headers/data/bed/Bed.hpp
+++ b/interfaces/general-headers/data/bed/Bed.hpp
@@ -21,8 +21,8 @@
 //    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 //
 
-#ifndef BED_HPP
-#define BED_HPP
+#ifndef BED_NONEW_HPP
+#define BED_NONEW_HPP
 
 #include <cstddef>
 #include <cstdio>
@@ -50,12 +50,9 @@
 
 namespace Bed {
 
-  // For Bed6<> items, but much easier to use if directly in Bed namespace
-  enum Strand { PLUS = '+', MINUS = '-' };
-
-  const CoordType MAXCHROMSIZE = TOKEN_CHR_MAX_LENGTH;
-  const CoordType MAXIDSIZE = TOKEN_ID_MAX_LENGTH;
-  const CoordType MAXRESTSIZE = TOKEN_REST_MAX_LENGTH;
+  constexpr CoordType MAXCHROMSIZE = TOKEN_CHR_MAX_LENGTH;
+  constexpr CoordType MAXIDSIZE = TOKEN_ID_MAX_LENGTH;
+  constexpr CoordType MAXRESTSIZE = TOKEN_REST_MAX_LENGTH;
 
 
   /*****************************************/
@@ -63,48 +60,26 @@ namespace Bed {
   /*****************************************/
 
   // ChromInfo non-specialized declaration
-  template <bool IsNonStatic>
+  template <bool isNonStatic>
   struct ChromInfo {
+    static constexpr bool IsNonStatic = isNonStatic;
 
-    ChromInfo() : chrom_(new char[1]) { chrom_[0] = '\0'; }
-    ChromInfo(const ChromInfo& c)
-        : chrom_(new char[(c.chrom_ != NULL) ? (std::strlen(c.chrom_) + 1) : 1])
-      { *chrom_ = '\0'; if ( c.chrom_ != NULL ) std::strcpy(chrom_, c.chrom_); }
-    explicit ChromInfo(char const* c)
-        : chrom_(new char[(c != NULL) ? (std::strlen(c)+1) : 1])
-      { *chrom_ = '\0'; if ( c != NULL ) std::strcpy(chrom_, c); }
+    ChromInfo() { chrom_[0] = '\0'; }
+    ChromInfo(const ChromInfo& c) { std::strcpy(chrom_, c.chrom_); }
+    explicit ChromInfo(char const* c)  { std::strcpy(chrom_, c); }
 
     // Properties
-    char const* chrom() const { return chrom_; }
-    void chrom(char const* chrom) {
-      if ( chrom_ )
-        delete [] chrom_;
-      if ( chrom != NULL ) {
-        chrom_ = new char[std::strlen(chrom) + 1];
-        std::strcpy(chrom_, chrom);
-      } else {
-        chrom_ = new char[1];
-        *chrom_ = '\0';
-      }
-    }
+    inline char const* chrom() const { return chrom_; }
+    inline void chrom(char const* chrom) { std::strcpy(chrom_, chrom); }
 
     // Operators
     ChromInfo& operator=(const ChromInfo& c) {
-      if ( chrom_ )
-        delete [] chrom_;
-      chrom_ = new char[(c.chrom_ != NULL) ? (std::strlen(c.chrom_) + 1) : 1];
-      *chrom_ = '\0'; if ( c.chrom_ != NULL ) std::strcpy(chrom_, c.chrom_);
+      std::strcpy(chrom_, c.chrom_);
       return *this;
     }
 
-    ~ChromInfo() { 
-      if ( chrom_ )
-        delete [] chrom_;
-      chrom_ = NULL;
-    }
-
   protected:
-    char* chrom_;
+    char chrom_[MAXCHROMSIZE+1];
   };
 
 
@@ -151,8 +126,8 @@ namespace Bed {
       { this->readline(inS); }
 
     // Properties
-    CoordType length() const { return end_ - start_; }
-    CoordType median() const { return start_ + ((end_ - start_) / 2); }
+    inline CoordType length() const { return end_ - start_; }
+    inline CoordType median() const { return start_ + ((end_ - start_) / 2); }
     inline CoordType distance(const BasicCoords& a) const {
       if ( 0 == std::strcmp(chrom_, a.chrom_) )
         return start_ - a.start_;
@@ -163,10 +138,10 @@ namespace Bed {
         return end_ - a.start_;
       return std::numeric_limits<CoordType>::max();
     }
-    void start(CoordType start) { start_ = start; }
-    CoordType start() const { return start_; }
-    void end(CoordType end) { end_ = end; }
-    CoordType end() const { return end_; }
+    inline void start(CoordType start) { start_ = start; }
+    inline CoordType start() const { return start_; }
+    inline void end(CoordType end) { end_ = end; }
+    inline CoordType end() const { return end_; }
 
     // Comparison utilities
     inline CoordType overlap(const BasicCoords& a) const {
@@ -230,27 +205,27 @@ namespace Bed {
       static char const* format = heapFormat.c_str();
       std::printf(format, chrom_, start_, end_);
     }
+    inline std::string printstr() const {
+      static const std::string tab = "\t";
+      return std::string(chrom_) + tab + std::to_string(start_) + tab + std::to_string(end_);
+    }
     inline int readline(const std::string& inputLine) {
-      static char chrBuf[MAXCHROMSIZE + 1];
-      chrBuf[0] = '\0';
       static const std::string lclStatic = inFormatter();
       static char const* format = lclStatic.c_str();
+      *chrom_ = '\0';
       int numScan = std::sscanf(inputLine.c_str(),
-                                format, chrBuf,
+                                format, chrom_,
                                 &start_, &end_);
-      this->chrom(chrBuf);
       return numScan;
     }
     inline int readline(FILE* inputFile) {
-      static char chrBuf[MAXCHROMSIZE + 1];
-      chrBuf[0] = '\0';
       static std::string lclstatic = inFormatter();
       static char const* format = lclstatic.c_str();
+      *chrom_ = '\0';
       int numScan = std::fscanf(inputFile,
-                                format, chrBuf, 
+                                format, chrom_,
                                 &start_, &end_);
       std::fgetc(inputFile); // chomp newline
-      this->chrom(chrBuf);
       return numScan;
     }
 
@@ -278,37 +253,22 @@ namespace Bed {
   struct BasicCoords
     : public BasicCoords<IsNonStaticChrom, false> {
 
-    BasicCoords() : BaseClass(), rest_(new char[1]) { *rest_ = '\0'; }
-    BasicCoords(char const* chrom, CoordType start, CoordType end, char const* rest = NULL)
-      : BaseClass(chrom, start, end), rest_(new char[(rest != NULL) ? (std::strlen(rest)+1) : 1]) {
-      *rest_ = '\0';
-      if ( rest && std::strcmp(rest, "") != 0 ) {
-        if ( rest[0] != '\t' )
-          rest_[0] = '\t';
-        std::strcat(rest_, rest);
-      }
-    }
+    BasicCoords() : BaseClass() { fullrest_[0] = '\0'; }
     BasicCoords(const BasicCoords& c)
-      : BaseClass(c), rest_(new char[(c.rest_ != NULL) ? (std::strlen(c.rest_) + 1) : 1])
-      { *rest_ = '\0'; if ( c.rest_ != NULL ) std::strcpy(rest_, c.rest_); }
-    explicit BasicCoords(FILE* inF) : BaseClass(), rest_(0)
+      : BaseClass(c)
+      { std::strcpy(fullrest_, c.fullrest_); }
+    explicit BasicCoords(FILE* inF) : BaseClass()
       { this->readline(inF); }
-    explicit BasicCoords(const std::string& inS) : BaseClass(), rest_(0)
+    explicit BasicCoords(const std::string& inS) : BaseClass()
       { this->readline(inS); }
 
     // Properties
-    char const* rest() const { return rest_; }
-    char const* full_rest() const { return rest(); }
+    inline char const* full_rest() const { return fullrest_; }
 
     // Operators
     BasicCoords& operator=(const BasicCoords& c) {
       BaseClass::operator=(c);
-      if ( rest_ )
-        delete [] rest_;
-      rest_ = new char[(c.rest_ != NULL) ? (std::strlen(c.rest_) + 1) : 1];
-      *rest_ = '\0';
-      if ( c.rest_ != NULL )
-        std::strcpy(rest_, c.rest_);
+      std::strcpy(fullrest_, c.fullrest_);
       return *this;
     }
 
@@ -316,54 +276,40 @@ namespace Bed {
     inline void print() const {
       static const std::string lclStatic = outFormatter();
       static char const* format = lclStatic.c_str();
-      std::printf(format, chrom_, start_, end_, rest_);
+      std::printf(format, chrom_, start_, end_, fullrest_);
     }
     inline void println() const {
       static const std::string heapFormat = (outFormatter() + "\n");
       static char const* format = heapFormat.c_str();
-      std::printf(format, chrom_, start_, end_, rest_);
+      std::printf(format, chrom_, start_, end_, fullrest_);
+    }
+    inline std::string printstr() const {
+      static const std::string tab = "\t";
+      return std::string(chrom_) + tab + std::to_string(start_) + tab + std::to_string(end_)
+               + std::string(fullrest_); /* fullrest_ has a starting tab if applicable */
     }
     inline int readline(const std::string& inputLine) {
-      static char chrBuf[MAXCHROMSIZE + 1];
-      chrBuf[0] = '\0';
-      static char restBuf[MAXRESTSIZE + 1];
-      restBuf[0] = '\0';
       static const std::string lclStatic = inFormatter();
       static char const* format = lclStatic.c_str();
+      chrom_[0] = '\0';
+      fullrest_[0] = '\0';
       int numScan = std::sscanf(inputLine.c_str(), 
-                                format, chrBuf, &start_,
-                                &end_, restBuf);
-      this->chrom(chrBuf);
-      if ( rest_ )
-        delete [] rest_;
-      rest_ = new char[std::strlen(restBuf) + 1];
-      std::strcpy(rest_, restBuf);
+                                format, chrom_, &start_,
+                                &end_, fullrest_);
       return numScan;
     }
     inline int readline(FILE* inputFile) {
-      static char chrBuf[MAXCHROMSIZE + 1];
-      chrBuf[0] = '\0';
-      static char restBuf[MAXRESTSIZE + 1];
-      restBuf[0] = '\0';
       static const std::string lclStatic = inFormatter();
       static char const* format = lclStatic.c_str();
+      chrom_[0] = '\0';
+      fullrest_[0] = '\0';
       int numScan = std::fscanf(inputFile, format,
-                                chrBuf, &start_,
-                                &end_, restBuf);
+                                chrom_, &start_,
+                                &end_, fullrest_);
       std::fgetc(inputFile); // chomp newline
-      this->chrom(chrBuf);
-      if ( rest_ )
-        delete [] rest_;
-      rest_ = new char[std::strlen(restBuf) + 1];
-      std::strcpy(rest_, restBuf);
       return numScan;
     }
 
-    ~BasicCoords() {
-      if ( rest_ )
-        delete [] rest_;
-    }
-
     static const bool UseRest = true;
 
   protected:
@@ -371,7 +317,7 @@ namespace Bed {
     using BaseClass::chrom_;
     using BaseClass::start_;
     using BaseClass::end_;
-    char* rest_;
+    char fullrest_[MAXRESTSIZE + 1];
 
     static std::string outFormatter() {
       return(std::string("%s\t%" PRIu64 "\t%" PRIu64 "%s"));
@@ -381,7 +327,7 @@ namespace Bed {
       return(std::string("%s\t%" SCNu64 "\t%" SCNu64 "%[^\n]s\n"));
     }
   };
-  
+
 
   /*****************************************/
   /* Bed4 Classes                         */
@@ -396,52 +342,35 @@ namespace Bed {
   struct Bed4<BasicCoords<IsNonStaticChrom, B3HasRest>, false> 
     : public BasicCoords<IsNonStaticChrom, false> {
 
-    Bed4() : BaseClass(), id_(new char[1]) { *id_ = '\0'; }
+    Bed4() : BaseClass() { *id_ = '\0'; }
     Bed4(char const* chrom, CoordType start, CoordType end, char const* id)
-      : BaseClass(chrom, start, end), id_(new char[(id != NULL) ? (std::strlen(id)+1) : 1])
-      { *id_ = '\0'; if ( id != NULL ) std::strcpy(id_, id); }
+      : BaseClass(chrom, start, end)
+      { *id_ = '\0'; if ( id != nullptr ) std::strcpy(id_, id); }
     Bed4(const Bed4& c)
-      : BaseClass(c), id_(new char[(c.id_ != NULL) ? (std::strlen(c.id_) + 1) : 1])
-      { *id_ = '\0'; if ( c.id_ != NULL ) std::strcpy(id_, c.id_); }
-    explicit Bed4(FILE* inF) : BaseClass(), id_(0)
+      : BaseClass(c)
+      { *id_ = '\0'; std::strcpy(id_, c.id_); }
+    explicit Bed4(FILE* inF) : BaseClass()
       { this->readline(inF); }
-    explicit Bed4(const std::string& inS) : BaseClass(), id_(0)
+    explicit Bed4(const std::string& inS) : BaseClass()
       { this->readline(inS); }
 
     // IO
     inline int readline(const std::string& inputLine) {
-      static char chrBuf[MAXCHROMSIZE + 1];
-      chrBuf[0] = '\0';
-      static char idBuf[MAXIDSIZE + 1];
-      idBuf[0] = '\0';
-
       static const std::string lclStatic = inFormatter();
       static char const* format = lclStatic.c_str();
-      int numScanned = std::sscanf(inputLine.c_str(), format,
-                                   chrBuf,
-                                   &start_,
-                                   &end_,
-                                   idBuf);
-      this->chrom(chrBuf);
-      this->id(idBuf);
-      return numScanned;
+      *chrom_ = '\0';
+      *id_ = '\0';
+      return std::sscanf(inputLine.c_str(), format,
+                         chrom_, &start_, &end_, id_);
     }
     inline int readline(FILE* inputFile) {
-      static char chrBuf[MAXCHROMSIZE + 1];
-      chrBuf[0] = '\0';
-      static char idBuf[MAXIDSIZE + 1];
-      idBuf[0] = '\0';
-
       static const std::string lclStatic = inFormatter();
       static char const* format = lclStatic.c_str();
+      *chrom_ = '\0';
+      *id_ = '\0';
       int numScanned = std::fscanf(inputFile, format,
-                                   chrBuf,
-                                   &start_,
-                                   &end_, 
-                                   idBuf);
+                                   chrom_, &start_, &end_, id_);
       std::fgetc(inputFile); // read and discard newline
-      this->chrom(chrBuf);
-      this->id(idBuf);
       return numScanned;
     }
     inline void print() const {
@@ -454,32 +383,24 @@ namespace Bed {
       static char const* format = heapFormat.c_str();
       printf(format, chrom_, start_, end_, id_);
     }
+    inline std::string printstr() const {
 
-    // Properties
-    void id(char const* id) {
-      if ( id_ )
-        delete [] id_;
-      id_ = new char[(id != NULL) ? (std::strlen(id) + 1) : 1];
-      *id_ = '\0'; if ( id != NULL ) std::strcpy(id_, id);
+      static const std::string tab = "\t";
+      return std::string(chrom_) + tab + std::to_string(start_) + tab + std::to_string(end_) + tab
+               + std::string(id_);
     }
-    char const* id() const { return id_; }
+
+    // Properties
+    inline void id(char const* id) { *id_ = '\0'; if ( id != nullptr ) std::strcpy(id_, id); }
+    inline char const* id() const { return id_; }
 
     // Operators
     Bed4& operator=(const Bed4& c) {
       BaseClass::operator=(c);
-      if ( id_ )
-        delete [] id_;
-      id_ = new char[(c.id_ != NULL) ? (std::strlen(c.id_) + 1) : 1];
-      *id_ = '\0'; if ( c.id_ != NULL ) std::strcpy(id_, c.id_);
+      std::strcpy(id_, c.id_);
       return *this;
     }
 
-    ~Bed4() {
-      if ( id_ )
-        delete [] id_;
-      id_ = NULL;
-    }
-
     static const int NumFields = 4;
     static const bool UseRest = false;
 
@@ -489,7 +410,7 @@ namespace Bed {
     using BaseClass::start_;
     using BaseClass::end_;
 
-    char* id_;
+    char id_[MAXIDSIZE+1];
 
     static std::string outFormatter() {
       return(BaseClass::outFormatter() + "\t%s");
@@ -505,127 +426,81 @@ namespace Bed {
   struct Bed4 
     : public Bed4<BedType, false> {
 
-    Bed4() : BaseClass(), rest_(new char[1]), fullrest_(new char[1]) { *rest_ = '\0'; *fullrest_ = '\0'; }
+    Bed4() : BaseClass() { *fullrest_ = '\0'; }
     Bed4(const Bed4& c)
-      : BaseClass(c), rest_(new char[(c.rest_ != NULL) ? (std::strlen(c.rest_)+1) : 1]),
-                     fullrest_(new char[(c.fullrest_ != NULL) ? (std::strlen(c.fullrest_)+1) : 1])
-       { *rest_ = '\0'; *fullrest_ = '\0';
-         if ( c.rest_ != NULL ) std::strcpy(rest_, c.rest_);
-         if ( c.fullrest_ != NULL ) std::strcpy(fullrest_, c.fullrest_);
+      : BaseClass(c)
+       {
+         *fullrest_ = '\0';
+         std::strcpy(fullrest_, c.fullrest_);
        }
-    Bed4(char const* chrom, CoordType start, CoordType end, char const* id, char const* rest = NULL)
-      : BaseClass(chrom, start, end, id), rest_(new char[(rest != NULL) ? (std::strlen(rest)+1) : 1]),
-            fullrest_(new char[((rest != NULL) ? (std::strlen(rest)+1) : 1) + ((id != NULL) ? (std::strlen(id)+1) : 1)]) {
-      *rest_ = '\0'; *fullrest_ = '\0';
-      if ( id && std::strcmp(id, "") != 0 )
-        std::strcpy(fullrest_, id);
-
-      if ( rest && std::strcmp(rest, "") != 0 ) {
-        if ( rest[0] != '\t' )
-          rest_[0] = '\t';
-        std::strcat(rest_, rest);
-        std::strcat(fullrest_, rest_);
-      }
-    }
-    explicit Bed4(FILE* inF) : BaseClass(), rest_(0), fullrest_(0)
+    explicit Bed4(FILE* inF) : BaseClass()
       { this->readline(inF); }
-    explicit Bed4(const std::string& inS) : BaseClass(), rest_(0), fullrest_(0)
+    explicit Bed4(const std::string& inS) : BaseClass()
       { this->readline(inS); }
 
     // Properties
-    char const* rest() const { return rest_; }
-    char const* full_rest() const { return fullrest_; }
+    inline char const* full_rest() const { return fullrest_; }
 
     // IO
     inline void print() const {
       static const std::string lclStatic = outFormatter();
       static char const* format = lclStatic.c_str();
-      std::printf(format, chrom_, start_, end_, id_, rest_);
+      std::printf(format, chrom_, start_, end_, fullrest_);
     }
     inline void println() const {
       static const std::string heapFormat = (outFormatter() + "\n");
       static char const* format = heapFormat.c_str();
-      std::printf(format, chrom_, start_, end_, id_, rest_);
+      std::printf(format, chrom_, start_, end_, fullrest_);
+    }
+    inline std::string printstr() const {
+      static const std::string tab = "\t";
+      return std::string(chrom_) + tab + std::to_string(start_) + tab + std::to_string(end_)
+               + std::string(fullrest_); // fullrest_ has whitespace out front if needed
     }
     inline int readline(const std::string& inputLine) {
-      static char chrBuf[MAXCHROMSIZE + 1];
-      chrBuf[0] = '\0';
-      static char idBuf[MAXIDSIZE + 1];
-      idBuf[0] = '\0';
-      static char restBuf[MAXRESTSIZE + 1];
-      restBuf[0] = '\0';
       static const std::string lclStatic = inFormatter();
       static char const* format = lclStatic.c_str();
+      static char other[MAXRESTSIZE+1];
+      other[0] = '\0';
+      chrom_[0] = '\0';
+      id_[0] = '\0';
+      fullrest_[0] = '\0';
       int numScanned = std::sscanf(inputLine.c_str(),
-                                   format, chrBuf,
-                                   &start_, &end_, idBuf, 
-                                   restBuf);
-      this->chrom(chrBuf);
-      this->id(idBuf);
-      if ( rest_ )
-        delete [] rest_;
-      rest_ = new char[std::strlen(restBuf) + 1];
-      std::strcpy(rest_, restBuf);
-      if ( fullrest_ )
-        delete [] fullrest_;
-      std::size_t sz = (std::strlen(restBuf)+1) + (std::strlen(idBuf) + 1);
-      fullrest_ = new char[sz];
-      std::strcpy(fullrest_, idBuf);
-      std::strcat(fullrest_, restBuf);
+                                   format, chrom_,
+                                   &start_, &end_, id_,
+                                   other);
+      const int numWritten = std::snprintf(fullrest_, MAXRESTSIZE+1, "\t%s", id_);
+      if ( other[0] != '\0' && static_cast<CoordType>(numWritten) < MAXRESTSIZE )
+        std::snprintf(fullrest_ + numWritten, MAXRESTSIZE+1-numWritten, "%s", other);
       return numScanned;
     }
     inline int readline(FILE* inputFile) {
-      static char chrBuf[MAXCHROMSIZE + 1];
-      chrBuf[0] = '\0';
-      static char idBuf[MAXIDSIZE + 1];
-      idBuf[0] = '\0';
-      static char restBuf[MAXRESTSIZE + 1];
-      restBuf[0] = '\0';
-
       static const std::string lclStatic = inFormatter();
       static char const* format = lclStatic.c_str();
+      static char other[MAXRESTSIZE+1];
+      other[0] = '\0';
+      chrom_[0] = '\0';
+      id_[0] = '\0';
+      fullrest_[0] = '\0';
       int numScanned = std::fscanf(inputFile,
-                                   format, chrBuf, 
-                                   &start_, &end_, idBuf, 
-                                   restBuf);
+                                   format, chrom_,
+                                   &start_, &end_, id_,
+                                   other);
 
       std::fgetc(inputFile); // Read and discard trailing newline
-      this->chrom(chrBuf);
-      this->id(idBuf);
-      if ( rest_ )
-        delete [] rest_;
-      rest_ = new char[std::strlen(restBuf) + 1];
-      std::strcpy(rest_, restBuf);
-      std::size_t sz = (std::strlen(restBuf)+1) + (std::strlen(idBuf) + 1);
-      if ( fullrest_ )
-        delete [] fullrest_;
-      fullrest_ = new char[sz];
-      std::strcpy(fullrest_, idBuf);
-      std::strcat(fullrest_, restBuf);
+      const int numWritten = std::snprintf(fullrest_, MAXRESTSIZE+1, "\t%s", id_);
+      if ( other[0] != '\0' && static_cast<CoordType>(numWritten) < MAXRESTSIZE )
+        std::snprintf(fullrest_ + numWritten, MAXRESTSIZE+1-numWritten, "%s", other);
       return numScanned;
     }
 
     // Operators
     Bed4& operator=(const Bed4& c) {
       BaseClass::operator=(c);
-      if ( rest_ )
-        delete [] rest_;
-      if ( fullrest_ )
-        delete [] fullrest_;
-      rest_ = new char[(c.rest_ != NULL) ? (std::strlen(c.rest_) + 1) : 1];
-      *rest_ = '\0'; if ( c.rest_ != NULL ) std::strcpy(rest_, c.rest_);
-      fullrest_ = new char[(c.fullrest_ != NULL) ? (std::strlen(c.fullrest_) + 1) : 1];
-      *fullrest_ = '\0'; if ( c.fullrest_ != NULL ) std::strcpy(fullrest_, c.fullrest_);
+      std::strcpy(fullrest_, c.fullrest_);
       return *this;
     }
 
-    ~Bed4() {
-      if ( rest_ )
-        delete [] rest_;
-      if ( fullrest_ )
-        delete [] fullrest_;
-    }
-
     static const bool UseRest = true;
 
   protected:
@@ -635,13 +510,13 @@ namespace Bed {
     using BaseClass::end_;
     using BaseClass::id_;
 
-    char* rest_;
-    char* fullrest_;
-    static std::string outFormatter() {
-      return(BaseClass::outFormatter() + "%s");
+    char fullrest_[MAXRESTSIZE + 1];
+
+    static std::string outFormatter() { /* BC::BC --> output 3 columns and fullrest_ */
+      return(BaseClass::BaseClass::outFormatter() + "%s");
     }
 
-    static std::string inFormatter() {
+    static std::string inFormatter() { /* BC --> include ID field */
       return(BaseClass::outFormatter() + "%[^\n]s\n");
     }
   };
@@ -679,35 +554,25 @@ namespace Bed {
 
     // IO
     inline int readline(const std::string& inputLine) {
-      static char chrBuf[MAXCHROMSIZE + 1];
-      chrBuf[0] = '\0';
-      static char idBuf[MAXIDSIZE + 1];
-      idBuf[0] = '\0';
       static const std::string lclStatic = inFormatter();
       static char const* format = lclStatic.c_str();
-      int numScanned = std::sscanf(inputLine.c_str(),
-                                   format, chrBuf,
-                                   &start_, &end_, idBuf, 
-                                   &measurement_);
-      this->chrom(chrBuf);
-      this->id(idBuf);
-      return numScanned;
+      *chrom_ = '\0';
+      *id_ = '\0';
+      return std::sscanf(inputLine.c_str(),
+                         format, chrom_,
+                         &start_, &end_, id_,
+                         &measurement_);
     }
     inline int readline(FILE* inputFile) {
-      static char chrBuf[MAXCHROMSIZE + 1];
-      chrBuf[0] = '\0';
-      static char idBuf[MAXIDSIZE + 1];
-      idBuf[0] = '\0';
       static const std::string lclStatic = inFormatter();
       static char const* format = lclStatic.c_str();
+      *chrom_ = '\0';
+      *id_ = '\0';
       int numScanned = std::fscanf(inputFile,
-                                   format, chrBuf, 
-                                   &start_, &end_, idBuf, 
+                                   format, chrom_,
+                                   &start_, &end_, id_,
                                    &measurement_);
-
       std::fgetc(inputFile); // Read and discard trailing newline
-      this->chrom(chrBuf);
-      this->id(idBuf);
       return numScanned;
     }
     inline void print() const {
@@ -720,6 +585,11 @@ namespace Bed {
       static char const* format = heapFormat.c_str();
       std::printf(format, chrom_, start_, end_, id_, measurement_);
     }
+    inline std::string printstr() const {
+      static const std::string tab = "\t";
+      return std::string(chrom_) + tab + std::to_string(start_) + tab + std::to_string(end_) + tab
+               + std::string(id_) + tab + std::to_string(measurement_);
+    }
 
     // Operators
     Bed5& operator=(const Bed5& c) {
@@ -737,9 +607,11 @@ namespace Bed {
     using BaseClass::id_;
     MeasureType measurement_;
 
+    typedef typename std::remove_cv<MeasureType>::type MType;
+    static constexpr char const* MFormat = Formats::Format(MType());
+
     static std::string outFormatter() {
-      typedef typename std::remove_cv<MeasureType>::type MType;
-      return(BaseClass::outFormatter() + "\t" + Formats::Format(MType()));
+      return(BaseClass::outFormatter() + "\t" + std::string(MFormat));
     }
 
     static std::string inFormatter() {
@@ -753,133 +625,89 @@ namespace Bed {
   struct Bed5
     : public Bed5<Bed4Type, MeasureType, false> { /* Bed4Type is forced to be Bed4<> specialization above */
 
-    Bed5() : BaseClass(), rest_(new char[1]) { *rest_ = '\0'; }
-    Bed5(const Bed5& c)
-      : BaseClass(c), rest_(new char[(c.rest_ != NULL) ? (std::strlen(c.rest_+1)) : 1]),
-        fullrest_(new char[(c.fullrest_ != NULL) ? (std::strlen(c.fullrest_+1)) : 1])
+    Bed5() : BaseClass() { *chrom_ = '\0'; *id_ = '\0'; *fullrest_ = '\0'; restOffset_ = -1; }
+    Bed5(const Bed5& c) : BaseClass(c), restOffset_(c.restOffset_)
       {
-        *rest_ = '\0'; if ( c.rest_ != NULL ) std::strcpy(rest_, c.rest_);
-        *fullrest_ = '\0'; if ( c.fullrest_ != NULL ) std::strcpy(fullrest_, c.fullrest_);
+        *fullrest_ = '\0'; std::strcpy(fullrest_, c.fullrest_);
       }
-    Bed5(char const* chrom, CoordType start, CoordType end,
-         char const* id, MeasureType measurement, char const* rest = NULL)
-      : BaseClass(chrom, start, end, id, measurement),
-        rest_(new char[(rest != NULL) ? (std::strlen(rest)+1) : 1]),
-        fullrest_(new char[((rest != NULL) ? (std::strlen(rest)+1) : 1) + ((id != NULL) ? (std::strlen(id)+1) : 1)])
-    {
-      *rest_ = '\0'; *fullrest_ = '\0';
-      if ( id && std::strcmp(id, "") != 0 )
-        std::strcpy(fullrest_, id);
-
-      if ( rest && 0 != std::strcmp(rest, "") ) {
-        if ( rest[0] != '\t' )
-          rest_[0] = '\t';
-        std::strcat(rest_, rest);
-        std::strcat(fullrest_, rest_);
-      }
-    }
-    explicit Bed5(FILE* inF) : BaseClass(), rest_(0), fullrest_(0)
-      { this->readline(inF); }
-    explicit Bed5(const std::string& inS) : BaseClass(), rest_(0), fullrest_(0)
-      { this->readline(inS); }
+    explicit Bed5(FILE* inF) : BaseClass()
+      { *fullrest_ = '\0'; this->readline(inF); }
+    explicit Bed5(const std::string& inS) : BaseClass()
+      { *fullrest_ = '\0'; this->readline(inS); }
 
     // Properties
-    char const* rest() const { return rest_; }
-    char const* full_rest() const { return fullrest_; }
+    inline char const* full_rest() const { return fullrest_; }
+    inline int rest_offset() const { return restOffset_; }
 
     // IO
     inline void print() const {
       static const std::string lclStatic = outFormatter();
       static char const* format = lclStatic.c_str();
-      std::printf(format, chrom_, start_, end_, id_, measurement_, rest_);
+      std::printf(format, chrom_, start_, end_, fullrest_);
     }
     inline void println() const {
       static const std::string heapFormat = outFormatter() + "\n";
       static char const* format = heapFormat.c_str();
-      std::printf(format, chrom_, start_, end_, id_, measurement_, rest_);
+      std::printf(format, chrom_, start_, end_, fullrest_);
+    }
+    inline std::string printstr() const {
+      static const std::string tab = "\t";
+      return std::string(chrom_) + tab + std::to_string(start_) + tab + std::to_string(end_)
+               + std::string(fullrest_); // fullrest_ has whitespace out front if needed
     }
     inline int readline(const std::string& inputLine) {
-      static char chrBuf[MAXCHROMSIZE + 1];
-      chrBuf[0] = '\0';
-      static char idBuf[MAXIDSIZE + 1];
-      idBuf[0] = '\0';
-      static char restBuf[MAXRESTSIZE + 1];
-      restBuf[0] = '\0';
       static const std::string lclStatic = inFormatter();
       static char const* format = lclStatic.c_str();
-      int numScanned = std::sscanf(inputLine.c_str(),
-                                   format, chrBuf,
-                                   &start_, &end_, idBuf, 
-                                   &measurement_, restBuf);
-
-      this->chrom(chrBuf);
-      this->id(idBuf);
-      if ( rest_ )
-        delete [] rest_;
-      rest_ = new char[std::strlen(restBuf) + 1];
-      std::strcpy(rest_, restBuf);
-      if ( fullrest_ )
-        delete [] fullrest_;
-      std::size_t sz = (std::strlen(restBuf)+1) + (std::strlen(idBuf) + 1);
-      fullrest_ = new char[sz];
-      std::strcpy(fullrest_, idBuf);
-      std::strcat(fullrest_, restBuf);
+      static char other[MAXRESTSIZE+1];
+      other[0] = '\0';
+      *chrom_ = '\0';
+      *id_ = '\0';
+      *fullrest_ = '\0';
+      restOffset_ = -1;
+      const int numScanned = std::sscanf(inputLine.c_str(),
+                                         format, chrom_,
+                                         &start_, &end_, id_,
+                                         &measurement_, other);
+
+      const int numWritten = std::snprintf(fullrest_, MAXRESTSIZE+1, (std::string("\t%s\t") + BaseClass::MFormat).c_str(), id_, measurement_);
+      if ( other[0] != '\0' && static_cast<CoordType>(numWritten) < MAXRESTSIZE ) {
+        restOffset_ = numWritten;
+        std::snprintf(fullrest_ + numWritten, MAXRESTSIZE+1-numWritten, "%s", other);
+      }
       return numScanned;
     }
     inline int readline(FILE* inputFile) {
-      static char chrBuf[MAXCHROMSIZE + 1];
-      chrBuf[0] = '\0';
-      static char idBuf[MAXIDSIZE + 1];
-      idBuf[0] = '\0';
-      static char restBuf[MAXRESTSIZE + 1];
-      restBuf[0] = '\0';
-
       static const std::string lclStatic = inFormatter();
       static char const* format = lclStatic.c_str();
-      int numScanned = std::fscanf(inputFile,
-                                   format, chrBuf, 
-                                   &start_, &end_, idBuf, 
-                                   &measurement_, restBuf);
+      static char other[MAXRESTSIZE+1];
+      other[0] = '\0';
+      *chrom_ = '\0';
+      *id_ = '\0';
+      *fullrest_ = '\0';
+      restOffset_ = -1;
+      const int numScanned = std::fscanf(inputFile,
+                                         format, chrom_,
+                                         &start_, &end_, id_,
+                                         &measurement_, other);
 
       std::fgetc(inputFile); // Read and discard trailing newline
-      this->chrom(chrBuf);
-      this->id(idBuf);
-      if ( rest_ )
-        delete [] rest_;
-      rest_ = new char[std::strlen(restBuf) + 1];
-      std::strcpy(rest_, restBuf);
-
-      if ( fullrest_ )
-        delete [] fullrest_;
-      std::size_t sz = (std::strlen(restBuf)+1) + (std::strlen(idBuf) + 1);
-      fullrest_ = new char[sz];
-      std::strcpy(fullrest_, idBuf);
-      std::strcat(fullrest_, restBuf);
 
+      static const char* f = (std::string("\t%s\t") + BaseClass::MFormat).c_str();
+      const int numWritten = std::snprintf(fullrest_, MAXRESTSIZE+1, f, id_, measurement_);
+      if ( other[0] != '\0' && static_cast<CoordType>(numWritten) < MAXRESTSIZE ) {
+        restOffset_ = numWritten;
+        std::snprintf(fullrest_ + numWritten, MAXRESTSIZE+1-numWritten, "%s", other);
+      }
       return numScanned;
     }
 
     // Operators
     Bed5& operator=(const Bed5& c) {
       BaseClass::operator=(c);
-      if ( rest_ )
-        delete [] rest_;
-      if ( fullrest_ )
-        delete [] fullrest_;
-      rest_ = new char[(c.rest_ != NULL) ? (std::strlen(c.rest_) + 1) : 1];
-      *rest_ = '\0'; if ( c.rest_ != NULL ) std::strcpy(rest_, c.rest_);
-      fullrest_ = new char[(c.fullrest_ != NULL) ? (std::strlen(c.fullrest_) + 1) : 1];
-      *fullrest_ = '\0'; if ( c.fullrest_ != NULL ) std::strcpy(fullrest_, c.fullrest_);
+      std::strcpy(fullrest_, c.fullrest_);
       return *this;
     }
 
-    ~Bed5() {
-      if ( rest_ )
-        delete [] rest_;
-      if ( fullrest_ )
-        delete [] fullrest_;
-    }
-
     // Parameters
     static const bool UseRest = true;
 
@@ -891,11 +719,11 @@ namespace Bed {
     using BaseClass::id_;
     using BaseClass::measurement_;
 
-    char* rest_;
-    char* fullrest_;
+    int  restOffset_; // marks spot after id_/measurement_ in fullrest_
+    char fullrest_[MAXRESTSIZE+1];
 
-    static std::string outFormatter() {
-      return(BaseClass::outFormatter() + "%s");
+    static std::string outFormatter() { /* BC::BC::BC --> output 3 columns and fullrest_ */
+      return BaseClass::BaseClass::BaseClass::outFormatter() + "%s";
     }
 
     static std::string inFormatter() {
@@ -905,4 +733,4 @@ namespace Bed {
 
 } // namespace Bed
 
-#endif // BED_HPP
+#endif // BED_NONEW_HPP
diff --git a/interfaces/general-headers/data/bed/BedCheckIterator.hpp b/interfaces/general-headers/data/bed/BedCheckIterator.hpp
index c927ed9..ce4df62 100644
--- a/interfaces/general-headers/data/bed/BedCheckIterator.hpp
+++ b/interfaces/general-headers/data/bed/BedCheckIterator.hpp
@@ -21,8 +21,8 @@
 //    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 //
 
-#ifndef SPECIAL_BED_ITERATOR_HEADERS_STARCH_CHR_SPECIFIC_HPP
-#define SPECIAL_BED_ITERATOR_HEADERS_STARCH_CHR_SPECIFIC_HPP
+#ifndef SPECIAL_BED_ITERATOR_HEADERS_STARCH_CHR_SPECIFIC_POOL_HPP
+#define SPECIAL_BED_ITERATOR_HEADERS_STARCH_CHR_SPECIFIC_POOL_HPP
 
 #include <cctype>
 #include <cstddef>
@@ -45,15 +45,16 @@
 #include "suite/BEDOPS.Constants.hpp"
 #include "utility/ByLine.hpp"
 #include "utility/Exception.hpp"
+#include "utility/PooledMemory.hpp"
 
 namespace Bed {
 
-  template <class BedType>
+  template <class BedType, std::size_t SZ=Bed::CHUNKSZ>
   class bed_check_iterator;
-  
-  template <class BedType>
-  class bed_check_iterator<BedType*> {
-  
+
+  template <class BedType, std::size_t SZ>
+  class bed_check_iterator<BedType*, SZ> {
+
   public:
     typedef Ext::UserError            Exception;
     typedef std::forward_iterator_tag iterator_category;
@@ -61,21 +62,22 @@ namespace Bed {
     typedef std::ptrdiff_t            difference_type;
     typedef BedType**                 pointer;
     typedef BedType*&                 reference;
-  
+
     static constexpr int nFields_  = BedType::NumFields;
     static constexpr bool hasRest_ = BedType::UseRest;
-  
+
     bed_check_iterator() : fp_(std::cin), _M_ok(false), _M_value(0), fn_(""), cnt_(0),
                            lastChr_(""), lastRest_(""), lastStart_(1), lastEnd_(0), nestCheck_(false),
-                           maxEnd_(0), chr_(""), isStarch_(false), all_(true), archive_(0)
+                           maxEnd_(0), chr_(""), isStarch_(false), all_(true), archive_(0), pool_(0)
       { /* */ }
 
-    bed_check_iterator(std::istream& is, const std::string& filename, const std::string& chr = "all", bool nestCheck = false)
+    bed_check_iterator(std::istream& is, const std::string& filename, Ext::PooledMemory<BedType, SZ>& p,
+                       const std::string& chr = "all", bool nestCheck = false)
       : fp_(is), _M_ok(fp_), _M_value(0), fn_(filename), cnt_(0), lastChr_(""), lastRest_(""), lastStart_(1),
         lastEnd_(0), nestCheck_(nestCheck), maxEnd_(0), chr_(chr),
         isStarch_(false), all_(chr_ == "all"),
-        archive_(0) {
-  
+        archive_(0), pool_(&p) {
+
       if ( !_M_ok )
         return;
 
@@ -108,7 +110,7 @@ namespace Bed {
           } // while
           if ( _M_value->chrom() == chr_ )
             return;
-          delete _M_value;
+          pool_->release(_M_value);
           _M_value = static_cast<BedType*>(0);
         } // while
         _M_value = static_cast<BedType*>(0);
@@ -141,13 +143,13 @@ namespace Bed {
         std::fseek(tmpf, 0, SEEK_END);  // apparently dangerous on some platforms in binary mode -> padded nulls;
         const Bed::ByteOffset at_end = std::ftell(tmpf); // I'll assume msft is the problem until I know better
         std::rewind(tmpf);
-  
+
         Bed::extract_details::TargetBedType* bt = new Bed::extract_details::TargetBedType(tmpf);
         if ( bt->chrom() == chr_ ) { // first entry is correct chromosome
           delete bt;
           std::rewind(tmpf);
           fp_.seekg(0, std::ios::beg);
-  
+
           Ext::ByLine bl;
           if ( !(_M_ok && fp_ >> bl) )
             _M_ok = false;
@@ -183,7 +185,6 @@ namespace Bed {
               Bed::extract_details::QueryBedType q(tmpf);
               std::fseek(tmpf, b, SEEK_SET);
               if ( q.chrom() == chr_ ) {
-  
                 fp_.seekg(b, std::ios::beg);
                 Ext::ByLine bl;
                 if ( !(_M_ok && fp_ >> bl) )
@@ -229,10 +230,10 @@ namespace Bed {
         }
       }
     }
-  
+
     reference operator*() { return _M_value; }
     pointer operator->() { return &(operator*()); }
-  
+
     bed_check_iterator& operator++() {
       static Ext::ByLine bl;
       if ( _M_ok ) {
@@ -244,7 +245,7 @@ namespace Bed {
               s << cnt_;
               throw(Exception("in " + fn_ + "\nHeader found but should be at top of file.\nSee row: " + s.str()));
             } else if ( !all_ && (_M_value->chrom() != chr_) ) {
-              delete _M_value;
+              pool_->release(_M_value);
               _M_value = static_cast<BedType*>(0);
               _M_ok = false;
             }
@@ -262,9 +263,9 @@ namespace Bed {
       }
       return *this;
     }
-  
+
     bed_check_iterator operator++(int)  {
-      bed_check_iterator __tmp = *this;
+      auto __tmp = *this;
       static Ext::ByLine bl;
       if ( _M_ok ) {
         if ( !isStarch_ ) { // bed
@@ -275,7 +276,7 @@ namespace Bed {
               s << cnt_;
               throw(Exception("in " + fn_ + "\nHeader found but should be at top of file.\nSee row: " + s.str()));
             } else if ( !all_ && (_M_value->chrom() != chr_ ) ) {
-              delete _M_value;
+              pool_->release(_M_value);
               _M_value = static_cast<BedType*>(0);
               _M_ok = false;
             }
@@ -293,17 +294,25 @@ namespace Bed {
       }
       return __tmp;
     }
-  
+
+    Ext::PooledMemory<BedType, SZ>& get_pool() { return *pool_; }
+
     void clean() {
       if ( archive_ )
         delete archive_;
     }
-  
+
     bool _M_equal(const bed_check_iterator& __x) const
       { return ( (_M_ok == __x._M_ok) && (!_M_ok || &fp_ == &__x.fp_) ); }
-  
+
     bool operator=(const bed_check_iterator& b);
-  
+
+    bool has_nested() const { /* only known for Starch archives */
+      if ( isStarch_ )
+        return archive_->getAllChromosomesHaveNestedElement();
+      return true; // assumption for BED
+    }
+
   protected:
     std::string lowerstr(const std::string& s) {
       std::string t(s);
@@ -311,28 +320,28 @@ namespace Bed {
         t[i] = static_cast<char>(std::tolower(t[i]));
       return t;
     }
-  
+
     bool isUCSCheader(const std::string& bl) {
       std::string tmp = lowerstr(bl);
       return (tmp == "browser" || tmp == "track");
     }
-  
+
     bool get_starch(std::string& line) {
       if ( archive_ == NULL || !archive_->extractBEDLine(line) )
         return false;
       return !line.empty();
     }
-  
+
     bool check(const std::string& bl) {
       static std::string msg = "";
       static int cmp = 0;
-  
+
       msg.clear();
       if ( bl.empty() )
         msg = "Empty line found.";
       else if ( isUCSCheader(bl) )
         return false;
-  
+
       // Check chromosome
       std::string::size_type marker = 0, sz = bl.size();
       while ( msg.empty() && marker < sz ) {
@@ -358,7 +367,7 @@ namespace Bed {
         }
         ++marker;
       } // while
-  
+
       if ( msg.empty() ) {
         if ( sz <= marker )
           msg = "No tabs found in BED row.";
@@ -373,8 +382,8 @@ namespace Bed {
         else
           ++marker; // increment passed tab
       }
-  
-  
+
+
       // Check start coordinate
       static std::string::size_type pos = marker;
       pos = marker;
@@ -449,6 +458,7 @@ namespace Bed {
         }
       }
 
+      std::size_t idsz = 0, measurementsz = 0;
       if ( nFields_ > 3 ) { // check ID field
         pos = marker;
         while ( msg.empty() && marker < sz ) {
@@ -458,7 +468,7 @@ namespace Bed {
             msg += "Two or more consecutive tabs.  No ID field.";
           else if ( bl[marker] == ' ' )
             msg += "ID field may not contain a space.";
-  
+
           ++marker;
         } // while
 
@@ -477,8 +487,10 @@ namespace Bed {
             msg += "\nMAXIDSIZE = " + a.str();
             msg += "; Size given = " + b.str();
           }
-          else
+          else {
             ++marker; // increment passed tab
+            idsz = (marker-pos); // include tab
+          }
         }
 
         if ( nFields_ > 4 ) { // check measurement column
@@ -530,7 +542,7 @@ namespace Bed {
             }
             ++marker;
           } // while
-  
+
           if ( msg.empty() ) {
             if ( sz <= marker && nFields_ > 5 ) {
               std::stringstream con; con << nFields_;
@@ -540,11 +552,12 @@ namespace Bed {
               msg = "Fifth (measure) column is empty.";
             else if ( minusPos > 0 && minusPos + 1 == marker )
               msg = "Measurement value ends with a '-'.";
-            else
+            else {
               ++marker; // increment passed tab
+              measurementsz = (marker-pos); // include tab
+            }
           }
-  
-  
+
           if ( nFields_ > 5 ) { // check strand column
             pos = marker;
             while ( msg.empty() && marker < sz ) {
@@ -564,7 +577,7 @@ namespace Bed {
               ++marker;
             } // while
           }
-  
+
           if ( msg.empty() ) {
             if ( pos == marker )
               msg = "Sixth (strand) column is empty.";
@@ -573,26 +586,24 @@ namespace Bed {
           }
         }
       }
-  
-      if ( msg.empty() && hasRest_ && marker < sz && sz - marker > Bed::MAXRESTSIZE ) {
-        msg = "The 'rest' of the input row (everything beyond the first ";
-        std::stringstream a, b, c;
+
+      if ( msg.empty() && hasRest_ && marker <= sz && (sz - marker + idsz + measurementsz) > Bed::MAXRESTSIZE ) { // idsz/measurementsz for fullrest_
+        msg = "The 'rest' of the input row (everything beyond the first 3";
+        std::stringstream a, b;
         a << Bed::MAXRESTSIZE;
         b << bl.substr(marker).size();
-        c << nFields_;
-        msg += c.str();
         msg += " fields) cannot fit into MAXRESTSIZE chars.\nIncrease TOKEN_REST_MAX_LENGTH in BEDOPS.Constants.hpp and recompile BEDOPS.";
         msg += "\nMAXRESTSIZE = " + a.str();
         msg += "; Size given = " + b.str();
       }
-  
+
       if ( !msg.empty() ) {
         std::stringstream s;
         s << cnt_;
         throw(Exception("in " + fn_ + "\n" + msg + "\nSee row: " + s.str()));
       }
 
-      _M_value = new BedType(bl);
+      _M_value = pool_->construct(bl);
       if ( msg.empty() && !lastChr_.empty() ) {
         cmp = std::strcmp(_M_value->chrom(), lastChr_.c_str());
         if ( cmp < 0 )
@@ -618,13 +629,13 @@ namespace Bed {
 
       if ( msg.empty() && _M_value->end() <= _M_value->start() )
         msg = "End coordinates must be greater than start coordinates.";
-  
+
       if ( !msg.empty() ) {
         std::stringstream s;
         s << cnt_;
         throw(Exception("in " + fn_ + "\n" + msg + "\nSee row: " + s.str()));
       }
-  
+
       lastChr_ = _M_value->chrom();
       lastStart_ = _M_value->start();
       lastEnd_ = _M_value->end();
@@ -648,22 +659,23 @@ namespace Bed {
     bool isStarch_;
     const bool all_;
     starch::Starch* archive_;
+    Ext::PooledMemory<BedType, SZ>* pool_;
   };
-  
-  template <class BedType>
+
+  template <class BedType, std::size_t Sz>
   inline bool 
-  operator==(const bed_check_iterator<BedType>& __x,
-             const bed_check_iterator<BedType>& __y) {
+  operator==(const bed_check_iterator<BedType, Sz>& __x,
+             const bed_check_iterator<BedType, Sz>& __y) {
     return __x._M_equal(__y);
   }
-  
-  template <class BedType>
+
+  template <class BedType, std::size_t Sz>
   inline bool 
-  operator!=(const bed_check_iterator<BedType>& __x,
-             const bed_check_iterator<BedType>& __y) {
+  operator!=(const bed_check_iterator<BedType, Sz>& __x,
+             const bed_check_iterator<BedType, Sz>& __y) {
     return !__x._M_equal(__y);
   }
 
 } // namespace Bed
 
-#endif // SPECIAL_BED_ITERATOR_HEADERS_STARCH_CHR_SPECIFIC_HPP
+#endif // SPECIAL_BED_ITERATOR_HEADERS_STARCH_CHR_SPECIFIC_POOL_HPP
diff --git a/interfaces/general-headers/data/bed/BedCheckIterator.hpp b/interfaces/general-headers/data/bed/BedCheckIterator_minmem.hpp
similarity index 94%
copy from interfaces/general-headers/data/bed/BedCheckIterator.hpp
copy to interfaces/general-headers/data/bed/BedCheckIterator_minmem.hpp
index c927ed9..0c77399 100644
--- a/interfaces/general-headers/data/bed/BedCheckIterator.hpp
+++ b/interfaces/general-headers/data/bed/BedCheckIterator_minmem.hpp
@@ -21,8 +21,8 @@
 //    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 //
 
-#ifndef SPECIAL_BED_ITERATOR_HEADERS_STARCH_CHR_SPECIFIC_HPP
-#define SPECIAL_BED_ITERATOR_HEADERS_STARCH_CHR_SPECIFIC_HPP
+#ifndef SPECIAL_BED_ITERATOR_HEADERS_STARCH_CHR_SPECIFIC_MINMEM_HPP
+#define SPECIAL_BED_ITERATOR_HEADERS_STARCH_CHR_SPECIFIC_MINMEM_HPP
 
 #include <cctype>
 #include <cstddef>
@@ -49,11 +49,11 @@
 namespace Bed {
 
   template <class BedType>
-  class bed_check_iterator;
-  
+  class bed_check_iterator_mm;
+
   template <class BedType>
-  class bed_check_iterator<BedType*> {
-  
+  class bed_check_iterator_mm<BedType*> {
+
   public:
     typedef Ext::UserError            Exception;
     typedef std::forward_iterator_tag iterator_category;
@@ -65,12 +65,12 @@ namespace Bed {
     static constexpr int nFields_  = BedType::NumFields;
     static constexpr bool hasRest_ = BedType::UseRest;
   
-    bed_check_iterator() : fp_(std::cin), _M_ok(false), _M_value(0), fn_(""), cnt_(0),
-                           lastChr_(""), lastRest_(""), lastStart_(1), lastEnd_(0), nestCheck_(false),
-                           maxEnd_(0), chr_(""), isStarch_(false), all_(true), archive_(0)
+    bed_check_iterator_mm() : fp_(std::cin), _M_ok(false), _M_value(0), fn_(""), cnt_(0),
+                              lastChr_(""), lastRest_(""), lastStart_(1), lastEnd_(0), nestCheck_(false),
+                              maxEnd_(0), chr_(""), isStarch_(false), all_(true), archive_(0)
       { /* */ }
 
-    bed_check_iterator(std::istream& is, const std::string& filename, const std::string& chr = "all", bool nestCheck = false)
+    bed_check_iterator_mm(std::istream& is, const std::string& filename, const std::string& chr = "all", bool nestCheck = false)
       : fp_(is), _M_ok(fp_), _M_value(0), fn_(filename), cnt_(0), lastChr_(""), lastRest_(""), lastStart_(1),
         lastEnd_(0), nestCheck_(nestCheck), maxEnd_(0), chr_(chr),
         isStarch_(false), all_(chr_ == "all"),
@@ -229,11 +229,11 @@ namespace Bed {
         }
       }
     }
-  
+
     reference operator*() { return _M_value; }
     pointer operator->() { return &(operator*()); }
-  
-    bed_check_iterator& operator++() {
+
+    bed_check_iterator_mm& operator++() {
       static Ext::ByLine bl;
       if ( _M_ok ) {
         if ( !isStarch_ ) { // bed
@@ -262,9 +262,9 @@ namespace Bed {
       }
       return *this;
     }
-  
-    bed_check_iterator operator++(int)  {
-      bed_check_iterator __tmp = *this;
+
+    bed_check_iterator_mm operator++(int)  {
+      bed_check_iterator_mm __tmp = *this;
       static Ext::ByLine bl;
       if ( _M_ok ) {
         if ( !isStarch_ ) { // bed
@@ -293,17 +293,23 @@ namespace Bed {
       }
       return __tmp;
     }
-  
+
     void clean() {
       if ( archive_ )
         delete archive_;
     }
-  
-    bool _M_equal(const bed_check_iterator& __x) const
+
+    bool _M_equal(const bed_check_iterator_mm& __x) const
       { return ( (_M_ok == __x._M_ok) && (!_M_ok || &fp_ == &__x.fp_) ); }
-  
-    bool operator=(const bed_check_iterator& b);
-  
+
+    bool operator=(const bed_check_iterator_mm& b);
+
+    bool has_nested() const { /* only known for Starch archives */
+      if ( isStarch_ )
+        return archive_->getAllChromosomesHaveNestedElement();
+      return true; // assumption for BED
+    }
+
   protected:
     std::string lowerstr(const std::string& s) {
       std::string t(s);
@@ -652,18 +658,18 @@ namespace Bed {
   
   template <class BedType>
   inline bool 
-  operator==(const bed_check_iterator<BedType>& __x,
-             const bed_check_iterator<BedType>& __y) {
+  operator==(const bed_check_iterator_mm<BedType>& __x,
+             const bed_check_iterator_mm<BedType>& __y) {
     return __x._M_equal(__y);
   }
   
   template <class BedType>
   inline bool 
-  operator!=(const bed_check_iterator<BedType>& __x,
-             const bed_check_iterator<BedType>& __y) {
+  operator!=(const bed_check_iterator_mm<BedType>& __x,
+             const bed_check_iterator_mm<BedType>& __y) {
     return !__x._M_equal(__y);
   }
 
 } // namespace Bed
 
-#endif // SPECIAL_BED_ITERATOR_HEADERS_STARCH_CHR_SPECIFIC_HPP
+#endif // SPECIAL_BED_ITERATOR_HEADERS_STARCH_CHR_SPECIFIC_MINMEM_HPP
diff --git a/interfaces/general-headers/data/bed/BedCompare.hpp b/interfaces/general-headers/data/bed/BedCompare.hpp
index 8963e7c..85b9481 100644
--- a/interfaces/general-headers/data/bed/BedCompare.hpp
+++ b/interfaces/general-headers/data/bed/BedCompare.hpp
@@ -51,7 +51,7 @@ namespace Bed {
   struct GenomicAddressCompare
      : public std::binary_function<BedType1 const*, BedType2 const*, bool> {
 
-    bool operator()(BedType1 const* ptr1, BedType2 const* ptr2) const {
+    inline bool operator()(BedType1 const* ptr1, BedType2 const* ptr2) const {
       static int v = 0;
       if ( (v = std::strcmp(ptr1->chrom(), ptr2->chrom())) != 0 )
         return v < 0;
@@ -67,7 +67,7 @@ namespace Bed {
   struct InvertGenomicAddressCompare
       : private GenomicAddressCompare<BedType1, BedType2> {
     typedef GenomicAddressCompare<BedType1, BedType2> Base;
-    bool operator()(BedType1 const* ptr1, BedType2 const* ptr2) const {
+    inline bool operator()(BedType1 const* ptr1, BedType2 const* ptr2) const {
       return Base::operator()(ptr2, ptr1);
     }
   };
@@ -76,7 +76,7 @@ namespace Bed {
   struct CoordCompare // ignoring chrom here
      : public std::binary_function<BedType1 const*, BedType2 const*, bool> {
 
-    bool operator()(BedType1 const* one, BedType2 const* two) const {
+    inline bool operator()(BedType1 const* one, BedType2 const* two) const {
       if ( one->start() != two->start() )
         return one->start() < two->start();
       return one->end() < two->end();
@@ -87,7 +87,7 @@ namespace Bed {
   struct CoordAddressCompare // not caring about chrom here
      : public std::binary_function<BedType1 const*, BedType2 const*, bool> {
 
-    bool operator()(BedType1 const* one, BedType2 const* two) const {
+    inline bool operator()(BedType1 const* one, BedType2 const* two) const {
       if ( one->start() != two->start() )
         return one->start() < two->start();
       if ( one->end() != two->end() )
@@ -101,7 +101,7 @@ namespace Bed {
     : public std::binary_function<BedType1 const*, BedType2 const*, bool> {
 
     template <typename T=BedType1, typename U=BedType2>
-    typename std::enable_if<T::UseRest && U::UseRest, bool>::type
+    inline typename std::enable_if<T::UseRest && U::UseRest, bool>::type
     operator()(BedType1 const* one, BedType2 const* two) const {
       if ( one->start() != two->start() )
         return one->start() < two->start();
@@ -111,32 +111,53 @@ namespace Bed {
     }
 
     template <typename T=BedType1, typename U=BedType2>
-    typename std::enable_if<T::UseRest && !U::UseRest, bool>::type
+    inline typename std::enable_if<T::UseRest && !U::UseRest, bool>::type
     operator()(BedType1 const* one, BedType2 const* two) const {
       if ( one->start() != two->start() )
         return one->start() < two->start();
       if ( one->end() != two->end() )
         return one->end() < two->end();
-      return std::strlen(one->full_rest()) == 0;
+      return false; // one may be equal to two, but still one is not less than two
     }
 
     template <typename T=BedType1, typename U=BedType2>
-    typename std::enable_if<!T::UseRest && U::UseRest, bool>::type
+    inline typename std::enable_if<!T::UseRest && U::UseRest, bool>::type
     operator()(BedType1 const* one, BedType2 const* two) const {
       if ( one->start() != two->start() )
         return one->start() < two->start();
       if ( one->end() != two->end() )
         return one->end() < two->end();
-      std::strlen(two->full_rest()) != 0;
+      return std::strlen(two->full_rest()) != 0;
     }
 
     template <typename T=BedType1, typename U=BedType2>
-    typename std::enable_if<!T::UseRest && !U::UseRest, bool>::type
+    inline typename std::enable_if<!T::UseRest && !U::UseRest && T::NumFields == 3 && U::NumFields == 3, bool>::type
     operator()(BedType1 const* one, BedType2 const* two) const {
       if ( one->start() != two->start() )
         return one->start() < two->start();
       return one->end() < two->end();
     }
+
+    template <typename T=BedType1, typename U=BedType2>
+    inline typename std::enable_if<!T::UseRest && !U::UseRest && (T::NumFields != 3 || U::NumFields != 3), bool>::type
+    operator()(BedType1 const* one, BedType2 const* two) const {
+      if ( one->start() != two->start() )
+        return one->start() < two->start();
+      if ( one->end() != two->end() )
+        return one->end() < two->end();
+      return one->printstr() < two->printstr(); // compares chrom info too...not ideal but it's assumed by caller anyway
+    }
+  };
+
+  template <typename BedType1, typename BedType2 = BedType1>
+  struct GenomicRestCompare : CoordRestCompare<BedType1, BedType2> {
+    typedef CoordRestCompare<BedType1, BedType2> BaseT;
+    inline bool operator()(BedType1 const* ptr1, BedType2 const* ptr2) const {
+      static int v = 0;
+      if ( (v = std::strcmp(ptr1->chrom(), ptr2->chrom())) != 0 )
+        return v < 0;
+      return BaseT::operator()(ptr1, ptr2);
+    }
   };
 
   template <typename BedType1, typename BedType2 = BedType1>
@@ -144,7 +165,7 @@ namespace Bed {
     : public std::binary_function<BedType1 const*, BedType2 const*, bool> {
 
     template <typename T=BedType1, typename U=BedType2>
-    typename std::enable_if<T::UseRest && U::UseRest, bool>::type
+    inline typename std::enable_if<T::UseRest && U::UseRest, bool>::type
     operator()(BedType1 const* one, BedType2 const* two) const {
       if ( one->start() != two->start() )
         return one->start() < two->start();
@@ -157,7 +178,7 @@ namespace Bed {
     }
 
     template <typename T=BedType1, typename U=BedType2>
-    typename std::enable_if<T::UseRest && !U::UseRest, bool>::type
+    inline typename std::enable_if<T::UseRest && !U::UseRest, bool>::type
     operator()(BedType1 const* one, BedType2 const* two) const {
       if ( one->start() != two->start() )
         return one->start() < two->start();
@@ -170,7 +191,7 @@ namespace Bed {
     }
 
     template <typename T=BedType1, typename U=BedType2>
-    typename std::enable_if<!T::UseRest && U::UseRest, bool>::type
+    inline typename std::enable_if<!T::UseRest && U::UseRest, bool>::type
     operator()(BedType1 const* one, BedType2 const* two) const {
       if ( one->start() != two->start() )
         return one->start() < two->start();
@@ -183,21 +204,43 @@ namespace Bed {
     }
 
     template <typename T=BedType1, typename U=BedType2>
-    typename std::enable_if<!T::UseRest && !U::UseRest, bool>::type
+    inline typename std::enable_if<!T::UseRest && !U::UseRest, bool>::type
     operator()(BedType1 const* one, BedType2 const* two) const {
-      if ( one->start() != two->start() )
-        return one->start() < two->start();
-      if ( one->end() != two->end() )
-        return one->end() < two->end();
-      return one < two;
+      static CoordRestCompare<T, U> crc; // deals with ID fields and such
+      bool check = crc(one, two);
+      if ( check ) // *one < *two
+        return true;
+      check = crc(two, one);
+      if ( check ) // *two < *one
+        return false;
+      return one < two; // one == two; compare addresses
+    }
+  };
+
+  template <typename BedType1, typename BedType2 = BedType1>
+  struct GenomicRestAddressCompare : CoordRestAddressCompare<BedType1, BedType2> {
+    typedef CoordRestAddressCompare<BedType1, BedType2> BaseT;
+    inline bool operator()(BedType1 const* ptr1, BedType2 const* ptr2) const {
+      static int v = 0;
+      if ( (v = std::strcmp(ptr1->chrom(), ptr2->chrom())) != 0 )
+        return v < 0;
+      return BaseT::operator()(ptr1, ptr2);
+    }
+  };
+
+  template <typename BedType1, typename BedType2 = BedType1>
+  struct InvertGenomicRestAddressCompare
+      : private GenomicRestAddressCompare<BedType1, BedType2> {
+    typedef GenomicRestAddressCompare<BedType1, BedType2> Base;
+    inline bool operator()(BedType1 const* ptr1, BedType2 const* ptr2) const {
+      return Base::operator()(ptr2, ptr1);
     }
   };
 
   template <typename BedType1, typename BedType2 = BedType1>
   struct RevCoordAddressCompare // not caring about chrom here
      : public std::binary_function<BedType1 const*, BedType2 const*, bool> {
-
-    bool operator()(BedType1 const* one, BedType2 const* two) const {
+    inline bool operator()(BedType1 const* one, BedType2 const* two) const {
       if ( one->end() != two->end() )
         return one->end() < two->end();
       if ( one->start() != two->start() )
@@ -209,8 +252,7 @@ namespace Bed {
   template <typename BedType1, typename BedType2 = BedType1>
   struct EndCoordAddressCompareLesser
     : public std::binary_function<BedType1 const*, BedType2 const*, bool> {
-
-    bool operator()(BedType1 const* one, BedType2 const* two) const {
+    inline bool operator()(BedType1 const* one, BedType2 const* two) const {
       if ( one->end() != two->end() )
         return one->end() < two->end();
       return one < two;
@@ -220,8 +262,7 @@ namespace Bed {
   template <typename BedType1, typename BedType2 = BedType1>
   struct EndCoordAddressCompareGreater
     : public std::binary_function<BedType1 const*, BedType2 const*, bool> {
-
-    bool operator()(BedType1 const* one, BedType2 const* two) const {
+    inline bool operator()(BedType1 const* one, BedType2 const* two) const {
       if ( one->end() != two->end() )
         return one->end() > two->end();
       return one > two;
@@ -231,8 +272,7 @@ namespace Bed {
   template <typename BedType1, typename BedType2 = BedType1>
   struct StartCoordAddressCompareLesser
     : public std::binary_function<BedType1 const*, BedType2 const*, bool> {
-
-    bool operator()(BedType1 const* one, BedType2 const* two) const {
+    inline bool operator()(BedType1 const* one, BedType2 const* two) const {
       if ( one->start() != two->start() )
         return one->start() < two->start();
       return one < two;
@@ -242,8 +282,7 @@ namespace Bed {
   template <typename BedType1, typename BedType2 = BedType1>
   struct StartCoordAddressCompareGreater
     : public std::binary_function<BedType1 const*, BedType2 const*, bool> {
-
-    bool operator()(BedType1 const* one, BedType2 const* two) const {
+    inline bool operator()(BedType1 const* one, BedType2 const* two) const {
       if ( one->start() != two->start() )
         return one->start() > two->start();
       return one > two;
@@ -253,8 +292,7 @@ namespace Bed {
   template <typename BedType1, typename BedType2 = BedType1>
   struct ScoreCompare
      : public std::binary_function<BedType1 const*, BedType2 const*, bool> {
-    
-    bool operator()(BedType1 const* one, BedType2 const* two) const {
+    inline bool operator()(BedType1 const* one, BedType2 const* two) const {
       return one->measurement() < two->measurement();
     }
   };
@@ -262,9 +300,7 @@ namespace Bed {
   template <typename BedType1, typename BedType2 = BedType1>
   struct ScoreThenGenomicCompareLesser
      : public std::binary_function<BedType1 const*, BedType2 const*, bool> {
-
-    inline
-    bool operator()(BedType1 const* one, BedType2 const* two) const {
+    inline bool operator()(BedType1 const* one, BedType2 const* two) const {
       if ( one->measurement() != two->measurement() )
         return one->measurement() < two->measurement();
 
@@ -281,14 +317,11 @@ namespace Bed {
   struct ScoreThenGenomicCompareGreater
       : private ScoreThenGenomicCompareLesser<BedType1, BedType2> {
     typedef ScoreThenGenomicCompareLesser<BedType1, BedType2> Base;
-    inline
-    bool operator()(BedType1 const* ptr1, BedType2 const* ptr2) const {
+    inline bool operator()(BedType1 const* ptr1, BedType2 const* ptr2) const {
       return Base::operator()(ptr2, ptr1);
     }
   };
 
 } // namespace Bed
 
-
-
 #endif // BED_DATA_COMPARE_H
diff --git a/interfaces/general-headers/data/bed/BedTypes.hpp b/interfaces/general-headers/data/bed/BedTypes.hpp
index 9d6fd40..ce7054b 100644
--- a/interfaces/general-headers/data/bed/BedTypes.hpp
+++ b/interfaces/general-headers/data/bed/BedTypes.hpp
@@ -26,21 +26,30 @@
 #define BEDTYPES_HPP
 
 #include "data/bed/Bed.hpp"
+#include "data/bed/Bed_minmem.hpp"
 
 namespace Bed {
 
   /***********************************************/
   /* Typedef helper for user applications        */
   /***********************************************/
-  template <bool UseNonStaticChrom, bool UseRest, typename MType = double>
+  template <bool UseNonStaticChrom, bool UseRest, typename MType = double, bool MemPool = true>
   struct BedTypes {
     typedef MType                                   MeasureType;
     typedef BasicCoords<UseNonStaticChrom, UseRest> Bed3Type;
-    typedef Bed4< Bed3Type, UseRest >               Bed4Type;
-    typedef Bed5< Bed4Type, MeasureType, UseRest >  Bed5Type;
+    typedef Bed4<Bed3Type, UseRest>                 Bed4Type;
+    typedef Bed5<Bed4Type, MeasureType, UseRest>    Bed5Type;
   };
 
-  enum { Rest = true, NoRest = false, OneChrom = false, AllChrom = true };
+  template <bool UseNonStaticChrom, bool UseRest, typename MType>
+  struct BedTypes<UseNonStaticChrom, UseRest, MType, false> {
+    typedef MType                                           MeasureType;
+    typedef NoPool::BasicCoords<UseNonStaticChrom, UseRest> Bed3Type;
+    typedef NoPool::Bed4<Bed3Type, UseRest>                 Bed4Type;
+    typedef NoPool::Bed5<Bed4Type, MeasureType, UseRest>    Bed5Type;
+  };
+
+  enum { Rest = true, NoRest = false, OneChrom = false, AllChrom = true, NoPooling = false };
 
 
   /***********************************************/
@@ -48,23 +57,27 @@ namespace Bed {
   /***********************************************/
   typedef BedTypes<AllChrom, Rest, double>    BTAllRest;
   typedef BedTypes<AllChrom, NoRest, double>  BTAllNoRest;
-  typedef BedTypes<OneChrom, Rest, double>    BTOneRest;
-  typedef BedTypes<OneChrom, NoRest, double>  BTOneNoRest;
-
   typedef BTAllRest::Bed3Type   B3Rest;
   typedef BTAllNoRest::Bed3Type B3NoRest;
-  typedef BTOneRest::Bed3Type   B3OneChromRest;
-  typedef BTOneNoRest::Bed3Type B3OneChromNoRest;
 
   typedef BTAllRest::Bed4Type   B4Rest;
   typedef BTAllNoRest::Bed4Type B4NoRest;
-  typedef BTOneRest::Bed4Type   B4OneChromRest;
-  typedef BTOneNoRest::Bed4Type B4OneChromNoRest;
 
   typedef BTAllRest::Bed5Type   B5Rest;
   typedef BTAllNoRest::Bed5Type B5NoRest;
-  typedef BTOneRest::Bed5Type   B5OneChromRest;
-  typedef BTOneNoRest::Bed5Type B5OneChromNoRest;
+
+
+  typedef BedTypes<AllChrom, Rest, double, NoPooling>    BTAllRestNoPool;
+  typedef BedTypes<AllChrom, NoRest, double, NoPooling>  BTAllNoRestNoPool;
+
+  typedef BTAllRestNoPool::Bed3Type   B3RestNoPool;
+  typedef BTAllNoRestNoPool::Bed3Type B3NoRestNoPool;
+
+  typedef BTAllRestNoPool::Bed4Type   B4RestNoPool;
+  typedef BTAllNoRestNoPool::Bed4Type B4NoRestNoPool;
+
+  typedef BTAllRestNoPool::Bed5Type   B5RestNoPool;
+  typedef BTAllNoRestNoPool::Bed5Type B5NoRestNoPool;
 } // namespace Bed
 
 #endif // BEDTYPES_HPP
diff --git a/interfaces/general-headers/data/bed/Bed_minmem.hpp b/interfaces/general-headers/data/bed/Bed_minmem.hpp
new file mode 100644
index 0000000..b94ca7a
--- /dev/null
+++ b/interfaces/general-headers/data/bed/Bed_minmem.hpp
@@ -0,0 +1,917 @@
+/*
+  Author: Scott Kuehn, Shane Neph
+  Date:   Fri Jul 27 11:49:03 PDT 2007
+*/
+//
+//    BEDOPS
+//    Copyright (C) 2011-2017 Shane Neph, Scott Kuehn and Alex Reynolds
+//
+//    This program is free software; you can redistribute it and/or modify
+//    it under the terms of the GNU General Public License as published by
+//    the Free Software Foundation; either version 2 of the License, or
+//    (at your option) any later version.
+//
+//    This program is distributed in the hope that it will be useful,
+//    but WITHOUT ANY WARRANTY; without even the implied warranty of
+//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//    GNU General Public License for more details.
+//
+//    You should have received a copy of the GNU General Public License along
+//    with this program; if not, write to the Free Software Foundation, Inc.,
+//    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+
+#ifndef BED_MINMEM_HPP
+#define BED_MINMEM_HPP
+
+#include <cstddef>
+#include <cstdio>
+#include <cstring>
+#include <cstdlib>
+#include <limits>
+#include <string>
+#include <type_traits>
+
+#include "suite/BEDOPS.Constants.hpp"
+#include "utility/Formats.hpp"
+
+/*
+  sjn
+  This set of classes is designed to be flexible and efficient.  I use non-virtual public inheritence, which
+    most everyone will tell you is a horrible thing to do.  I disagree.  Power over safety is the bread and
+    butter of the class of C languages.  If you try using derived classes through pointer to base class, then
+    you are using these classes incorrectly.  You can allocate dynamically, of course, but the pointer type
+    must be to the class of interest.  Not every problem should be solved through virtual tools, which carry
+    some real overhead.  Why throw out power offered by the language by sticking to simple rules of thumb?
+    Instead, use all tools wisely.
+  There is no automated way (that I know of) to prevent improper base pointer to derived class.  Using these
+    in that way leads to memory leaks (and is the reason for that rule of thumb).
+*/
+
+namespace Bed {
+
+  namespace NoPool {
+
+    const CoordType MAXCHROMSIZE = TOKEN_CHR_MAX_LENGTH;
+    const CoordType MAXIDSIZE = TOKEN_ID_MAX_LENGTH;
+    const CoordType MAXRESTSIZE = TOKEN_REST_MAX_LENGTH;
+
+
+    /*****************************************/
+    /* ChromInfo Classes                     */
+    /*****************************************/
+
+    // ChromInfo non-specialized declaration
+    template <bool IsNonStatic>
+    struct ChromInfo {
+
+      ChromInfo() : chrom_(new char[1]) { chrom_[0] = '\0'; }
+      ChromInfo(const ChromInfo& c)
+          : chrom_(new char[(c.chrom_ != NULL) ? (std::strlen(c.chrom_) + 1) : 1])
+        { *chrom_ = '\0'; if ( c.chrom_ != NULL ) std::strcpy(chrom_, c.chrom_); }
+      explicit ChromInfo(char const* c)
+          : chrom_(new char[(c != NULL) ? (std::strlen(c)+1) : 1])
+        { *chrom_ = '\0'; if ( c != NULL ) std::strcpy(chrom_, c); }
+
+      // Properties
+      char const* chrom() const { return chrom_; }
+      void chrom(char const* chrom) {
+        if ( chrom_ )
+          delete [] chrom_;
+        if ( chrom != NULL ) {
+          chrom_ = new char[std::strlen(chrom) + 1];
+          std::strcpy(chrom_, chrom);
+        } else {
+          chrom_ = new char[1];
+          *chrom_ = '\0';
+        }
+      }
+
+      // Operators
+      ChromInfo& operator=(const ChromInfo& c) {
+        if ( chrom_ )
+          delete [] chrom_;
+        chrom_ = new char[(c.chrom_ != NULL) ? (std::strlen(c.chrom_) + 1) : 1];
+        *chrom_ = '\0'; if ( c.chrom_ != NULL ) std::strcpy(chrom_, c.chrom_);
+        return *this;
+      }
+
+      ~ChromInfo() { 
+        if ( chrom_ )
+          delete [] chrom_;
+        chrom_ = NULL;
+      }
+
+    protected:
+      char* chrom_;
+    };
+
+
+    // ChromInfo specialization : uses static chromosome info
+    template <>
+    struct ChromInfo<false> {
+
+      ChromInfo() { chrom_[0] = '\0'; }
+      explicit ChromInfo(char const* chr) { std::strcpy(chrom_, chr); }
+      /* Desire default-shallow copy-construction & copy-assignment */
+
+      // Properties
+      char const* chrom() const { return chrom_; }
+      void chrom(char const* chrom) { std::strcpy(chrom_, chrom); }
+
+    protected:
+      static char chrom_[MAXCHROMSIZE+1];
+    };
+
+    char ChromInfo<false>::chrom_[MAXCHROMSIZE+1];
+
+
+    /*****************************************/
+    /* BasicCoords Classes                   */
+    /*****************************************/
+
+    // Forward declaration
+    template <bool IsNonStaticChrom = true, bool HasRest = false>
+    struct BasicCoords;
+
+
+    // BasicCoords specialization 1: vanilla (default) information
+    template <bool IsNonStaticChrom>
+    struct BasicCoords<IsNonStaticChrom, false> : public ChromInfo<IsNonStaticChrom> {
+
+      BasicCoords() : BaseClass(), start_(1), end_(0) { /* invalid coords by default */ }
+      BasicCoords(char const* chrom, CoordType start, CoordType end)
+        : BaseClass(chrom), start_(start), end_(end) {}
+      BasicCoords(const BasicCoords& c)
+        : BaseClass(c.chrom_), start_(c.start_), end_(c.end_) {}
+      explicit BasicCoords(FILE* inF) : BaseClass()
+        { this->readline(inF); }
+      explicit BasicCoords(const std::string& inS) : BaseClass()
+        { this->readline(inS); }
+
+      // Properties
+      CoordType length() const { return end_ - start_; }
+      CoordType median() const { return start_ + ((end_ - start_) / 2); }
+      inline CoordType distance(const BasicCoords& a) const {
+        if ( 0 == std::strcmp(chrom_, a.chrom_) )
+          return start_ - a.start_;
+        return std::numeric_limits<CoordType>::max();
+      }
+      inline SignedCoordType sepDistance(const BasicCoords& a) const {
+        if( 0 == std::strcmp(chrom_, a.chrom_) )
+          return end_ - a.start_;
+        return std::numeric_limits<CoordType>::max();
+      }
+      void start(CoordType start) { start_ = start; }
+      CoordType start() const { return start_; }
+      void end(CoordType end) { end_ = end; }
+      CoordType end() const { return end_; }
+
+      // Comparison utilities
+      inline CoordType overlap(const BasicCoords& a) const {
+        if ( 0 != std::strcmp(chrom_, a.chrom_) )
+          return 0;
+        if ( start_ >= a.start_ ) {
+          if ( a.end_ > start_ ) {
+            if ( a.end_ > end_ )
+              return end_ - start_;
+            return a.end_ - start_;
+          }
+          else
+            return 0;
+        } else {
+          if ( end_ > a.start_ ) {
+            if ( a.end_ < end_ )
+              return a.end_ - a.start_;
+            return end_ - a.start_;
+          }
+          else
+           return 0;
+        }
+      }
+      BasicCoords& intersection(const BasicCoords& a) {
+        if ( overlap(a) ) {
+          start_ = std::max(start_, a.start_);
+          end_ = std::min(end_, a.end_);
+        }
+        else
+          start_ = end_ = 0;
+        return *this;
+      }
+      BasicCoords& eunion(const BasicCoords& a) {
+        if ( overlap(a) ) {
+          start_ = std::min(start_, a.start_);
+          end_ = std::max(end_, a.end_);
+        }
+        else
+          start_ = end_ = 0;
+        return *this;
+      }
+      static bool lengthCompare(const BasicCoords& a, const BasicCoords& b)
+        { return a.length() < b.length(); }
+
+      // Operators
+      BasicCoords& operator=(const BasicCoords& c) {
+        BaseClass::operator=(c);
+        start_ = c.start_;
+        end_ = c.end_;
+        return *this;
+      }
+
+      // IO
+      inline void print() const {
+        static const std::string lclStatic = outFormatter();
+        static char const* format = lclStatic.c_str();
+        std::printf(format, chrom_, start_, end_);
+      }
+      inline void println() const {
+        static const std::string heapFormat = (outFormatter() + "\n");
+        static char const* format = heapFormat.c_str();
+        std::printf(format, chrom_, start_, end_);
+      }
+      inline int readline(const std::string& inputLine) {
+        static char chrBuf[MAXCHROMSIZE + 1];
+        chrBuf[0] = '\0';
+        static const std::string lclStatic = inFormatter();
+        static char const* format = lclStatic.c_str();
+        int numScan = std::sscanf(inputLine.c_str(),
+                                  format, chrBuf,
+                                  &start_, &end_);
+        this->chrom(chrBuf);
+        return numScan;
+      }
+      inline int readline(FILE* inputFile) {
+        static char chrBuf[MAXCHROMSIZE + 1];
+        chrBuf[0] = '\0';
+        static std::string lclstatic = inFormatter();
+        static char const* format = lclstatic.c_str();
+        int numScan = std::fscanf(inputFile,
+                                  format, chrBuf, 
+                                  &start_, &end_);
+        std::fgetc(inputFile); // chomp newline
+        this->chrom(chrBuf);
+        return numScan;
+      }
+
+      static const int NumFields = 3;
+      static const bool UseRest = false;
+
+    protected:
+      typedef ChromInfo<IsNonStaticChrom> BaseClass;
+      using BaseClass::chrom_;
+      CoordType start_;
+      CoordType end_;
+
+      static std::string outFormatter() {
+        return(std::string("%s\t%" PRIu64 "\t%" PRIu64));
+      }
+
+      static std::string inFormatter() {
+        return(std::string("%s\t%" SCNu64 "\t%" SCNu64 "%*[^\n]s\n"));
+      }
+    };
+
+
+    // Non-Specialization: Extend partial specialization with "rest-size" information
+    template <bool IsNonStaticChrom, bool HasRest>
+    struct BasicCoords
+      : public BasicCoords<IsNonStaticChrom, false> {
+
+      BasicCoords() : BaseClass(), rest_(new char[1]) { *rest_ = '\0'; }
+      BasicCoords(char const* chrom, CoordType start, CoordType end, char const* rest = NULL)
+        : BaseClass(chrom, start, end), rest_(new char[(rest != NULL) ? (std::strlen(rest)+1) : 1]) {
+        *rest_ = '\0';
+        if ( rest && std::strcmp(rest, "") != 0 ) {
+          if ( rest[0] != '\t' )
+            rest_[0] = '\t';
+          std::strcat(rest_, rest);
+        }
+      }
+      BasicCoords(const BasicCoords& c)
+        : BaseClass(c), rest_(new char[(c.rest_ != NULL) ? (std::strlen(c.rest_) + 1) : 1])
+        { *rest_ = '\0'; if ( c.rest_ != NULL ) std::strcpy(rest_, c.rest_); }
+      explicit BasicCoords(FILE* inF) : BaseClass(), rest_(0)
+        { this->readline(inF); }
+      explicit BasicCoords(const std::string& inS) : BaseClass(), rest_(0)
+        { this->readline(inS); }
+
+      // Properties
+      char const* rest() const { return rest_; }
+      char const* full_rest() const { return rest(); }
+
+      // Operators
+      BasicCoords& operator=(const BasicCoords& c) {
+        BaseClass::operator=(c);
+        if ( rest_ )
+          delete [] rest_;
+        rest_ = new char[(c.rest_ != NULL) ? (std::strlen(c.rest_) + 1) : 1];
+        *rest_ = '\0';
+        if ( c.rest_ != NULL )
+          std::strcpy(rest_, c.rest_);
+        return *this;
+      }
+
+      // IO
+      inline void print() const {
+        static const std::string lclStatic = outFormatter();
+        static char const* format = lclStatic.c_str();
+        std::printf(format, chrom_, start_, end_, rest_);
+      }
+      inline void println() const {
+        static const std::string heapFormat = (outFormatter() + "\n");
+        static char const* format = heapFormat.c_str();
+        std::printf(format, chrom_, start_, end_, rest_);
+      }
+      inline int readline(const std::string& inputLine) {
+        static char chrBuf[MAXCHROMSIZE + 1];
+        chrBuf[0] = '\0';
+        static char restBuf[MAXRESTSIZE + 1];
+        restBuf[0] = '\0';
+        static const std::string lclStatic = inFormatter();
+        static char const* format = lclStatic.c_str();
+        int numScan = std::sscanf(inputLine.c_str(), 
+                                  format, chrBuf, &start_,
+                                  &end_, restBuf);
+        this->chrom(chrBuf);
+        if ( rest_ )
+          delete [] rest_;
+        rest_ = new char[std::strlen(restBuf) + 1];
+        std::strcpy(rest_, restBuf);
+        return numScan;
+      }
+      inline int readline(FILE* inputFile) {
+        static char chrBuf[MAXCHROMSIZE + 1];
+        chrBuf[0] = '\0';
+        static char restBuf[MAXRESTSIZE + 1];
+        restBuf[0] = '\0';
+        static const std::string lclStatic = inFormatter();
+        static char const* format = lclStatic.c_str();
+        int numScan = std::fscanf(inputFile, format,
+                                  chrBuf, &start_,
+                                  &end_, restBuf);
+        std::fgetc(inputFile); // chomp newline
+        this->chrom(chrBuf);
+        if ( rest_ )
+          delete [] rest_;
+        rest_ = new char[std::strlen(restBuf) + 1];
+        std::strcpy(rest_, restBuf);
+        return numScan;
+      }
+
+      ~BasicCoords() {
+        if ( rest_ )
+          delete [] rest_;
+      }
+
+      static const bool UseRest = true;
+
+    protected:
+      typedef BasicCoords<IsNonStaticChrom, false> BaseClass;
+      using BaseClass::chrom_;
+      using BaseClass::start_;
+      using BaseClass::end_;
+      char* rest_;
+
+      static std::string outFormatter() {
+        return(std::string("%s\t%" PRIu64 "\t%" PRIu64 "%s"));
+      }
+
+      static std::string inFormatter() {
+        return(std::string("%s\t%" SCNu64 "\t%" SCNu64 "%[^\n]s\n"));
+      }
+    };
+  
+
+    /*****************************************/
+    /* Bed4 Classes                         */
+    /*****************************************/
+
+    // Forward declaration, forcing specialization
+    template <typename BedType, bool HasRest = false>
+    struct Bed4;
+
+    // Bed4 specialization 1: vanilla (default) information
+    template <bool IsNonStaticChrom, bool B3HasRest>
+    struct Bed4<BasicCoords<IsNonStaticChrom, B3HasRest>, false> 
+      : public BasicCoords<IsNonStaticChrom, false> {
+
+      Bed4() : BaseClass(), id_(new char[1]) { *id_ = '\0'; }
+      Bed4(char const* chrom, CoordType start, CoordType end, char const* id)
+        : BaseClass(chrom, start, end), id_(new char[(id != NULL) ? (std::strlen(id)+1) : 1])
+        { *id_ = '\0'; if ( id != NULL ) std::strcpy(id_, id); }
+      Bed4(const Bed4& c)
+        : BaseClass(c), id_(new char[(c.id_ != NULL) ? (std::strlen(c.id_) + 1) : 1])
+        { *id_ = '\0'; if ( c.id_ != NULL ) std::strcpy(id_, c.id_); }
+      explicit Bed4(FILE* inF) : BaseClass(), id_(0)
+        { this->readline(inF); }
+      explicit Bed4(const std::string& inS) : BaseClass(), id_(0)
+        { this->readline(inS); }
+
+      // IO
+      inline int readline(const std::string& inputLine) {
+        static char chrBuf[MAXCHROMSIZE + 1];
+        chrBuf[0] = '\0';
+        static char idBuf[MAXIDSIZE + 1];
+        idBuf[0] = '\0';
+
+        static const std::string lclStatic = inFormatter();
+        static char const* format = lclStatic.c_str();
+        int numScanned = std::sscanf(inputLine.c_str(), format,
+                                     chrBuf,
+                                     &start_,
+                                     &end_,
+                                     idBuf);
+        this->chrom(chrBuf);
+        this->id(idBuf);
+        return numScanned;
+      }
+      inline int readline(FILE* inputFile) {
+        static char chrBuf[MAXCHROMSIZE + 1];
+        chrBuf[0] = '\0';
+        static char idBuf[MAXIDSIZE + 1];
+        idBuf[0] = '\0';
+
+        static const std::string lclStatic = inFormatter();
+        static char const* format = lclStatic.c_str();
+        int numScanned = std::fscanf(inputFile, format,
+                                     chrBuf,
+                                     &start_,
+                                     &end_, 
+                                     idBuf);
+        std::fgetc(inputFile); // read and discard newline
+        this->chrom(chrBuf);
+        this->id(idBuf);
+        return numScanned;
+      }
+      inline void print() const {
+        static const std::string lclStatic = outFormatter();
+        static char const* format = lclStatic.c_str();
+        std::printf(format, chrom_, start_, end_, id_);
+      }
+      inline void println() const {
+        static const std::string heapFormat = (outFormatter() + "\n");
+        static char const* format = heapFormat.c_str();
+        printf(format, chrom_, start_, end_, id_);
+      }
+
+      // Properties
+      void id(char const* id) {
+        if ( id_ )
+          delete [] id_;
+        id_ = new char[(id != NULL) ? (std::strlen(id) + 1) : 1];
+        *id_ = '\0'; if ( id != NULL ) std::strcpy(id_, id);
+      }
+      char const* id() const { return id_; }
+
+      // Operators
+      Bed4& operator=(const Bed4& c) {
+        BaseClass::operator=(c);
+        if ( id_ )
+          delete [] id_;
+        id_ = new char[(c.id_ != NULL) ? (std::strlen(c.id_) + 1) : 1];
+        *id_ = '\0'; if ( c.id_ != NULL ) std::strcpy(id_, c.id_);
+        return *this;
+      }
+
+      ~Bed4() {
+        if ( id_ )
+          delete [] id_;
+        id_ = NULL;
+      }
+
+      static const int NumFields = 4;
+      static const bool UseRest = false;
+
+    protected:
+      typedef BasicCoords<IsNonStaticChrom, false> BaseClass;
+      using BaseClass::chrom_;
+      using BaseClass::start_;
+      using BaseClass::end_;
+
+      char* id_;
+
+      static std::string outFormatter() {
+        return(BaseClass::outFormatter() + "\t%s");
+      }
+
+      static std::string inFormatter() {
+        return(outFormatter() + "%*[^\n]s\n");
+      }
+    };
+
+    // Specialization 2: Extend specialization 1 with "rest-size" information
+    template <typename BedType, bool HasRest>
+    struct Bed4 
+      : public Bed4<BedType, false> {
+
+      Bed4() : BaseClass(), rest_(new char[1]), fullrest_(new char[1]) { *rest_ = '\0'; *fullrest_ = '\0'; }
+      Bed4(const Bed4& c)
+        : BaseClass(c), rest_(new char[(c.rest_ != NULL) ? (std::strlen(c.rest_)+1) : 1]),
+                       fullrest_(new char[(c.fullrest_ != NULL) ? (std::strlen(c.fullrest_)+1) : 1])
+         { *rest_ = '\0'; *fullrest_ = '\0';
+           if ( c.rest_ != NULL ) std::strcpy(rest_, c.rest_);
+           if ( c.fullrest_ != NULL ) std::strcpy(fullrest_, c.fullrest_);
+         }
+      Bed4(char const* chrom, CoordType start, CoordType end, char const* id, char const* rest = NULL)
+        : BaseClass(chrom, start, end, id), rest_(new char[(rest != NULL) ? (std::strlen(rest)+1) : 1]),
+              fullrest_(new char[((rest != NULL) ? (std::strlen(rest)+1) : 1) + ((id != NULL) ? (std::strlen(id)+1) : 1)]) {
+        *rest_ = '\0'; *fullrest_ = '\0';
+        if ( id && std::strcmp(id, "") != 0 )
+          std::strcpy(fullrest_, id);
+
+        if ( rest && std::strcmp(rest, "") != 0 ) {
+          if ( rest[0] != '\t' )
+            rest_[0] = '\t';
+          std::strcat(rest_, rest);
+          std::strcat(fullrest_, rest_);
+        }
+      }
+      explicit Bed4(FILE* inF) : BaseClass(), rest_(0), fullrest_(0)
+        { this->readline(inF); }
+      explicit Bed4(const std::string& inS) : BaseClass(), rest_(0), fullrest_(0)
+        { this->readline(inS); }
+
+      // Properties
+      char const* rest() const { return rest_; }
+      char const* full_rest() const { return fullrest_; }
+
+      // IO
+      inline void print() const {
+        static const std::string lclStatic = outFormatter();
+        static char const* format = lclStatic.c_str();
+        std::printf(format, chrom_, start_, end_, id_, rest_);
+      }
+      inline void println() const {
+        static const std::string heapFormat = (outFormatter() + "\n");
+        static char const* format = heapFormat.c_str();
+        std::printf(format, chrom_, start_, end_, id_, rest_);
+      }
+      inline int readline(const std::string& inputLine) {
+        static char chrBuf[MAXCHROMSIZE + 1];
+        chrBuf[0] = '\0';
+        static char idBuf[MAXIDSIZE + 1];
+        idBuf[0] = '\0';
+        static char restBuf[MAXRESTSIZE + 1];
+        restBuf[0] = '\0';
+        static const std::string lclStatic = inFormatter();
+        static char const* format = lclStatic.c_str();
+        int numScanned = std::sscanf(inputLine.c_str(),
+                                     format, chrBuf,
+                                     &start_, &end_, idBuf, 
+                                     restBuf);
+        this->chrom(chrBuf);
+        this->id(idBuf);
+        if ( rest_ )
+          delete [] rest_;
+        rest_ = new char[std::strlen(restBuf) + 1];
+        std::strcpy(rest_, restBuf);
+        if ( fullrest_ )
+          delete [] fullrest_;
+        std::size_t sz = (std::strlen(restBuf)+1) + (std::strlen(idBuf) + 1);
+        fullrest_ = new char[sz];
+        std::strcpy(fullrest_, idBuf);
+        std::strcat(fullrest_, restBuf);
+        return numScanned;
+      }
+      inline int readline(FILE* inputFile) {
+        static char chrBuf[MAXCHROMSIZE + 1];
+        chrBuf[0] = '\0';
+        static char idBuf[MAXIDSIZE + 1];
+        idBuf[0] = '\0';
+        static char restBuf[MAXRESTSIZE + 1];
+        restBuf[0] = '\0';
+  
+        static const std::string lclStatic = inFormatter();
+        static char const* format = lclStatic.c_str();
+        int numScanned = std::fscanf(inputFile,
+                                     format, chrBuf, 
+                                     &start_, &end_, idBuf, 
+                                     restBuf);
+
+        std::fgetc(inputFile); // Read and discard trailing newline
+        this->chrom(chrBuf);
+        this->id(idBuf);
+        if ( rest_ )
+          delete [] rest_;
+        rest_ = new char[std::strlen(restBuf) + 1];
+        std::strcpy(rest_, restBuf);
+        std::size_t sz = (std::strlen(restBuf)+1) + (std::strlen(idBuf) + 1);
+        if ( fullrest_ )
+          delete [] fullrest_;
+        fullrest_ = new char[sz];
+        std::strcpy(fullrest_, idBuf);
+        std::strcat(fullrest_, restBuf);
+        return numScanned;
+      }
+
+      // Operators
+      Bed4& operator=(const Bed4& c) {
+        BaseClass::operator=(c);
+        if ( rest_ )
+          delete [] rest_;
+        if ( fullrest_ )
+          delete [] fullrest_;
+        rest_ = new char[(c.rest_ != NULL) ? (std::strlen(c.rest_) + 1) : 1];
+        *rest_ = '\0'; if ( c.rest_ != NULL ) std::strcpy(rest_, c.rest_);
+        fullrest_ = new char[(c.fullrest_ != NULL) ? (std::strlen(c.fullrest_) + 1) : 1];
+        *fullrest_ = '\0'; if ( c.fullrest_ != NULL ) std::strcpy(fullrest_, c.fullrest_);
+        return *this;
+      }
+
+      ~Bed4() {
+        if ( rest_ )
+          delete [] rest_;
+        if ( fullrest_ )
+          delete [] fullrest_;
+      }
+
+    static const bool UseRest = true;
+
+    protected:
+      typedef Bed4<BedType, false> BaseClass;
+      using BaseClass::chrom_;
+      using BaseClass::start_;
+      using BaseClass::end_;
+      using BaseClass::id_;
+
+      char* rest_;
+      char* fullrest_;
+      static std::string outFormatter() {
+        return(BaseClass::outFormatter() + "%s");
+      }
+
+      static std::string inFormatter() {
+        return(BaseClass::outFormatter() + "%[^\n]s\n");
+      }
+    };
+
+
+    /*****************************************/
+    /* Bed5 Classes                          */
+    /*****************************************/
+
+    // Forward declaration, forcing specialization
+    template <typename Bed4Type, typename MeasureType, bool HasRest = false>
+    struct Bed5;
+
+    // Bed5 specialization 1: vanilla (default) information
+    template <typename U, bool Bed4HasRest, typename MeasureType>
+    struct Bed5<Bed4<U, Bed4HasRest>, MeasureType, false>
+      : public Bed4<U, false> {
+
+      Bed5() : BaseClass() {}
+      Bed5(const Bed5& c) : BaseClass(c), measurement_(0) {}
+      Bed5(char const* chrom, CoordType start, CoordType end, char const* id, MeasureType measurement)
+          : BaseClass(chrom, start, end, id), measurement_(measurement) {}
+      explicit Bed5(const std::string& inS) : BaseClass(), measurement_(0)
+        { this->readline(inS); }
+      explicit Bed5(FILE* inF) : BaseClass(), measurement_(0)
+        { this->readline(inF); }
+
+      // Parameters
+      typedef MeasureType MeasurementType;
+      static const int NumFields = 5;
+      static const bool UseRest = false;
+
+      // Properties
+      inline MeasurementType measurement() const { return measurement_; }
+
+      // IO
+      inline int readline(const std::string& inputLine) {
+        static char chrBuf[MAXCHROMSIZE + 1];
+        chrBuf[0] = '\0';
+        static char idBuf[MAXIDSIZE + 1];
+        idBuf[0] = '\0';
+        static const std::string lclStatic = inFormatter();
+        static char const* format = lclStatic.c_str();
+        int numScanned = std::sscanf(inputLine.c_str(),
+                                     format, chrBuf,
+                                     &start_, &end_, idBuf, 
+                                     &measurement_);
+        this->chrom(chrBuf);
+        this->id(idBuf);
+        return numScanned;
+      }
+      inline int readline(FILE* inputFile) {
+        static char chrBuf[MAXCHROMSIZE + 1];
+        chrBuf[0] = '\0';
+        static char idBuf[MAXIDSIZE + 1];
+        idBuf[0] = '\0';
+        static const std::string lclStatic = inFormatter();
+        static char const* format = lclStatic.c_str();
+        int numScanned = std::fscanf(inputFile,
+                                     format, chrBuf, 
+                                     &start_, &end_, idBuf, 
+                                     &measurement_);
+
+        std::fgetc(inputFile); // Read and discard trailing newline
+        this->chrom(chrBuf);
+        this->id(idBuf);
+        return numScanned;
+      }
+      inline void print() const {
+        static const std::string lclStatic = outFormatter();
+        static char const* format = lclStatic.c_str();
+        std::printf(format, chrom_, start_, end_, id_, measurement_);
+      }
+      inline void println() const {
+        static const std::string heapFormat = outFormatter() + "\n";
+        static char const* format = heapFormat.c_str();
+        std::printf(format, chrom_, start_, end_, id_, measurement_);
+      }
+
+      // Operators
+      Bed5& operator=(const Bed5& c) {
+        BaseClass::operator=(c);
+        this->measurement_ = c.measurement_;
+        return *this;
+      }
+      inline operator MeasurementType() const { return measurement_; }
+
+    protected:
+      typedef Bed4<U, false> BaseClass;
+      using BaseClass::chrom_;
+      using BaseClass::start_;
+      using BaseClass::end_;
+      using BaseClass::id_;
+      MeasureType measurement_;
+
+      static std::string outFormatter() {
+        typedef typename std::remove_cv<MeasureType>::type MType;
+        return(BaseClass::outFormatter() + "\t" + Formats::Format(MType()));
+      }
+
+      static std::string inFormatter() {
+        return(outFormatter() + "%*[^\n]s\n");
+      }
+    };
+
+
+    // Specialization 2: Extend specialization 1 with "rest-size" information
+    template <typename Bed4Type, typename MeasureType, bool HasRest>
+    struct Bed5
+      : public Bed5<Bed4Type, MeasureType, false> { /* Bed4Type is forced to be Bed4<> specialization above */
+
+      Bed5() : BaseClass(), rest_(new char[1]), fullrest_(new char[1]) { *rest_ = '\0'; *fullrest_ = '\0'; restOffset_ = -1; }
+      Bed5(const Bed5& c)
+        : BaseClass(c), restOffset_(c.restOffset_), rest_(new char[(c.rest_ != NULL) ? (std::strlen(c.rest_+1)) : 1]),
+          fullrest_(new char[(c.fullrest_ != NULL) ? (std::strlen(c.fullrest_+1)) : 1])
+        {
+          *rest_ = '\0'; if ( c.rest_ != NULL ) std::strcpy(rest_, c.rest_);
+          *fullrest_ = '\0'; if ( c.fullrest_ != NULL ) std::strcpy(fullrest_, c.fullrest_);
+        }
+      Bed5(char const* chrom, CoordType start, CoordType end,
+           char const* id, MeasureType measurement, char const* rest = NULL)
+        : BaseClass(chrom, start, end, id, measurement),
+          rest_(new char[(rest != NULL) ? (std::strlen(rest)+1) : 1]),
+          fullrest_(new char[((rest != NULL) ? (std::strlen(rest)+1) : 1) + ((id != NULL) ? (std::strlen(id)+1) : 1)])
+      {
+        *rest_ = '\0'; *fullrest_ = '\0';
+        if ( id && std::strcmp(id, "") != 0 )
+          std::strcpy(fullrest_, id);
+
+        if ( rest && 0 != std::strcmp(rest, "") ) {
+          if ( rest[0] != '\t' )
+            rest_[0] = '\t';
+          std::strcat(rest_, rest);
+          std::strcat(fullrest_, rest_);
+        }
+      }
+      explicit Bed5(FILE* inF) : BaseClass(), rest_(0), fullrest_(0)
+        { this->readline(inF); }
+      explicit Bed5(const std::string& inS) : BaseClass(), rest_(0), fullrest_(0)
+        { this->readline(inS); }
+
+      // Properties
+      char const* rest() const { return rest_; }
+      char const* full_rest() const { return fullrest_; }
+      int rest_offset() const { return restOffset_; }
+
+      // IO
+      inline void print() const {
+        static const std::string lclStatic = outFormatter();
+        static char const* format = lclStatic.c_str();
+        std::printf(format, chrom_, start_, end_, id_, measurement_, rest_);
+      }
+      inline void println() const {
+        static const std::string heapFormat = outFormatter() + "\n";
+        static char const* format = heapFormat.c_str();
+        std::printf(format, chrom_, start_, end_, id_, measurement_, rest_);
+      }
+      inline int readline(const std::string& inputLine) {
+        static char chrBuf[MAXCHROMSIZE + 1];
+        chrBuf[0] = '\0';
+        static char idBuf[MAXIDSIZE + 1];
+        idBuf[0] = '\0';
+        static char restBuf[MAXRESTSIZE + 1];
+        restBuf[0] = '\0';
+        static const std::string lclStatic = inFormatter();
+        static char const* format = lclStatic.c_str();
+        int numScanned = std::sscanf(inputLine.c_str(),
+                                     format, chrBuf,
+                                     &start_, &end_, idBuf, 
+                                     &measurement_, restBuf);
+
+        this->chrom(chrBuf);
+        this->id(idBuf);
+        if ( rest_ )
+          delete [] rest_;
+        rest_ = new char[std::strlen(restBuf) + 1];
+        std::strcpy(rest_, restBuf);
+        if ( fullrest_ )
+          delete [] fullrest_;
+        std::size_t sz = (std::strlen(restBuf)+1) + (std::strlen(idBuf) + 1);
+        fullrest_ = new char[sz];
+        restOffset_ = -1;
+        std::strcpy(fullrest_, idBuf);
+        if ( restBuf[0] != '\0' )
+          restOffset_ = std::strlen(idBuf);
+        std::strcat(fullrest_, restBuf);
+        return numScanned;
+      }
+      inline int readline(FILE* inputFile) {
+        static char chrBuf[MAXCHROMSIZE + 1];
+        chrBuf[0] = '\0';
+        static char idBuf[MAXIDSIZE + 1];
+        idBuf[0] = '\0';
+        static char restBuf[MAXRESTSIZE + 1];
+        restBuf[0] = '\0';
+
+        static const std::string lclStatic = inFormatter();
+        static char const* format = lclStatic.c_str();
+        int numScanned = std::fscanf(inputFile,
+                                     format, chrBuf, 
+                                     &start_, &end_, idBuf, 
+                                     &measurement_, restBuf);
+
+        std::fgetc(inputFile); // Read and discard trailing newline
+        this->chrom(chrBuf);
+        this->id(idBuf);
+        if ( rest_ )
+          delete [] rest_;
+        rest_ = new char[std::strlen(restBuf) + 1];
+        std::strcpy(rest_, restBuf);
+
+        if ( fullrest_ )
+          delete [] fullrest_;
+
+        std::size_t sz = (std::strlen(restBuf)+1) + (std::strlen(idBuf) + 1);
+        fullrest_ = new char[sz];
+        restOffset_ = -1;
+        std::strcpy(fullrest_, idBuf);
+        if ( restBuf[0] != '\0' )
+          restOffset_ = std::strlen(idBuf);
+        std::strcat(fullrest_, restBuf);
+        return numScanned;
+      }
+
+      // Operators
+      Bed5& operator=(const Bed5& c) {
+        BaseClass::operator=(c);
+        if ( rest_ )
+          delete [] rest_;
+        if ( fullrest_ )
+          delete [] fullrest_;
+        rest_ = new char[(c.rest_ != NULL) ? (std::strlen(c.rest_) + 1) : 1];
+        *rest_ = '\0'; if ( c.rest_ != NULL ) std::strcpy(rest_, c.rest_);
+        fullrest_ = new char[(c.fullrest_ != NULL) ? (std::strlen(c.fullrest_) + 1) : 1];
+        *fullrest_ = '\0'; if ( c.fullrest_ != NULL ) std::strcpy(fullrest_, c.fullrest_);
+        return *this;
+      }
+
+      ~Bed5() {
+        if ( rest_ )
+          delete [] rest_;
+        if ( fullrest_ )
+          delete [] fullrest_;
+      }
+
+      // Parameters
+      static const bool UseRest = true;
+
+    protected:
+      typedef Bed5<Bed4Type, MeasureType, false> BaseClass;
+      using BaseClass::chrom_;
+      using BaseClass::start_;
+      using BaseClass::end_;
+      using BaseClass::id_;
+      using BaseClass::measurement_;
+
+      int restOffset_;
+      char* rest_;
+      char* fullrest_;
+
+      static std::string outFormatter() {
+        return(BaseClass::outFormatter() + "%s");
+      }
+
+      static std::string inFormatter() {
+        return(BaseClass::outFormatter() + "%[^\n]s\n");
+      }
+    };
+
+  } // namespace NoPool
+
+} // namespace Bed
+
+#endif // BED_MINMEM_HPP
diff --git a/interfaces/general-headers/data/starch/starchApi.hpp b/interfaces/general-headers/data/starch/starchApi.hpp
index 536f516..eb7eb01 100644
--- a/interfaces/general-headers/data/starch/starchApi.hpp
+++ b/interfaces/general-headers/data/starch/starchApi.hpp
@@ -865,8 +865,10 @@ namespace starch
             archMdIter = archMdIter->next;
             if (archMdIter)
                 setCurrentChromosome(archMdIter->chromosome);
-            else
-                free(currentChromosome), currentChromosome = NULL;
+            else {
+                free(currentChromosome); 
+                currentChromosome = NULL;
+            }
         }
         void setCurrentChromosome(char *_cC) {
             if (currentChromosome) {
@@ -880,7 +882,16 @@ namespace starch
         }
         void setCurrentStart(Bed::SignedCoordType  _cS) { currentStart = _cS; }
         void setCurrentStop(Bed::SignedCoordType _cS) { currentStop = _cS; }
-        void setCurrentRemainder(char * _remainder) { currentRemainder = _remainder; }
+        void setCurrentRemainder(char * _remainder) { 
+            if (currentRemainder) {
+                free(currentRemainder);
+                currentRemainder = NULL;
+            }
+            currentRemainder = static_cast<char *>( malloc (strlen(_remainder) + 1) );
+            if (currentRemainder) {
+                strncpy(currentRemainder, _remainder, strlen(_remainder) + 1);
+            }
+        }
         void setSelectedChromosome(const std::string& _selChr) { selectedChromosome = _selChr; }
     };
     
@@ -1462,7 +1473,7 @@ namespace starch
                     extractLine(line);
                     firstPass = false;
                 }
-                
+
                 if ((t_firstInputToken[0] == 'p') && (archMdIter)) {
 #ifdef DEBUG
                     std::fprintf(stderr, "--> prefix is 'p'\n");
@@ -1566,7 +1577,7 @@ namespace starch
                                                                                        &_currRemainder,
                                                                                        &_currRemainderLen);
 #ifdef DEBUG
-                                std::fprintf(stderr,"t_ [ %s | %s] _curr [ %s | %" PRId64 " | %" PRId64 " ]\n", t_firstInputToken, t_secondInputToken, _currChr, _currStart, _currStop);
+                                std::fprintf(stderr,"t_ [ %s | %s] _curr [ %s | %" PRId64 " | %" PRId64 " | remlen: %zu]\n", t_firstInputToken, t_secondInputToken, _currChr, _currStart, _currStop, _currRemainderLen);
 #endif
                                 if (res != 0)
                                     break;
@@ -1772,7 +1783,7 @@ namespace starch
                 case kUndefined: {
                     throw(std::string("ERROR: backend compression type is undefined"));
                 }
-            }            
+            }
         }
 
         if ((_currChr && archType == kGzip && !postBreakdownZValuesIdentical) || (_currChr && archType == kBzip2)) {
@@ -1781,11 +1792,16 @@ namespace starch
 #endif
             setCurrentStart(_currStart);
             setCurrentStop(_currStop);
-            setCurrentRemainder(_currRemainder);
-            if (_currRemainder)
+            if (_currRemainder) {
+                setCurrentRemainder(_currRemainder);
+            }
+
+            if (_currRemainder && (_currRemainderLen > 0)) {
                 std::sprintf(out, "%s\t%" PRId64 "\t%" PRId64 "\t%s", _currChr, _currStart, _currStop, _currRemainder);
-            else
+            }
+            else {
                 std::sprintf(out, "%s\t%" PRId64 "\t%" PRId64, _currChr, _currStart, _currStop);
+            }
             line = out;
 
             if (archType == kGzip)
@@ -1896,14 +1912,14 @@ namespace starch
             needToInflateZChunk = false;
         }
 
-        /* read through zOutBuf for newlines */                    
+        /* read through zOutBuf for newlines */
         for (; zOutBufIdx < zHave; zBufIdx++) {
             if (zOutBuf[zOutBufIdx++] == '\n') {
                 zLineBuf[zBufIdx] = '\0';
                 zBufIdx = 0;
 #ifdef DEBUG
                 std::fprintf(stderr, "\n--> full line [ %s ]\n", zLineBuf);
-#endif                
+#endif
                 return EXIT_SUCCESS;
             }
             else {
diff --git a/interfaces/general-headers/data/starch/starchHelpers.h b/interfaces/general-headers/data/starch/starchHelpers.h
index 8aebd03..d3b5b53 100644
--- a/interfaces/general-headers/data/starch/starchHelpers.h
+++ b/interfaces/general-headers/data/starch/starchHelpers.h
@@ -135,9 +135,9 @@ int     STARCH2_transformHeaderlessBEDInput(const FILE *inFp,
                                  const CompressionType compressionType,
                                             const char *tag,
                                             const char *note,
-                                         const Boolean generatePerChrSignatureFlag,   
+                                         const Boolean generatePerChrSignatureFlag,
                                          const Boolean reportProgressFlag,
-                                   const LineCountType reportProgressN);        
+                                   const LineCountType reportProgressN);
 
 int     STARCH2_writeStarchHeaderToOutputFp(const unsigned char *header, 
                                                      const FILE *fp);
diff --git a/interfaces/general-headers/suite/BEDOPS.Constants.hpp b/interfaces/general-headers/suite/BEDOPS.Constants.hpp
index 6dc7efd..1bc1c25 100644
--- a/interfaces/general-headers/suite/BEDOPS.Constants.hpp
+++ b/interfaces/general-headers/suite/BEDOPS.Constants.hpp
@@ -26,16 +26,45 @@
 #ifndef CONSTANTS_BEDOPS_H
 #define CONSTANTS_BEDOPS_H
 
-
+//
 // Don't use these directly; they just synchronize C and C++'s uses below
 //   - just want to utilize C++'s type system explicitly
-#define INT_TOKEN_CHR_MAX_LENGTH 127
-#define INT_TOKEN_ID_MAX_LENGTH 16383
-#define INT_TOKEN_REST_MAX_LENGTH 8*131072
-#define INT_MAX_DEC_INTEGERS 12
-#define INT_MAX_COORD_VALUE 999999999999 /* MAX_DEC_INTEGERS decimal integers; we assume >= 64-bit systems */
-#define INT_TOKENS_MAX_LENGTH (TOKEN_CHR_MAX_LENGTH + TOKEN_ID_MAX_LENGTH + TOKEN_REST_MAX_LENGTH + 2*MAX_DEC_INTEGERS)
-#define INT_TOKENS_HEADER_MAX_LENGTH TOKENS_MAX_LENGTH
+//
+
+#ifndef REST_EXPONENT
+#define REST_EXPONENT 15
+#endif
+
+#ifndef ID_EXPONENT
+#define ID_EXPONENT 13
+#endif
+
+#ifndef CHROM_EXPONENT
+#define CHROM_EXPONENT 7
+#endif
+
+#ifdef __cplusplus
+
+#include "utility/CompilerMath.hpp"
+
+#define BASE_VALUE 2
+#define INT_TOKEN_CHR_MAX_LENGTH Ext::Pow<BASE_VALUE, CHROM_EXPONENT>::value-1
+#define INT_TOKEN_ID_MAX_LENGTH Ext::Pow<BASE_VALUE, ID_EXPONENT>::value-1
+#define INT_TOKEN_REST_MAX_LENGTH Ext::Pow<BASE_VALUE, REST_EXPONENT>::value-1
+
+#else
+
+#define pwrtwo(x) (1UL << (x))
+#define INT_TOKEN_CHR_MAX_LENGTH pwrtwo(CHROM_EXPONENT)-1
+#define INT_TOKEN_ID_MAX_LENGTH pwrtwo(ID_EXPONENT)-1
+#define INT_TOKEN_REST_MAX_LENGTH pwrtwo(REST_EXPONENT)-1
+
+#endif
+
+#define INT_MAX_DEC_INTEGERS 12L
+#define INT_MAX_COORD_VALUE 999999999999 /* INT_MAX_DEC_INTEGERS decimal integers; we assume >= 64-bit systems */
+#define INT_TOKENS_MAX_LENGTH (INT_TOKEN_CHR_MAX_LENGTH + INT_TOKEN_ID_MAX_LENGTH + INT_TOKEN_REST_MAX_LENGTH + 2*INT_MAX_DEC_INTEGERS)
+#define INT_TOKENS_HEADER_MAX_LENGTH INT_TOKENS_MAX_LENGTH
 #define INT_TOKEN_CHR_FIELD_INDEX 0
 #define INT_TOKEN_START_FIELD_INDEX 1
 #define INT_TOKEN_STOP_FIELD_INDEX 2
@@ -52,8 +81,8 @@ namespace Bed {
   typedef int64_t SignedCoordType;
   typedef CoordType LineCountType;
   typedef CoordType BaseCountType;
-  typedef int LineLengthType;
-    
+  typedef unsigned long LineLengthType;
+
   static_assert(sizeof(SignedCoordType) >= sizeof(INT_MAX_COORD_VALUE), "INT_MAX_COORD_VALUE is too big!"); // expected-warning {{static_assert declarations are incompatible with C++98}}
 
   constexpr LineLengthType  TOKEN_CHR_MAX_LENGTH     = INT_TOKEN_CHR_MAX_LENGTH;
@@ -78,7 +107,7 @@ namespace Bed {
   typedef int64_t SignedCoordType;
   typedef CoordType LineCountType;
   typedef CoordType BaseCountType;
-  typedef int LineLengthType;
+  typedef unsigned long LineLengthType;
 
 #define TOKEN_CHR_MAX_LENGTH INT_TOKEN_CHR_MAX_LENGTH
 #define TOKEN_ID_MAX_LENGTH INT_TOKEN_ID_MAX_LENGTH
diff --git a/interfaces/general-headers/suite/BEDOPS.Version.hpp b/interfaces/general-headers/suite/BEDOPS.Version.hpp
index b61da2b..c3812ab 100644
--- a/interfaces/general-headers/suite/BEDOPS.Version.hpp
+++ b/interfaces/general-headers/suite/BEDOPS.Version.hpp
@@ -34,11 +34,11 @@ namespace BEDOPS {
 #endif
 
   static const char* revision() {
-    return("2.4.26");
+    return("2.4.28");
   }
 
   static const char* citation() {
-    return("http://bioinformatics.oxfordjournals.org/content/28/14/1919.abstract");
+    return("http://bioinformatics.oxfordjournals.org/content/28/14/1919.abstract\n            https://doi.org/10.1093/bioinformatics/bts277");
   }
 
 #ifdef __cplusplus
diff --git a/interfaces/general-headers/utility/PooledMemory.hpp b/interfaces/general-headers/utility/BitMonitor.hpp
similarity index 61%
copy from interfaces/general-headers/utility/PooledMemory.hpp
copy to interfaces/general-headers/utility/BitMonitor.hpp
index d094b55..9a61011 100644
--- a/interfaces/general-headers/utility/PooledMemory.hpp
+++ b/interfaces/general-headers/utility/BitMonitor.hpp
@@ -21,47 +21,152 @@
 //    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 //
 
-
-#ifndef __UTILS_SIMPLE_SMALLOBJ_MEM__
-#define __UTILS_SIMPLE_SMALLOBJ_MEM__
+#ifndef UTILS_BITMONITOR
+#define UTILS_BITMONITOR
 
 #include <algorithm>
 #include <array>
 #include <bitset>
+#include <iterator>
 #include <limits>
-#include <map>
 #include <ostream>
-#include <set>
 #include <type_traits>
-#include <utility>
+
+#include "utility/CompilerMath.hpp"
 
 namespace Ext {
 
-  template <std::size_t Base, std::size_t L, bool b=(L<=Base)>
-  struct IntLogN {
-    static constexpr std::size_t value = 1 + IntLogN<Base, L/Base + (L%Base > 0)>::value;
-  };
+  template <std::size_t Total>
+  struct BSet {
+    static constexpr std::size_t BITS = Total;
+    static constexpr std::size_t BASE = std::numeric_limits<unsigned char>::digits;
+    static constexpr std::size_t npos = std::numeric_limits<std::size_t>::max();
 
-  template <std::size_t Base, std::size_t L>
-  struct IntLogN<Base, L, true> {
-    static constexpr std::size_t value = 1;
-  };
+    BSet() : _count(0), _open(0) { for (std::size_t i=0; i<TBYTE; ++i) _charset[i]=CZERO; }
 
-  template <std::size_t V, std::size_t W>
-  struct Pow {
-    static constexpr std::size_t value = V*Pow<V, W-1>::value;
-  };
+    inline bool any() const { return _count < BITS; }
+    inline bool empty() const { return _count == 0; }
+    inline std::size_t size() const { return BITS; }
+    inline std::size_t get_open() { return (npos != _open) ? _open : find_first_unset(); }
 
-  template <std::size_t V>
-  struct Pow<V,1> {
-    static constexpr std::size_t value = V;
-  };
+    inline bool set(std::size_t bit) {
+      _charset[bit/BASE] |= (1 << (bit%BASE));
+      bool has_open = (++_count < BITS);
+      if ( bit == _open && has_open )
+        _open = (bit+1 < BITS) ? next_unset(bit) : find_first_unset(bit); // could still become npos
+      return has_open;
+    }
+
+    inline void set_all() {
+      for ( auto& c : _charset )
+        c = FULL;
+      _count = BITS;
+      _open = npos;
+    }
+
+    inline void unset(std::size_t bit) {
+      _charset[bit/BASE] &= ~(1 << (bit%BASE));
+      --_count;
+      if ( npos == _open )
+        _open = bit;
+    }
+
+    inline void unset_all() {
+      for ( auto& c : _charset )
+        c = CZERO;
+      _count = 0;
+      _open = 0;
+    }
+
+    inline std::size_t next_set(std::size_t start) const {
+      start += 1;
+      std::size_t bin = start/BASE;
+      if ( _charset[bin] ) {
+        for ( std::size_t i = start%BASE; i < BASE; ++i ) {
+          if (_charset[bin] & (1 << i))
+            return bin*BASE+i;
+          else if ( npos == _open )
+            _open = bin*BASE+i;
+        } // for
+      }
+
+      for ( std::size_t b = bin+1; b < TBYTE; ++b ) {
+        if ( _charset[b] ) {
+          for ( std::size_t i = 0; i < BASE; ++i ) {
+            if ( _charset[b] & (1 << i) )
+              return b*BASE+i;
+            else if ( npos == _open )
+              _open = bin*BASE+i;
+          } // for
+        }
+      } // for
+      return npos;
+    }
+
+    inline std::size_t find_first_set() {
+      if ( _charset[0] & (1 << 0) )
+        return 0;
+      else if ( npos == _open )
+        _open = 0;
+      return next_set(0);
+    }
+
+    inline std::size_t next_unset(std::size_t start) {
+      start += 1;
+      std::size_t bin = start/BASE;
+      for ( std::size_t i = start%BASE; i < BASE; ++i ) {
+        if ( !(_charset[bin] & (1 << i)) ) {
+          if ( npos == _open )
+            _open = bin*BASE+i;
+          return bin*BASE+i;
+        }
+      } // for
+
+      for ( std::size_t b = bin+1; b < TBYTE; ++b ) {
+        if ( _charset[b] != FULL ) {
+          for ( std::size_t i = 0; i < BASE; ++i ) {
+            if ( !(_charset[b] & (1 << i)) ) {
+              if ( npos == _open )
+                _open = b*BASE+i;
+              return b*BASE+i;
+            }
+          } // for
+        }
+      } // for
+      return npos;
+    }
+
+    inline std::size_t find_first_unset() {
+      if ( !(_charset[0] & (1 << 0) ) ) {
+        if ( npos == _open )
+          _open = 0;
+        return 0;
+      }
+      return next_unset(0);
+    }
 
-  template <std::size_t V>
-  struct Pow<V,0> {
-    static constexpr std::size_t value = 0;
+    template <std::size_t A>
+    friend
+    std::ostream&
+    operator<<(std::ostream& os, const BSet<A>& r);
+
+  private:
+    static constexpr std::size_t TBYTE = BITS/BASE;
+    static constexpr unsigned char CZERO = (unsigned char)0;
+    static constexpr unsigned char FULL = std::numeric_limits<unsigned char>::max();
+
+    std::size_t _count, _open;
+    std::array<unsigned char, TBYTE> _charset;
   };
 
+  template <std::size_t A>
+  std::ostream&
+  operator<<(std::ostream& os, const BSet<A>& r) {
+    std::copy(r._charset.begin(), r._charset.end(), std::ostream_iterator<std::bitset<8>>(os, " "));
+    os << std::endl;
+    return os;
+  }
+
   template <std::size_t Base,
             std::size_t Total, // undefined when Check==false
             bool Check=(Base==std::numeric_limits<unsigned char>::digits) &&
@@ -125,6 +230,12 @@ namespace Ext {
       return false;
     }
 
+    inline void set_all() {
+      for ( auto& c : _charset )
+        c = FULL;
+      _nxt = npos;
+    }
+
     inline void unset(std::size_t bit) {
       std::size_t bin = bit/BASE;
       bool pstatus = _charset[bin] != FULL;
@@ -150,6 +261,50 @@ namespace Ext {
       } // while
     }
 
+    inline void unset_all() {
+      for ( auto& c : _charset )
+        c = CZERO;
+      _nxt = 0;
+    }
+
+    inline std::size_t next_set(std::size_t start, std::size_t end = BITS, bool include_start = false) const {
+      std::size_t beg = (start + !include_start);
+      std::size_t bin = beg/BASE;
+      for ( std::size_t i = beg%BASE; i < BASE; ++i ) {
+        if (_charset[bin] & (1 << i))
+          return bin*BASE+i;
+      } // for
+
+      for ( std::size_t b = bin+1; b <= end/BASE; ++b ) {
+        if ( _charset[b] ) {
+          for ( std::size_t i = 0; i < BASE; ++i ) {
+            if ( _charset[b] & (1 << i) )
+              return b*BASE+i;
+          } // for
+        }
+      } // for
+      return npos;
+    }
+
+    inline std::size_t next_unset(std::size_t start, bool include_start = false) const {
+      std::size_t beg = (start + !include_start);
+      std::size_t bin = beg/BASE;
+      for ( std::size_t i = beg%BASE; i < BASE; ++i ) {
+        if ( !(_charset[bin] & (1 << i)) )
+          return bin*BASE+i;
+      } // for
+
+      for ( std::size_t b = bin+1; b <= BITS/BASE; ++b ) {
+        if ( _charset[b] != FULL ) {
+          for ( std::size_t i = 0; i < BASE; ++i ) {
+            if ( !(_charset[b] & (1 << i)) )
+              return b*BASE+i;
+          } // for
+        }
+      } // for
+      return npos;
+    }
+
   private:
     inline std::size_t find_open_child(std::size_t p) {
       while ( BITS <= p ) {
@@ -213,15 +368,15 @@ namespace Ext {
   /* forcing N to be a power of 8 as less than 8 with a bitset is not that great,
        though it can be done by modifying Iter requirements.
   */
-  template <std::size_t N,
+  template <std::size_t Base,
             std::size_t StopLevel,
-            std::size_t Iter=(N%std::numeric_limits<unsigned char>::digits==0) &&
-                             (StopLevel%N==0) &&
-                             (Pow<N, IntLogN<N, StopLevel>::value>::value==StopLevel)>
+            std::size_t Iter=(Base%std::numeric_limits<unsigned char>::digits==0) &&
+                             (StopLevel%Base==0) &&
+                             (Pow<Base, IntLogN<Base, StopLevel>::value>::value==StopLevel)>
   struct BitMonitor {
-    static constexpr std::size_t NVAL = N;
-    static constexpr std::size_t MYSZ = Pow<NVAL,Iter>::value;
-    static constexpr std::size_t PARENTSZ = Pow<NVAL,Iter-1>::value;
+    static constexpr std::size_t BASE = Base;
+    static constexpr std::size_t MYSZ = Pow<BASE,Iter>::value;
+    static constexpr std::size_t PARENTSZ = Pow<BASE,Iter-1>::value;
     static constexpr std::size_t TOTALSZ = MYSZ+PARENTSZ;
     static constexpr std::size_t LEVEL = Iter;
     static constexpr bool        STOP = false;
@@ -239,8 +394,8 @@ namespace Ext {
 
     std::size_t find_open(std::size_t pbin) {
       // don't call this - use get_open()
-      pbin *= NVAL;
-      for ( std::size_t idx = pbin; idx < pbin+NVAL; ++idx ) {
+      pbin *= BASE;
+      for ( std::size_t idx = pbin; idx < pbin+BASE; ++idx ) {
         if ( !_bset[idx] ) {
           _nxt = idx;
           return _nxt;
@@ -254,10 +409,10 @@ namespace Ext {
       std::size_t val = 0;
       if ( !_children.set(bit, val) ) {
         _bset[val] = true;
-        cnt = val/NVAL;
-        std::size_t pbin = cnt*NVAL;
+        cnt = val/BASE;
+        std::size_t pbin = cnt*BASE;
         _nxt = npos;
-        for ( std::size_t idx = pbin; idx < pbin+NVAL; ++idx ) {
+        for ( std::size_t idx = pbin; idx < pbin+BASE; ++idx ) {
           if ( !_bset[idx] ) {
             _nxt = idx;
             break;
@@ -272,7 +427,7 @@ namespace Ext {
       _children.unset(bit, cnt);
       _bset[cnt] = false;
       _nxt = cnt;
-      cnt /= NVAL;
+      cnt /= BASE;
     }
 
     inline std::size_t size() const { return _children.size(); }
@@ -284,14 +439,14 @@ namespace Ext {
 
     std::size_t _nxt;
     std::bitset<MYSZ> _bset; // all zeroes by default
-    BitMonitor<NVAL, StopLevel/NVAL, Iter+1> _children;
+    BitMonitor<BASE, StopLevel/BASE, Iter+1> _children;
   };
 
-  template <std::size_t N, std::size_t Iter>
-  struct BitMonitor<N,N,Iter> {
-    static constexpr std::size_t NVAL = N;
-    static constexpr std::size_t MYSZ = Pow<NVAL,Iter>::value;
-    static constexpr std::size_t PARENTSZ = Pow<NVAL,Iter-1>::value;
+  template <std::size_t Base, std::size_t Iter>
+  struct BitMonitor<Base,Base,Iter> {
+    static constexpr std::size_t BASE = Base;
+    static constexpr std::size_t MYSZ = Pow<BASE,Iter>::value;
+    static constexpr std::size_t PARENTSZ = Pow<BASE,Iter-1>::value;
     static constexpr std::size_t TOTALSZ = MYSZ+PARENTSZ;
     static constexpr std::size_t LEVEL = Iter;
     static constexpr bool        STOP = true;
@@ -306,8 +461,8 @@ namespace Ext {
     }
 
     std::size_t find_open(std::size_t pbin) {
-      pbin *= NVAL;
-      for ( std::size_t idx = pbin; idx < pbin+NVAL; ++idx ) {
+      pbin *= BASE;
+      for ( std::size_t idx = pbin; idx < pbin+BASE; ++idx ) {
         if ( !_bset[idx] ) {
           _nxt = idx;
           return _nxt;
@@ -322,10 +477,10 @@ namespace Ext {
       Zeros::NC_ZERO = Zeros::C_ZERO;
 
       // make pbin the group that the parent class is monitoring
-      cnt = bit/NVAL;
-      std::size_t pbin = cnt*NVAL;
+      cnt = bit/BASE;
+      std::size_t pbin = cnt*BASE;
       _nxt = npos;
-      for ( std::size_t idx = bit+1; idx < pbin+NVAL; ++idx ) {
+      for ( std::size_t idx = bit+1; idx < pbin+BASE; ++idx ) {
         if ( !_bset[idx] ) {
           _nxt = idx;
           return _nxt != npos;
@@ -343,7 +498,7 @@ namespace Ext {
     inline void unset(std::size_t bit, std::size_t& cnt) {
       _bset[bit] = false;
       Zeros::NC_ZERO = Zeros::C_ZERO;
-      cnt = bit/NVAL;
+      cnt = bit/BASE;
       if ( _nxt == npos ) { _nxt = bit; } 
     }
 
@@ -379,130 +534,6 @@ namespace Ext {
     return os;
   }
 
-
-  //==============
-  // PooledMemory
-  //==============
-  template <typename DataType, std::size_t chunksz = 512, bool CallDestruct = false>
-  struct PooledMemory; // atm, chunksz needs to be >=16 and divisible by 8
-
-  template <typename DataType, std::size_t chunksz, bool CallDestruct>
-  struct PooledMemory {
-    typedef DataType type;
-
-    PooledMemory() : _curr(new MemChunk()), _cache(nullptr)
-     {
-       _blocks.insert(_curr);
-       _blockstarts.insert(_curr->_data);
-       _r.insert(std::make_pair(_curr->_data, _curr));
-     }
-
-    template <typename... Args>
-    inline
-    type* construct(Args... parameters) {
-      if ( !_curr->any() ) {
-        if ( _cache )
-          _curr = _cache;
-        else
-          _curr = new MemChunk();
-
-        _cache = nullptr;
-        _blocks.insert(_curr);
-        _blockstarts.insert(_curr->_data);
-        _r.insert(std::make_pair(_curr->_data, _curr));
-      }
-      return _curr->add(parameters...);
-    }
-
-    inline
-    void release(type* b) {
-      if ( 1 == _blockstarts.size() ) {
-        _curr->remove(b);
-      } else { // possible Chunk removal
-        auto iter = _blockstarts.begin();
-        MemChunk* m;
-        if ( _blockstarts.size() < 10 ) {
-          auto miter = _r.begin();
-          while ( *iter > b ) { ++iter; ++miter; }
-          m = miter->second;
-        } else {
-          iter = _blockstarts.lower_bound(b);
-          m = _r[*iter];
-        }
-        m->remove(b);
-        if ( m->empty() ) {
-          _blocks.erase(m);
-          _blockstarts.erase(iter);
-          _r.erase(*iter);
-          if ( !_cache )
-            _cache = m;
-          else
-            delete m;
-        }
-      }
-    }
-
-    ~PooledMemory() {
-      for ( auto b : _blocks )
-        delete b;
-      if ( _cache )
-        delete _cache;
-    }
-
-  private:
-    template <std::size_t basesz, std::size_t nelements>
-    struct Chunk {
-      Chunk() : _any(true), _cntr(0), _data{} { }
-
-      inline bool any() const { return _any; } // any positions available?
-      inline bool empty() const { return _cntr == 0; } // nothing set
-
-      template <typename... Args>
-      inline type* add(Args... parameters) {
-        std::size_t trackpos = _tracker.get_open();
-        type* address = static_cast<type*>(_data+trackpos);
-        if ( CallDestruct && address ) { address->~type(); }
-        _any &= _tracker.set(trackpos);
-        ++_cntr;
-        return new(address) type(parameters...);
-      }
-
-      inline void remove(type* bt) {
-        // lazy deletion (see add())
-        _tracker.unset(bt-_data);
-        _any = true;
-        --_cntr;
-      }
-
-      ~Chunk() {
-        if ( CallDestruct ) {
-          for ( std::size_t i = 0; i < _tracker.size(); ++i ) {
-            type* address = static_cast<type*>(_data+i);
-            if ( address ) { address->~type(); }
-          } // for
-        }
-      }
-
-      bool _any;
-      std::size_t _cntr;
-      type _data[nelements];
-      //BitMonitor<basesz, nelements> _tracker; // nelements == nbits monitored
-      BitMonitor2<basesz, nelements> _tracker; // nelements == nbits monitored
-    };
-
-  private:
-    static constexpr std::size_t BaseSize = std::numeric_limits<unsigned char>::digits;
-    static constexpr std::size_t NBits = Pow<BaseSize, IntLogN<BaseSize, chunksz>::value>::value;
-    typedef Chunk<BaseSize, NBits> MemChunk;
-
-    MemChunk* _curr;
-    MemChunk* _cache;
-    // Important to remember that _blocks, _blockstarts, _r all have the same #elements
-    std::set<MemChunk*, std::greater<MemChunk*>> _blocks;
-    std::set<type*, std::greater<type*>> _blockstarts;
-    std::map<type*, MemChunk*, std::greater<type*>> _r;
-  };
-
 } // namespace Ext
 
-#endif // __UTILS_SIMPLE_SMALLOBJ_MEM__
+#endif // UTILS_BITMONITOR__
diff --git a/interfaces/general-headers/utility/CharPooledMemory.hpp b/interfaces/general-headers/utility/CharPooledMemory.hpp
new file mode 100644
index 0000000..267bb60
--- /dev/null
+++ b/interfaces/general-headers/utility/CharPooledMemory.hpp
@@ -0,0 +1,521 @@
+/*
+  Author: Shane Neph
+  Date:   Thu Nov 24 20:16:29 PST 2016
+*/
+//
+//    BEDOPS
+//    Copyright (C) 2011-2016 Shane Neph, Scott Kuehn and Alex Reynolds
+//
+//    This program is free software; you can redistribute it and/or modify
+//    it under the terms of the GNU General Public License as published by
+//    the Free Software Foundation; either version 2 of the License, or
+//    (at your option) any later version.
+//
+//    This program is distributed in the hope that it will be useful,
+//    but WITHOUT ANY WARRANTY; without even the implied warranty of
+//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//    GNU General Public License for more details.
+//
+//    You should have received a copy of the GNU General Public License along
+//    with this program; if not, write to the Free Software Foundation, Inc.,
+//    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+#ifndef UTILS_SIMPLE_CHARARRAY_MEM
+#define UTILS_SIMPLE_CHARARRAY_MEM
+
+#include <cstring>
+#include <exception>
+#include <functional>
+#include <limits>
+#include <list>
+#include <map>
+#include <memory>
+#include <set>
+#include <utility>
+
+
+#include "utility/BitMonitor.hpp"
+
+namespace Ext {
+
+  template <std::size_t Sz>
+  struct PooledCharMemory2 {
+
+    PooledCharMemory2() : _curr(new MemChunk()), _cache(nullptr)
+      {
+        _blocks.insert(_curr);
+        _blockstarts.insert(_curr->_data);
+        _r.insert(std::make_pair(_curr->_data, _curr));
+      }
+
+    inline std::size_t
+    nblocks() const { return _blocks.size(); }
+
+    inline char*
+    construct(char const* val)
+      {
+        auto p = _curr->add(val);
+        if ( p )
+          return p;
+
+        /* current memory block is full */
+        if ( _cache ) {
+          _cache->clear();
+          _curr = _cache;
+          _cache = nullptr;
+          _blocks.insert(_curr);
+          _blockstarts.insert(_curr->_data);
+          _r.insert(std::make_pair(_curr->_data, _curr));
+        } else {
+          for ( auto& i : _blocks ) {
+            /* ensure no current block can accept val
+               before adding another MemChunk
+            */
+            if ( i != _curr ) {
+              auto q = i->add(val);
+              if ( q ) {
+                _curr = i;
+                return q;
+              }
+            }
+          } // for
+          if ( std::strlen(val) > Sz )
+            throw std::logic_error("Cannot store a string that large in PooledCharMemory2<Sz>");
+          _curr = new MemChunk();
+          _blocks.insert(_curr);
+          _blockstarts.insert(_curr->_data);
+          _r.insert(std::make_pair(_curr->_data, _curr));
+        }
+        return _curr->add(val);
+      }
+
+    inline void
+    release(char* b)
+      {
+        if ( 1 == _blockstarts.size() )
+          _curr->remove(b);
+        else { // possible Chunk removal
+          auto iter = _blockstarts.begin();
+          MemChunk* m;
+          if ( _blockstarts.size() < 10 ) {
+            auto miter = _r.begin();
+            while ( *iter > b ) { ++iter; ++miter; }
+            m = miter->second;
+          } else {
+            iter = _blockstarts.lower_bound(b);
+            m = _r[*iter];
+          }
+          m->remove(b);
+          if ( m->empty() ) {
+            _blocks.erase(m);
+            _blockstarts.erase(iter);
+            _r.erase(*iter);
+            if ( !_cache )
+              _cache = m;
+            else
+              delete m;
+            if ( m == _curr )
+              _curr = *(_blocks.begin()); // important if we drop back to 1 block
+          }
+        }
+      }
+
+    ~PooledCharMemory2()
+      {
+        for ( auto b : _blocks )
+          delete b;
+        if ( _cache )
+          delete _cache;
+      }
+
+  private:
+    template <std::size_t nelements>
+    struct CharChunk {
+      static constexpr std::size_t npos = std::numeric_limits<std::size_t>::max();
+
+      CharChunk() : _cc(0), _cntr(0), _data{} /*, _tracker(nelements), _dirty(nelements)*/
+        {
+          _data[nelements] = '\0';
+          /* leave _open empty until we've exhausted first pass of nelements */
+        }
+
+      inline bool
+      empty() const
+        {
+          return _cntr == 0;
+        }
+
+      inline char*
+      add(char const* c)
+        {
+          /* not protecting against c == nullptr in private, nested class */
+          if ( _cc == nelements ) {
+            auto a = find_open(c);
+            if ( a )
+              ++_cntr;
+            return a;
+          }
+
+          std::size_t i = 0, start = _cc;
+          bool ok = false;
+          while ( start < nelements ) {
+            _data[start++] = c[i];
+            if ( c[i++] == '\0' ) {
+              ok = true;
+              break;
+            }
+          } // while
+
+          if ( start == nelements && c[i] == '\0' ) {
+            _data[start] = '\0'; // _data has nelements+1
+            ok = true;
+          }
+
+          if ( ok ) {
+            std::swap(start, _cc);
+            ++_cntr;
+            _tracker.set(start);
+            return _data+start;
+          }
+          auto a = find_open(c);
+          if ( a )
+            ++_cntr;
+          return a;
+         }
+
+      inline void
+      remove(char const* c)
+        {
+          _dirty.set(c - _data);
+          _tracker.unset(c - _data);
+          --_cntr;
+        }
+
+      inline void
+      clear()
+        {
+          _cntr = 0;
+          _cc = 0;
+          _data[nelements] = '\0';
+          _tracker.unset_all();
+          _dirty.unset_all();
+          _open.clear();
+        }
+
+    private:
+      char*
+      find_open(char const* c)
+        {
+          std::size_t need = std::strlen(c);
+
+          auto nxt = _open.lower_bound(need);
+          if ( nxt != _open.end() ) {
+            std::strcpy(_data+nxt->second, c);
+            std::size_t newlength = (nxt->first-need);
+            if ( newlength > 1 ) { // if == 1, can only hold '\0'
+              _open.insert(std::make_pair(newlength-1, nxt->second+need+1));
+              _dirty.set(nxt->second+need+1);
+            }
+            _dirty.unset(nxt->second);
+            _tracker.set(nxt->second);
+            _open.erase(nxt);
+            return _data+nxt->second;
+          }
+
+          std::size_t f = _dirty.find_first_set(), f2 = 0, g;
+          while ( f != _dirty.npos ) {
+            g = _tracker.next_set(f);
+            if ( g == _tracker.npos )
+              g = nelements;
+
+            f2 = f;
+            while ( (f2 = _dirty.next_set(f2)) < g ) {
+              if ( f2 == _dirty.npos )
+                break;
+              _dirty.unset(f2);
+            } // while
+
+            if ( g-f > need ) {
+              std::strcpy(_data+f, c);
+              _dirty.unset(f);
+              _dirty.set(f+need);
+              _tracker.set(f);
+              return _data+f;
+            }
+
+            if ( _open.size()<MAXLOOKUP && (g-f)>1 )
+              _open.insert(std::make_pair(g-f-1, f));
+            else if ( _open.size() == MAXLOOKUP && (g-f)>(_open.begin()->first) ) {
+              _open.insert(std::make_pair(g-f-1, f));
+              _open.erase(_open.begin());
+            }
+
+            f = f2;
+          } // while
+          return nullptr;
+        }
+
+      friend struct PooledCharMemory2<nelements>;
+
+      static constexpr std::size_t MAXLOOKUP = 100;
+
+      std::size_t _cc;
+      std::size_t _cntr;
+      char _data[nelements+1];
+      BSet<nelements> _tracker, _dirty;
+      std::multimap<std::size_t, std::size_t> _open; // size, position
+    };
+
+    typedef CharChunk<Sz> MemChunk;
+
+    MemChunk* _curr;
+    MemChunk* _cache;
+    // Important to remember that _blocks, _blockstarts, _r all have the same #elements
+    std::set<MemChunk*, std::greater<MemChunk*>> _blocks;
+    std::set<char*, std::greater<char*>> _blockstarts;
+    std::map<char*, MemChunk*, std::greater<char*>> _r;
+  };
+
+  /*********************************************************
+  *********************************************************/
+  template <std::size_t Sz>
+  struct PooledCharMemory {
+
+    PooledCharMemory() : _curr(new MemChunk()), _cache(nullptr)
+      {
+        _blocks.insert(_curr);
+        _blockstarts.insert(_curr->_data);
+        _r.insert(std::make_pair(_curr->_data, _curr));
+      }
+
+    inline std::size_t
+    nblocks() const { return _blocks.size(); }
+
+    inline char*
+    construct(char const* val)
+      {
+        auto p = _curr->add(val);
+        if ( p )
+          return p;
+
+        /* current memory block is full */
+        if ( _cache ) {
+          _cache->clear();
+          _curr = _cache;
+          _cache = nullptr;
+          _blocks.insert(_curr);
+          _blockstarts.insert(_curr->_data);
+          _r.insert(std::make_pair(_curr->_data, _curr));
+        } else {
+          for ( auto& i : _blocks ) {
+            /* ensure no current block can accept val
+               before adding another MemChunk
+            */
+            if ( i != _curr ) {
+              auto q = i->add(val);
+              if ( q ) {
+                _curr = i;
+                return q;
+              }
+            }
+          } // for
+          if ( std::strlen(val) > Sz )
+            throw std::logic_error("Cannot store a string that large in PooledCharMemory<Sz>");
+          _curr = new MemChunk();
+          _blocks.insert(_curr);
+          _blockstarts.insert(_curr->_data);
+          _r.insert(std::make_pair(_curr->_data, _curr));
+        }
+        auto r = _curr->add(val);
+        return r;
+      }
+
+    inline void
+    release(char* b)
+      {
+        if ( 1 == _blockstarts.size() )
+          _curr->remove(b);
+        else { // possible Chunk removal
+          auto iter = _blockstarts.begin();
+          MemChunk* m;
+          if ( _blockstarts.size() < 10 ) {
+            auto miter = _r.begin();
+            while ( *iter > b ) { ++iter; ++miter; }
+            m = miter->second;
+          } else {
+            iter = _blockstarts.lower_bound(b);
+            m = _r[*iter];
+          }
+          m->remove(b);
+          if ( m->empty() ) {
+            _blocks.erase(m);
+            _blockstarts.erase(iter);
+            _r.erase(*iter);
+            if ( !_cache )
+              _cache = m;
+            else
+              delete m;
+            if ( m == _curr )
+              _curr = *(_blocks.begin()); // important if we drop back to 1 block
+          }
+        }
+      }
+
+    ~PooledCharMemory()
+      {
+        for ( auto b : _blocks )
+          delete b;
+        if ( _cache )
+          delete _cache;
+      }
+
+  private:
+    template <std::size_t nelements>
+    struct CharChunk {
+      static constexpr std::size_t npos = std::numeric_limits<std::size_t>::max();
+
+      CharChunk() : _cc(0), _cntr(0), _data{}
+        {
+          _data[nelements] = '\0';
+          /* leave _open empty until we've exhausted first pass of nelements */
+        }
+
+      inline bool
+      empty() const
+        {
+          return _cntr == 0;
+        }
+
+      inline char*
+      add(char const* c)
+        {
+          /* not protecting against c == nullptr in private, nested class */
+          if ( _cc == nelements ) {
+            auto a = find_open(c);
+            if ( a ) {
+              ++_cntr;
+              _tracker.set(a - _data);
+            }
+            return a;
+          }
+
+          std::size_t i = 0, start = _cc;
+          bool ok = false;
+          while ( start < nelements ) {
+            _data[start++] = c[i];
+            if ( c[i++] == '\0' ) {
+              ok = true;
+              break;
+            }
+          } // while
+
+          if ( start == nelements && c[i] == '\0' ) {
+            _data[start] = '\0'; // _data has nelements+1
+            ok = true;
+          }
+
+          if ( ok ) {
+            std::swap(start, _cc);
+            ++_cntr;
+            _tracker.set(start);
+            return _data+start;
+          }
+
+          auto a = find_open(c);
+          if ( a ) {
+            ++_cntr;
+            _tracker.set(a - _data);
+          }
+          return a;
+        }
+
+      inline void
+      remove(char const* c)
+        {
+          _dirty.push_back(c - _data);
+          _tracker.unset(c - _data);
+          --_cntr;
+        }
+
+      inline void
+      clear()
+        {
+          _cntr = 0;
+          _cc = 0;
+          _open.clear(); // leave empty until we've exhausted first pass of nelements
+          _dirty.clear();
+          _tracker.unset_all();
+          _data[nelements] = '\0';
+        }
+
+    private:
+      inline char*
+      find_open(char const* c)
+        {
+          std::size_t sz = std::strlen(c);
+          auto nxt = _open.lower_bound(sz);
+          if ( nxt != _open.end() ) {
+            std::strcpy(_data+nxt->second, c);
+            std::size_t newlength = (nxt->first-sz);
+            if ( newlength > 1 ) // if == 1, can only hold '\0'
+              _open.insert(std::make_pair(newlength-1, nxt->second+sz+1));
+            _tracker.set(nxt->second);
+            _open.erase(nxt);
+            return _data+nxt->second;
+          }
+          return clean(c, sz);
+        }
+
+      char*
+      clean(char const* c, std::size_t need)
+        {
+          // potentially very slow; try to find first location that fits c
+          for ( auto iter = _dirty.begin(); iter != _dirty.end(); iter = _dirty.erase(iter) ) {
+            std::size_t pos = *iter;
+            std::size_t lng = _tracker.next_set(pos, nelements);
+            if ( lng != _tracker.npos )
+              lng -= (pos+1); // +1 for '\0'; lng is at least 1 bigger than pos
+            else
+              lng = nelements + 1 - pos; // +1 b/c _data has nelements+1 elements with last == '\0'
+
+            if ( lng >= need ) {
+              std::strcpy(_data+pos, c);
+              _tracker.set(pos);
+              if ( lng-need > 1 ) // if == 1, can only hold '\0'
+                _open.insert(std::make_pair(lng-need-1, pos+need+1));
+              _dirty.erase(iter);
+              return _data+pos;
+            }
+            else
+              _open.insert(std::make_pair(lng, pos));
+          } // for
+          _dirty.clear();
+          return nullptr;
+        }
+
+      friend struct PooledCharMemory<nelements>;
+
+      static constexpr std::size_t BaseSize = std::numeric_limits<unsigned char>::digits;
+      static constexpr std::size_t NBits = Pow<BaseSize, IntLogN<BaseSize, nelements>::value>::value;
+
+      std::size_t _cc;
+      std::size_t _cntr;
+      char _data[nelements+1];
+      BitMonitor2<BaseSize, NBits> _tracker;
+      std::multimap<std::size_t, std::size_t> _open; // size, position
+      std::list<std::size_t> _dirty; // position
+    };
+
+    typedef CharChunk<Sz> MemChunk;
+
+    MemChunk* _curr;
+    MemChunk* _cache;
+    // Important to remember that _blocks, _blockstarts, _r all have the same #elements
+    std::set<MemChunk*, std::greater<MemChunk*>> _blocks;
+    std::set<char*, std::greater<char*>> _blockstarts;
+    std::map<char*, MemChunk*, std::greater<char*>> _r;
+  };
+
+} // namespace Ext
+
+#endif // UTILS_SIMPLE_CHARARRAY_MEM
diff --git a/interfaces/general-headers/utility/SingletonType.hpp b/interfaces/general-headers/utility/CompilerMath.hpp
old mode 100755
new mode 100644
similarity index 53%
copy from interfaces/general-headers/utility/SingletonType.hpp
copy to interfaces/general-headers/utility/CompilerMath.hpp
index a97c5a3..c8609a8
--- a/interfaces/general-headers/utility/SingletonType.hpp
+++ b/interfaces/general-headers/utility/CompilerMath.hpp
@@ -1,6 +1,6 @@
 /*
-  Author: Shane Neph & Scott Kuehn
-  Date:   Fri Aug 10 15:04:51 PDT 2007
+  Author: Shane Neph
+  Date:   Mon Jun  5 13:34:58 PDT 2017
 */
 //
 //    BEDOPS
@@ -21,17 +21,36 @@
 //    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 //
 
-#ifndef SINGLETONTYPE_H
-#define SINGLETONTYPE_H
+#ifndef UTILS_COMPILERMATH
+#define UTILS_COMPILERMATH
+
+#include <cstddef>
 
 namespace Ext {
-  template <typename T>
-  struct SingletonType {
-    static T* Instance() {
-      static T t;
-      return(&t);
-    }
+  template <std::size_t Base, std::size_t L, bool b=(L<=Base)>
+  struct IntLogN {
+    static constexpr std::size_t value = 1 + IntLogN<Base, L/Base + (L%Base > 0)>::value;
+  };
+
+  template <std::size_t Base, std::size_t L>
+  struct IntLogN<Base, L, true> {
+    static constexpr std::size_t value = 1;
+  };
+
+  template <std::size_t V, std::size_t W>
+  struct Pow {
+    static constexpr std::size_t value = V*Pow<V, W-1>::value;
+  };
+
+  template <std::size_t V>
+  struct Pow<V,1> {
+    static constexpr std::size_t value = V;
+  };
+
+  template <std::size_t V>
+  struct Pow<V,0> {
+    static constexpr std::size_t value = 0;
   };
 } // namespace Ext
 
-#endif // SINGLETONTYPE_H
+#endif // UTILS_COMPILERMATH
diff --git a/interfaces/general-headers/utility/PooledMemory.hpp b/interfaces/general-headers/utility/PooledMemory.hpp
index d094b55..4c6a03a 100644
--- a/interfaces/general-headers/utility/PooledMemory.hpp
+++ b/interfaces/general-headers/utility/PooledMemory.hpp
@@ -21,370 +21,24 @@
 //    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 //
 
+#ifndef UTILS_SIMPLE_SMALLOBJ_MEM
+#define UTILS_SIMPLE_SMALLOBJ_MEM
 
-#ifndef __UTILS_SIMPLE_SMALLOBJ_MEM__
-#define __UTILS_SIMPLE_SMALLOBJ_MEM__
-
-#include <algorithm>
-#include <array>
-#include <bitset>
+#include <functional>
 #include <limits>
 #include <map>
-#include <ostream>
 #include <set>
-#include <type_traits>
 #include <utility>
 
-namespace Ext {
-
-  template <std::size_t Base, std::size_t L, bool b=(L<=Base)>
-  struct IntLogN {
-    static constexpr std::size_t value = 1 + IntLogN<Base, L/Base + (L%Base > 0)>::value;
-  };
-
-  template <std::size_t Base, std::size_t L>
-  struct IntLogN<Base, L, true> {
-    static constexpr std::size_t value = 1;
-  };
-
-  template <std::size_t V, std::size_t W>
-  struct Pow {
-    static constexpr std::size_t value = V*Pow<V, W-1>::value;
-  };
-
-  template <std::size_t V>
-  struct Pow<V,1> {
-    static constexpr std::size_t value = V;
-  };
-
-  template <std::size_t V>
-  struct Pow<V,0> {
-    static constexpr std::size_t value = 0;
-  };
-
-  template <std::size_t Base,
-            std::size_t Total, // undefined when Check==false
-            bool Check=(Base==std::numeric_limits<unsigned char>::digits) &&
-                       (Total%Base==0) &&
-                       (Pow<Base, IntLogN<Base, Total>::value>::value==Total)>
-  struct BitMonitor2;
-
-  template <std::size_t Base,
-            std::size_t Total>
-  struct BitMonitor2<Base, Total, true> {
-    static constexpr std::size_t BASE = std::numeric_limits<unsigned char>::digits;
-    static constexpr std::size_t TOTAL = Total + BitMonitor2<Base, Total/Base>::TOTAL;
-    static constexpr std::size_t BITS = Total;
-    static constexpr std::size_t npos = std::numeric_limits<std::size_t>::max();
-
-    BitMonitor2() : _nxt(0) { for( std::size_t i=0; i<TBYTE; ++i) _charset[i]=CZERO; }
-    inline bool any() const { return _charset[LAST_BYTE] != FULL; }
-    inline std::size_t get_open() const { return _nxt; }
-    inline std::size_t size() const { return BITS; }
-
-    inline bool set(std::size_t bit) {
-      std::size_t bin = bit/BASE;
-      _charset[bin] |= (1 << (bit%BASE));
-      if ( _charset[bin] != FULL ) {
-        if ( bit == _nxt ) {
-          for ( std::size_t i = 0; i < BASE; ++i ) {
-            if ( !(_charset[bin] & (1 << i)) ) {
-              _nxt = BASE*bin+i;
-              break;
-            }
-          } // for
-        }
-        return true;
-      }
-
-      std::size_t idx = BITS;
-      std::size_t val = bin; // val == bit/BASE
-      bin = BITS;
-      std::size_t parent = (bin + val);
-      std::size_t pbyte = parent/BASE;
-      while ( parent < TOTAL ) {
-        _charset[pbyte] |= (1 << (val%BASE));
-        if ( _charset[pbyte] != FULL ) {
-          if ( _nxt != bit )
-            return true;
-          _nxt = npos;
-          for ( std::size_t i = 0; i < BASE; ++i ) {
-            if ( !(_charset[pbyte] & (1 << i)) ) {
-              _nxt = find_open_child(pbyte*BASE+i);
-              break;
-            }
-          } // for
-          return true;
-        }
-        idx /= BASE;
-        bin += idx;
-        val /= BASE;
-        parent = bin + val;
-        pbyte = parent/BASE;
-      } // while
-      return false;
-    }
-
-    inline void unset(std::size_t bit) {
-      std::size_t bin = bit/BASE;
-      bool pstatus = _charset[bin] != FULL;
-      _charset[bin] &= ~(1 << (bit%BASE));
-      _nxt = bit;
-      if ( pstatus ) // parent wasn't FULL even before unsetting bit
-        return;
-
-      // unset parent from FULL
-      std::size_t parent_bit = BITS + bin; // bin=bit/BASE
-      _charset[parent_bit/BASE] &= ~(1 << (parent_bit%BASE));
-
-      std::size_t val = BITS/BASE;
-      std::size_t idx = BITS + val;
-      bin /= BASE;
-      while ( !pstatus && (parent_bit = idx + bin) < TOTAL ) {
-        if ( _charset[parent_bit/BASE] != FULL )
-          pstatus = true;
-        _charset[parent_bit/BASE] &= ~(1 << (parent_bit%BASE));
-        val /= BASE;
-        idx += val;
-        bin /= BASE;
-      } // while
-    }
-
-  private:
-    inline std::size_t find_open_child(std::size_t p) {
-      while ( BITS <= p ) {
-        std::size_t isum = BITS;
-        std::size_t inow = BITS;
-        std::size_t itrail = 0, ptrail = 0;
-        while ( isum < p ) {
-          inow /= BASE;
-          ptrail = itrail;
-          itrail = isum;
-          isum += inow;
-        } // while
-        if ( isum > p ) { isum = itrail; itrail = ptrail; }
-        p -= isum;
-        p *= BASE;
-        p += itrail;
-        std::size_t pbyte = p/BASE;
-        for ( std::size_t i = 0; i < BASE; ++i ) {
-          if ( !(_charset[pbyte] & (1 << i)) ) {
-            p += i;
-            break;
-          }
-        } // for
-      } // while
-      return p;
-    }
-
-    template <std::size_t A, std::size_t B, bool C>
-    friend
-    typename std::enable_if<C, std::ostream&>::type
-    operator<<(std::ostream& os, const BitMonitor2<A,B,C>& r);
-
-  private:
-    static constexpr unsigned char FULL = std::numeric_limits<unsigned char>::max();
-    static constexpr unsigned char CZERO = (unsigned char)0;
-    static constexpr std::size_t TBYTE = TOTAL/BASE;
-    static constexpr std::size_t LAST_BYTE = TBYTE-1;
-    std::size_t _nxt;
-    std::array<unsigned char, TBYTE> _charset;
-  };
-
-  template <std::size_t Base>
-  struct BitMonitor2<Base, Base, true> {
-    static constexpr std::size_t BASE = Base;
-    static constexpr std::size_t TOTAL = Base;
-  };
-
-  template <std::size_t A, std::size_t B, bool C>
-  typename std::enable_if<C, std::ostream&>::type
-  operator<<(std::ostream& os, const BitMonitor2<A,B,C>& r) {
-    std::copy(r._charset.begin(), r._charset.end(), std::ostream_iterator<std::bitset<8>>(os, " "));
-    os << std::endl;
-    return os;
-  }
-
-  namespace Zeros {
-    std::size_t NC_ZERO = 0;
-    static constexpr std::size_t C_ZERO = 0;
-  } // namespace Zeros
-
-  /* forcing N to be a power of 8 as less than 8 with a bitset is not that great,
-       though it can be done by modifying Iter requirements.
-  */
-  template <std::size_t N,
-            std::size_t StopLevel,
-            std::size_t Iter=(N%std::numeric_limits<unsigned char>::digits==0) &&
-                             (StopLevel%N==0) &&
-                             (Pow<N, IntLogN<N, StopLevel>::value>::value==StopLevel)>
-  struct BitMonitor {
-    static constexpr std::size_t NVAL = N;
-    static constexpr std::size_t MYSZ = Pow<NVAL,Iter>::value;
-    static constexpr std::size_t PARENTSZ = Pow<NVAL,Iter-1>::value;
-    static constexpr std::size_t TOTALSZ = MYSZ+PARENTSZ;
-    static constexpr std::size_t LEVEL = Iter;
-    static constexpr bool        STOP = false;
-    static constexpr std::size_t npos = std::numeric_limits<std::size_t>::max();
-
-    BitMonitor() : _nxt(0) {}
-
-    inline bool any() const { return _nxt != npos; }
-    inline std::size_t get_open() {
-      // assume any() is true, but perhaps not _children.any()
-      if ( !_children.any() )
-        _children.find_open(_nxt); // ignore rtn value
-      return _children.get_open();
-    }
-
-    std::size_t find_open(std::size_t pbin) {
-      // don't call this - use get_open()
-      pbin *= NVAL;
-      for ( std::size_t idx = pbin; idx < pbin+NVAL; ++idx ) {
-        if ( !_bset[idx] ) {
-          _nxt = idx;
-          return _nxt;
-        }
-      } // for
-      return npos; // something bad just happened
-    }
-
-    // calling program can simply check return value here instead of any()
-    inline bool set(std::size_t bit, std::size_t& cnt=Zeros::NC_ZERO) {
-      std::size_t val = 0;
-      if ( !_children.set(bit, val) ) {
-        _bset[val] = true;
-        cnt = val/NVAL;
-        std::size_t pbin = cnt*NVAL;
-        _nxt = npos;
-        for ( std::size_t idx = pbin; idx < pbin+NVAL; ++idx ) {
-          if ( !_bset[idx] ) {
-            _nxt = idx;
-            break;
-          }
-        } // for
-        return _nxt != npos;
-      }
-      return true;
-    }
-
-    inline void unset(std::size_t bit, std::size_t& cnt=Zeros::NC_ZERO) {
-      _children.unset(bit, cnt);
-      _bset[cnt] = false;
-      _nxt = cnt;
-      cnt /= NVAL;
-    }
-
-    inline std::size_t size() const { return _children.size(); }
-
-    template <std::size_t A, std::size_t B, std::size_t C>
-    friend
-    typename std::enable_if<!BitMonitor<A,B,C>::STOP, std::ostream&>::type
-    operator<<(std::ostream& os, const BitMonitor<A,B,C>& r);
-
-    std::size_t _nxt;
-    std::bitset<MYSZ> _bset; // all zeroes by default
-    BitMonitor<NVAL, StopLevel/NVAL, Iter+1> _children;
-  };
-
-  template <std::size_t N, std::size_t Iter>
-  struct BitMonitor<N,N,Iter> {
-    static constexpr std::size_t NVAL = N;
-    static constexpr std::size_t MYSZ = Pow<NVAL,Iter>::value;
-    static constexpr std::size_t PARENTSZ = Pow<NVAL,Iter-1>::value;
-    static constexpr std::size_t TOTALSZ = MYSZ+PARENTSZ;
-    static constexpr std::size_t LEVEL = Iter;
-    static constexpr bool        STOP = true;
-    static constexpr std::size_t npos = std::numeric_limits<std::size_t>::max();
-
-    BitMonitor() : _nxt(0) {}
-
-    inline bool any() const { return _nxt != npos; }
-
-    inline std::size_t get_open() {
-      return _nxt;
-    }
-
-    std::size_t find_open(std::size_t pbin) {
-      pbin *= NVAL;
-      for ( std::size_t idx = pbin; idx < pbin+NVAL; ++idx ) {
-        if ( !_bset[idx] ) {
-          _nxt = idx;
-          return _nxt;
-        }
-      } // for
-      return npos; // something bad just happened
-    }
-
-    // calling program can simply check return value here instead of any()
-    inline bool set(std::size_t bit, std::size_t& cnt) {
-      _bset[bit] = true;
-      Zeros::NC_ZERO = Zeros::C_ZERO;
-
-      // make pbin the group that the parent class is monitoring
-      cnt = bit/NVAL;
-      std::size_t pbin = cnt*NVAL;
-      _nxt = npos;
-      for ( std::size_t idx = bit+1; idx < pbin+NVAL; ++idx ) {
-        if ( !_bset[idx] ) {
-          _nxt = idx;
-          return _nxt != npos;
-        }
-      } // for
-      for ( std::size_t idx = pbin; idx < bit; ++idx ) {
-        if ( !_bset[idx] ) {
-          _nxt = idx;
-          return _nxt != npos;
-        }
-      }
-      return _nxt != npos;
-    }
-
-    inline void unset(std::size_t bit, std::size_t& cnt) {
-      _bset[bit] = false;
-      Zeros::NC_ZERO = Zeros::C_ZERO;
-      cnt = bit/NVAL;
-      if ( _nxt == npos ) { _nxt = bit; } 
-    }
-
-    inline std::size_t size() const { return _bset.size(); }
-
-    template <std::size_t A, std::size_t B, std::size_t C>
-    friend
-    typename std::enable_if<BitMonitor<A,B,C>::STOP, std::ostream&>::type
-    operator<<(std::ostream& os, const BitMonitor<A,B,C>& r);
-
-    std::size_t _nxt;
-    std::bitset<MYSZ> _bset; // initialized all-zeroes
-  };
-
-  template <std::size_t N, std::size_t M>
-  struct BitMonitor<N,M,0>; // undefined
-  template <std::size_t N>
-  struct BitMonitor<N,N,0>; // undefined
-
-
-  template <std::size_t A, std::size_t B, std::size_t C>
-  typename std::enable_if<!BitMonitor<A,B,C>::STOP, std::ostream&>::type
-  operator<<(std::ostream& os, const BitMonitor<A,B,C>& r) {
-    os << r._bset << std::endl;
-    os << r._children;
-    return os;
-  }
-
-  template <std::size_t A, std::size_t B, std::size_t C>
-  typename std::enable_if<BitMonitor<A,B,C>::STOP, std::ostream&>::type
-  operator<<(std::ostream& os, const BitMonitor<A,B,C>& r) {
-    os << r._bset;
-    return os;
-  }
+#include "utility/BitMonitor.hpp"
 
+namespace Ext {
 
   //==============
   // PooledMemory
   //==============
   template <typename DataType, std::size_t chunksz = 512, bool CallDestruct = false>
-  struct PooledMemory; // atm, chunksz needs to be >=16 and divisible by 8
+  struct PooledMemory; // atm, chunksz needs to be a power of 8 and at least 64
 
   template <typename DataType, std::size_t chunksz, bool CallDestruct>
   struct PooledMemory {
@@ -438,6 +92,8 @@ namespace Ext {
             _cache = m;
           else
             delete m;
+          if ( m == _curr )
+            _curr = *(_blocks.begin()); // important if we drop back to 1 block
         }
       }
     }
@@ -474,6 +130,8 @@ namespace Ext {
         --_cntr;
       }
 
+      /* temporary disable -> double destruction is happening at times
+           for now, use with types that have trivial destructors
       ~Chunk() {
         if ( CallDestruct ) {
           for ( std::size_t i = 0; i < _tracker.size(); ++i ) {
@@ -482,6 +140,7 @@ namespace Ext {
           } // for
         }
       }
+      */
 
       bool _any;
       std::size_t _cntr;
@@ -505,4 +164,4 @@ namespace Ext {
 
 } // namespace Ext
 
-#endif // __UTILS_SIMPLE_SMALLOBJ_MEM__
+#endif // UTILS_SIMPLE_SMALLOBJ_MEM
diff --git a/interfaces/general-headers/utility/PrintTypes.hpp b/interfaces/general-headers/utility/PrintTypes.hpp
index fee58b7..e40ffe5 100644
--- a/interfaces/general-headers/utility/PrintTypes.hpp
+++ b/interfaces/general-headers/utility/PrintTypes.hpp
@@ -37,13 +37,13 @@ namespace PrintTypes {
     struct check {
       static const bool value = 
               std::is_arithmetic<T>::value ||
-              std::is_same<typename std::remove_cv<T>::type, char*>::value ||
-              std::is_same<typename std::remove_cv<T>::type, char const*>::value;
+              std::is_same<char const*, typename std::decay<T>::type>::value ||
+              std::is_same<char*, typename std::decay<T>::type>::value;
     };
   }
 
   template <typename T>
-  extern typename std::enable_if<Details::check<T>::value>::type
+  typename std::enable_if<Details::check<T>::value>::type
   Print(T t) {
     static std::string f = Formats::Format(t);
     static char const* format = f.c_str();
@@ -51,7 +51,7 @@ namespace PrintTypes {
   }
 
   template <typename T>
-  extern typename std::enable_if<Details::check<T>::value>::type
+  typename std::enable_if<Details::check<T>::value>::type
   Println(T t) {
     static std::string end = Formats::Format(t) + std::string("\n");
     static char const* format = end.c_str();
@@ -59,7 +59,7 @@ namespace PrintTypes {
   }
 
   template <typename T>
-  extern typename std::enable_if<std::is_arithmetic<T>::value>::type
+  typename std::enable_if<std::is_arithmetic<T>::value>::type
   Print(T t, int precision, bool scientific) {
     std::string f = Formats::Format(t, precision, scientific);
     char const* format = f.c_str();
@@ -67,7 +67,7 @@ namespace PrintTypes {
   }
 
   template <typename T>
-  extern typename std::enable_if<std::is_arithmetic<T>::value>::type
+  typename std::enable_if<std::is_arithmetic<T>::value>::type
   Println(T t, int precision, bool scientific) {
     std::string end = Formats::Format(t, precision, scientific) + std::string("\n");
     char const* format = end.c_str();
@@ -75,7 +75,7 @@ namespace PrintTypes {
   }
 
   template <typename T>
-  extern typename std::enable_if<Details::check<T>::value>::type
+  typename std::enable_if<Details::check<T>::value>::type
   Print(FILE* out, T t) {
     static std::string f = Formats::Format(t);
     static char const* format = f.c_str();
@@ -83,7 +83,7 @@ namespace PrintTypes {
   }
 
   template <typename T>
-  extern typename std::enable_if<Details::check<T>::value>::type
+  typename std::enable_if<Details::check<T>::value>::type
   Println(FILE* out, T t) {
     static std::string end = Formats::Format(t) + std::string("\n");
     static char const* format = end.c_str();
@@ -92,22 +92,22 @@ namespace PrintTypes {
 
 
   template <typename T>
-  extern typename std::enable_if<!Details::check<T>::value>::type
+  typename std::enable_if<!Details::check<T>::value>::type
   Print(const T& t)
     { t.print(); }
 
   template <typename T>
-  extern typename std::enable_if<!Details::check<T>::value>::type
+  typename std::enable_if<!Details::check<T>::value>::type
   Println(const T& t)
     { t.println(); }
 
   template <typename T>
-  extern typename std::enable_if<!Details::check<T>::value>::type
+  typename std::enable_if<!Details::check<T>::value>::type
   Print(FILE* out, const T& t)
     { t.print(out); }
 
   template <typename T>
-  extern typename std::enable_if<!Details::check<T>::value>::type
+  typename std::enable_if<!Details::check<T>::value>::type
   Println(FILE* out, const T& t)
     { t.println(out); }
 
diff --git a/interfaces/general-headers/utility/SingletonType.hpp b/interfaces/general-headers/utility/SingletonType.hpp
index a97c5a3..0b2d0ad 100755
--- a/interfaces/general-headers/utility/SingletonType.hpp
+++ b/interfaces/general-headers/utility/SingletonType.hpp
@@ -27,11 +27,23 @@
 namespace Ext {
   template <typename T>
   struct SingletonType {
-    static T* Instance() {
-      static T t;
-      return(&t);
+    static T& Instance() {
+      if ( !_instance )
+        _instance = new T();
+      return *_instance;
     }
+
+  private:
+    SingletonType();
+    ~SingletonType() {}
+    SingletonType(const SingletonType&); // undefined
+    SingletonType& operator=(const SingletonType&); // undefined
+
+    void Cleanup();
+    static T* _instance;
   };
 } // namespace Ext
 
+#include "../../src/utility/SingletonType.cpp"
+
 #endif // SINGLETONTYPE_H
diff --git a/interfaces/general-headers/utility/Typify.hpp b/interfaces/general-headers/utility/Typify.hpp
index 435b6f8..a26d5eb 100755
--- a/interfaces/general-headers/utility/Typify.hpp
+++ b/interfaces/general-headers/utility/Typify.hpp
@@ -45,15 +45,23 @@ namespace Ext {
     typedef T OriginalType;
   };
 
+  //============
+  // has_type<T> : is there a T::type typedef?
+  // stolen and modified from
+  // http://stackoverflow.com/questions/25626293/has-type-template-returns-true-for-struct-type
+  //============
+  template <typename T>
+  struct has_type {
+
+    template <typename C>
+    static constexpr
+    char test_for_type(...) { return '0'; }
+
+    template <typename C>
+    static constexpr
+    double test_for_type(typename C::type const*) { return 0.0; }
 
-  //===========
-  // IdType<,> : differentiate multiple type T's by an ID
-  //           : this class requires T to be a user-defined type
-  //===========
-  template <typename T, int ID>
-  struct IDType : public T {
-    typedef T Type;
-    enum { value = ID };
+    static const bool value = sizeof(test_for_type<T>(0)) == sizeof(double);
   };
 
 } // namespace Ext
diff --git a/interfaces/src/algorithm/sweep/WindowSweepImpl.cpp b/interfaces/src/algorithm/sweep/WindowSweepImpl.cpp
index 2c6e941..18f9c87 100644
--- a/interfaces/src/algorithm/sweep/WindowSweepImpl.cpp
+++ b/interfaces/src/algorithm/sweep/WindowSweepImpl.cpp
@@ -24,8 +24,10 @@
 #include <cstdlib>
 #include <deque>
 
-#include "data/bed/BedCheckIterator.hpp"
+#include "data/bed/AllocateIterator_BED_starch_minmem.hpp"
 #include "data/bed/AllocateIterator_BED_starch.hpp"
+#include "data/bed/BedCheckIterator.hpp"
+#include "data/bed/BedCheckIterator_minmem.hpp"
 #include "utility/AllocateIterator.hpp"
 
 namespace WindowSweep {
@@ -34,30 +36,72 @@ namespace WindowSweep {
 
   namespace Details {
 
-    // get() function overloads allow sweep() to be written only twice.
+    // get() & clean() function overloads allow sweep() to be written only twice.
     //  New iterator ideas receive just another get().  For example,
     //  the speedy allocate_iterator<T> requires something special below.
     template <typename IteratorType>
     inline typename IteratorType::value_type* get(IteratorType& i)
       { return(new typename IteratorType::value_type(*i)); }
 
+    template <typename IteratorType>
+    inline void clean(IteratorType& i, typename IteratorType::value_type* p)
+      { delete p; }
 
+
+    // general fast iterator (non-BED)
     template <typename T>
     inline typename Ext::allocate_iterator<T*>::value_type
                                      get(Ext::allocate_iterator<T*>& i)
       { return(*i); } /* no copy via operator new here */
 
     template <typename T>
-    inline typename Bed::allocate_iterator_starch_bed<T*>::value_type
-                                     get(Bed::allocate_iterator_starch_bed<T*>& i)
+    inline void clean(Ext::allocate_iterator<T*>& i, T* p)
+      { delete p; }
+
+
+    // min memory fast iterator (v2p4p26 and older)
+    template <typename T>
+    inline typename Bed::allocate_iterator_starch_bed_mm<T*>::value_type
+                                     get(Bed::allocate_iterator_starch_bed_mm<T*>& i)
       { return(*i); } /* no copy via operator new here */
 
+    template <typename T>
+    inline void clean(Bed::allocate_iterator_starch_bed_mm<T*>& i, T* p)
+      { delete p; }
 
+
+    // fastest iterator (v2p4p27 and newer)
+    template <typename T, std::size_t PoolSz> // pooled memory
+    inline typename Bed::allocate_iterator_starch_bed<T*, PoolSz>::value_type
+                                     get(Bed::allocate_iterator_starch_bed<T*, PoolSz>& i)
+      { return(*i); } /* no copy via operator new here */
+
+    template <typename T, std::size_t PoolSz>
+    inline void clean(Bed::allocate_iterator_starch_bed<T*, PoolSz>& i, T* p)
+      { static auto& pool = i.get_pool(); pool.release(p); }
+
+
+    // min memory error checking iterator(v2p4p26 and older)
     template <typename T>
-    inline typename Bed::bed_check_iterator<T*>::value_type
-                                     get(Bed::bed_check_iterator<T*>& i)
+    inline typename Bed::bed_check_iterator_mm<T*>::value_type
+                                     get(Bed::bed_check_iterator_mm<T*>& i)
       { return(*i); } /* no copy via operator new here */
 
+    template <typename T>
+    inline void clean(Bed::bed_check_iterator_mm<T*>& i, T* p)
+      { delete p; }
+
+
+    // pooled memory error checking iterator(v2p4p27 and newer)
+    template <typename T, std::size_t PoolSz>
+    inline typename Bed::bed_check_iterator<T*, PoolSz>::value_type
+                                     get(Bed::bed_check_iterator<T*, PoolSz>& i)
+      { return(*i); } /* no copy via operator new here */
+
+    template <typename T, std::size_t PoolSz>
+    inline void clean(Bed::bed_check_iterator<T*, PoolSz>& i, T* p)
+      { static auto& pool = i.get_pool(); pool.release(p); }
+
   } // namespace Details
 
   //===================
@@ -78,6 +122,7 @@ namespace WindowSweep {
 
     // Local variables
     // const bool cleanHere = !visitor.ManagesOwnMemory(); no longer useful with multivisitor
+    InputIterator orig = start;
     const TypePtr zero = static_cast<TypePtr>(0);
     TypePtr bPtr = zero;
     std::size_t index = 0;
@@ -93,14 +138,14 @@ namespace WindowSweep {
         visitor.OnStart(win[index]);
         while ( !win.empty() && inRange.Map2Ref(win[0], win[index]) < 0 ) {
           visitor.OnDelete(win[0]);
-          delete win[0];
+          Details::clean(orig, win[0]);
           win.pop_front(), --index;
         } // while
       } else { // last item in windowed buffer, reset buffer
         if ( start == end && !cache ) { // stopping condition
           visitor.OnEnd();
           while ( !win.empty() ) { // deletions belonging to NO ref
-            delete win[0];
+            Details::clean(orig, win[0]);
             win.pop_front();
           } // while
           break;
@@ -138,7 +183,7 @@ namespace WindowSweep {
 
             while ( !win.empty() ) { // deletions on behalf of new ref
               visitor.OnDelete(win[0]);
-              delete win[0];
+              Details::clean(orig, win[0]);
               win.pop_front();
             } // while
           }
@@ -157,7 +202,7 @@ namespace WindowSweep {
     } // while !done
 
     if ( cache )
-      delete cache; // never given to visitor
+      Details::clean(orig, cache); // never given to visitor
 
   } // sweep() overload1
 
@@ -190,6 +235,8 @@ namespace WindowSweep {
     WindowType win;
     double value = 0;
     bool willPurge = false;
+    InputIterator1 rorig = refStart;
+    InputIterator2 morig = mapFromStart;
 
     // Loop through inputs
     while ( refStart != refEnd ) {
@@ -206,7 +253,7 @@ namespace WindowSweep {
       // Pop off items falling out of range 'to the left'
       while ( !win.empty() && inRange.Map2Ref(win[0], rPtr) < 0 ) {
         visitor.OnDelete(win[0]);
-        delete win[0];
+        Details::clean(morig, win[0]);
         win.pop_front();
       } // while
 
@@ -230,26 +277,26 @@ namespace WindowSweep {
           break;
         }
         else
-          delete mPtr;
+          Details::clean(morig, mPtr);
       } // while
       visitor.OnDone(); // done processing current ref item
-      delete rPtr;
+      Details::clean(rorig, rPtr);
     } // while more ref data
 
     visitor.OnEnd();
     while ( !win.empty() ) { // deletions belonging to NO ref
-      delete win[0];
+      Details::clean(morig, win[0]);
       win.pop_front();
     } // while
 
     if ( cache ) // never given to visitor
-      delete cache;
+      Details::clean(morig, cache);
 
     if ( sweepMapAll ) { // read and clean remainder of map file
       while ( mapFromStart != mapFromEnd ) {
         mPtr = Details::get(mapFromStart); // don't do get(mapFromStart); in case allocate_iterator
         ++mapFromStart;
-        delete mPtr; // never given to visitor
+        Details::clean(morig, mPtr); // never given to visitor
       } // while
     }
 
diff --git a/interfaces/src/algorithm/sweep/WindowSweepImpl.specialize.cpp b/interfaces/src/algorithm/sweep/WindowSweepImpl.specialize.cpp
index 16b1b25..0b39252 100644
--- a/interfaces/src/algorithm/sweep/WindowSweepImpl.specialize.cpp
+++ b/interfaces/src/algorithm/sweep/WindowSweepImpl.specialize.cpp
@@ -23,7 +23,6 @@
 
 #include <cstdlib>
 #include <deque>
-#include <type_traits>
 
 #include "data/bed/BedCheckIterator.hpp"
 #include "data/bed/BedDistances.hpp"
@@ -32,6 +31,20 @@
 
 namespace WindowSweep {
 
+  /*
+    why the specialization? From BedBaseVisitor.hpp
+      chr1  1   200  a  1
+      chr1  10  20   b  3
+      chr1  50  150  c  4
+
+      when used with bedmap --bp-ovr 11 --count <one-file>
+
+      row 2 has no hits, but row 1 goes with row 3's output.  Cannot assume that once
+        row 2 is out of range that everything to the left of it is out of range too,
+        even when looking at straight bp's.  The main issue shown here is that the
+        --bp-ovr 11 is larger than row 2's range.  It can never qualify but row 1 can.
+  */
+
   // See WindowSweep.hpp for detailed assumptions of sweep()
 
   //===================
@@ -58,6 +71,7 @@ namespace WindowSweep {
     TypePtr cache = zero;
     bool first = true;
     bool reset = true;
+    InputIterator orig = start;
 
     // Loop through inputs
     while ( start != end || cache || !win.empty() ) {
@@ -67,14 +81,14 @@ namespace WindowSweep {
         while ( !win.empty() && inRange.Map2Ref(win[0], win[index]) < 0 ) {
           if ( win[0]->length() >= inRange.ovrRequired_ )
             visitor.OnDelete(win[0]);
-          delete win[0];
+          Details::clean(orig, win[0]);
           win.pop_front(), --index;
         } // while
       } else { // last item in windowed buffer, reset buffer
         if ( start == end && !cache ) { // stopping condition
           visitor.OnEnd();
           while ( !win.empty() ) { // deletions belonging to NO ref
-            delete win[0];
+            Details::clean(orig, win[0]);
             win.pop_front();
           } // while
           break;
@@ -113,7 +127,7 @@ namespace WindowSweep {
             while ( !win.empty() ) { // deletions on behalf of new ref
               if ( win[0]->length() >= inRange.ovrRequired_ )
                 visitor.OnDelete(win[0]);
-              delete win[0];
+              Details::clean(orig, win[0]);
               win.pop_front();
             } // while
           }
@@ -133,7 +147,7 @@ namespace WindowSweep {
     } // while !done
 
     if ( cache )
-      delete cache; // never given to visitor
+      Details::clean(orig, cache); // never given to visitor
 
   } // sweep() overload1
 
diff --git a/interfaces/src/data/starch/starchHelpers.c b/interfaces/src/data/starch/starchHelpers.c
index 8be5078..2164b2d 100644
--- a/interfaces/src/data/starch/starchHelpers.c
+++ b/interfaces/src/data/starch/starchHelpers.c
@@ -274,7 +274,7 @@ STARCH_createTransformTokens(const char *s, const char delim, char **chr, int64_
 #ifdef __cplusplus
                     else if (strncmp(reinterpret_cast<const char *>( buffer ), kStarchBedHeaderBrowser, strlen(kStarchBedHeaderBrowser)) == 0) {
 #else
-            	    else if (strncmp((const char *) buffer, kStarchBedHeaderBrowser, strlen(kStarchBedHeaderBrowser)) == 0) {
+                    else if (strncmp((const char *) buffer, kStarchBedHeaderBrowser, strlen(kStarchBedHeaderBrowser)) == 0) {
 #endif
                         *lineType = kBedLineHeaderBrowser;
                         elemCnt = 3;
@@ -282,7 +282,7 @@ STARCH_createTransformTokens(const char *s, const char delim, char **chr, int64_
 #ifdef __cplusplus
                     else if (strncmp(reinterpret_cast<const char *>( buffer ), kStarchBedHeaderSAM, strlen(kStarchBedHeaderSAM)) == 0) {
 #else
-            	    else if (strncmp((const char *) buffer, kStarchBedHeaderSAM, strlen(kStarchBedHeaderSAM)) == 0) {
+                    else if (strncmp((const char *) buffer, kStarchBedHeaderSAM, strlen(kStarchBedHeaderSAM)) == 0) {
 #endif
                         *lineType = kBedLineHeaderSAM;
                         elemCnt = 3;
@@ -298,7 +298,7 @@ STARCH_createTransformTokens(const char *s, const char delim, char **chr, int64_
 #ifdef __cplusplus
                     else if (strncmp(reinterpret_cast<const char *>( buffer ), kStarchBedGenericComment, strlen(kStarchBedGenericComment)) == 0) {
 #else
-            	    else if (strncmp((const char *) buffer, kStarchBedGenericComment, strlen(kStarchBedGenericComment)) == 0) {
+                    else if (strncmp((const char *) buffer, kStarchBedGenericComment, strlen(kStarchBedGenericComment)) == 0) {
 #endif
                         *lineType = kBedLineGenericComment;
                         elemCnt = 3;
@@ -306,14 +306,14 @@ STARCH_createTransformTokens(const char *s, const char delim, char **chr, int64_
                     else {
                         *lineType = kBedLineCoordinates;
                     }
-                    
+
                     /* if line type is of kBedLineCoordinates type, then we test chromosome length */
                     if (*lineType == kBedLineCoordinates) {
 #ifdef DEBUG
                         fprintf(stderr, "\t--- copying chromosome field ---\n");
 #endif
                         if (strlen(buffer) > TOKEN_CHR_MAX_LENGTH) {
-                            fprintf(stderr, "ERROR: Chromosome field length is too long (must be no longer than %d characters)\n", TOKEN_CHR_MAX_LENGTH);
+                            fprintf(stderr, "ERROR: Chromosome field length is too long (must be no longer than %lu characters)\n", TOKEN_CHR_MAX_LENGTH);
                             return STARCH_FATAL_ERROR;
                         }
                         /* copy element to chromosome variable, if memory is available */
@@ -338,7 +338,7 @@ STARCH_createTransformTokens(const char *s, const char delim, char **chr, int64_
                         fprintf(stderr, "\t--- copying whole line ---\n");
 #endif
                         if (strlen(s) > TOKENS_HEADER_MAX_LENGTH) {
-                            fprintf(stderr, "ERROR: Comment line length is too long (must be no longer than %d characters)\n", TOKEN_CHR_MAX_LENGTH);
+                            fprintf(stderr, "ERROR: Comment line length is too long (must be no longer than %lu characters)\n", TOKEN_CHR_MAX_LENGTH);
                             return STARCH_FATAL_ERROR;
                         }
                         /* copy whole line to chromosome variable, if memory is available */
@@ -420,19 +420,26 @@ STARCH_createTransformTokens(const char *s, const char delim, char **chr, int64_
         }
     } while (s[sCnt++] != '\0');
 
+#ifdef DEBUG
+    fprintf(stderr, "\t--- s [%s] buffer [%s], charCnt [%u], strlen(buffer) [%zu], sCnt [%u], strlen(s) [%zu], idIdx [%d]\n", s, buffer, charCnt, strlen(buffer), sCnt, strlen(s), idIdx);
+    fprintf(stderr, "\t (post create-transform-tokens: chr -> %s\n\tstart -> %" PRId64 "\n\tstop -> %" PRId64 "\n\tremainder -> %s\n", *chr, *start, *stop, *remainder);
+#endif
+
     if (elemCnt > 3) {
-        buffer[(charCnt - 1)] = '\0';
+        if (charCnt > 0) {
+            buffer[(charCnt - 1)] = '\0';
+        }
         /* test id field length */
         while ((buffer[idIdx] != delim) && (idIdx++ < TOKEN_ID_MAX_LENGTH)) {}
         if (idIdx == TOKEN_ID_MAX_LENGTH) {
-            fprintf(stderr, "ERROR: Id field is too long (must be less than %d characters long)\n", TOKEN_ID_MAX_LENGTH);
+            fprintf(stderr, "ERROR: Id field is too long (must be less than %lu characters long)\n", TOKEN_ID_MAX_LENGTH);
             return STARCH_FATAL_ERROR;
         }
         /* test remnant of buffer, if there is more to look at */
         if (charCnt > idIdx) {
             while ((buffer[idIdx++] != '\0') && (restIdx++ < TOKEN_REST_MAX_LENGTH)) {}
             if (restIdx == TOKEN_REST_MAX_LENGTH) {
-                fprintf(stderr, "ERROR: Remainder of BED input after id field is too long (must be less than %d characters long)\n", TOKEN_REST_MAX_LENGTH);
+                fprintf(stderr, "ERROR: Remainder of BED input after id field is too long (must be less than %lu characters long)\n", TOKEN_REST_MAX_LENGTH);
                 return STARCH_FATAL_ERROR;
             }
         }
@@ -446,9 +453,9 @@ STARCH_createTransformTokens(const char *s, const char delim, char **chr, int64_
             return STARCH_FATAL_ERROR;
         }
 #ifdef __cplusplus
-        strncpy(*remainder, reinterpret_cast<const char *>( buffer ), strlen(buffer) + 1);        
+        strncpy(*remainder, reinterpret_cast<const char *>( buffer ), strlen(buffer) + 1);
 #else
-        strncpy(*remainder, (const char *)buffer, strlen(buffer) + 1);        
+        strncpy(*remainder, (const char *)buffer, strlen(buffer) + 1);
 #endif
 #ifdef DEBUG
         fprintf(stderr, "\t--- resulting remainder [%s]\n", *remainder);
@@ -489,7 +496,7 @@ STARCH_createTransformTokensForHeaderlessInput(const char *s, const char delim,
 #endif
                     /* test if element string is longer than allowed bounds */
                     if (strlen(buffer) > TOKEN_CHR_MAX_LENGTH) {
-                        fprintf(stderr, "ERROR: Chromosome field length is too long (must be no longer than %d characters)\n", TOKEN_CHR_MAX_LENGTH);
+                        fprintf(stderr, "ERROR: Chromosome field length is too long (must be no longer than %lu characters)\n", TOKEN_CHR_MAX_LENGTH);
                         return STARCH_FATAL_ERROR;
                     }
                     /* copy element to chromosome variable, if memory is available */
@@ -596,14 +603,14 @@ STARCH_createTransformTokensForHeaderlessInput(const char *s, const char delim,
         /* test id field length */
         while ((buffer[idIdx] != delim) && (idIdx++ < TOKEN_ID_MAX_LENGTH)) {}
         if (idIdx == TOKEN_ID_MAX_LENGTH) {
-            fprintf(stderr, "ERROR: Id field is too long (must be less than %d characters long)\n", TOKEN_ID_MAX_LENGTH);
+            fprintf(stderr, "ERROR: Id field is too long (must be less than %lu characters long)\n", TOKEN_ID_MAX_LENGTH);
             return STARCH_FATAL_ERROR;
         }
         /* test remnant ("rest") of buffer, if there is more to look at */
         if (charCnt > idIdx) {
             while ((buffer[idIdx++] != '\0') && (restIdx++ < TOKEN_REST_MAX_LENGTH)) {}
             if (restIdx == TOKEN_REST_MAX_LENGTH) {
-                fprintf(stderr, "ERROR: Remainder of BED input after id field is too long (must be less than %d characters long)\n", TOKEN_REST_MAX_LENGTH);
+                fprintf(stderr, "ERROR: Remainder of BED input after id field is too long (must be less than %lu characters long)\n", TOKEN_REST_MAX_LENGTH);
                 return STARCH_FATAL_ERROR;
             }
         }
@@ -683,7 +690,7 @@ STARCH_transformInput(Metadata **md, const FILE *fp, const CompressionType type,
     Boolean withinChr = kStarchFalse;
     unsigned long lineIdx = 0UL;
     off_t outCompressedFnSize = 0;
-    char *legacyMdBuf = NULL; 
+    char *legacyMdBuf = NULL;
     char *dynamicMdBuf = NULL;
     BedLineType lineType = kBedLineTypeUndefined;
     char nonCoordLineBuf[STARCH_BUFFER_MAX_LENGTH] = {0};
@@ -714,7 +721,7 @@ STARCH_transformInput(Metadata **md, const FILE *fp, const CompressionType type,
                 if ( (lineType == kBedLineCoordinates) && ((!prevChromosome) || (strcmp(chromosome, prevChromosome) != 0)) ) {
                     /* close old output file pointer */
                     if (outFnPtr != NULL) {
-                        fclose(outFnPtr); 
+                        fclose(outFnPtr);
                         outFnPtr = NULL;
 
                         if (type == kBzip2) {
@@ -1351,10 +1358,14 @@ STARCH_transformHeaderlessInput(Metadata **md, const FILE *fp, const Compression
                 previousStop = (stop > previousStop) ? stop : previousStop;
 
                 /* cleanup unused data */
-                if (withinChr == kStarchTrue) 
-                    free(chromosome), chromosome = NULL;
-                if (remainder) 
-                    free(remainder), remainder = NULL;
+                if (withinChr == kStarchTrue) {
+                    free(chromosome);
+                    chromosome = NULL;
+                }
+                if (remainder) {
+                    free(remainder);
+                    remainder = NULL;
+                }
                 cIdx = 0;                
             }
             else {
@@ -1646,7 +1657,7 @@ STARCH2_transformInput(unsigned char **header, Metadata **md, const FILE *inFp,
         fprintf(stderr, "ERROR: Could not initialize archive header.\n");
         return STARCH_EXIT_FAILURE;
     }
-    
+
     if (STARCH2_writeStarchHeaderToOutputFp(*header, stdout) != STARCH_EXIT_SUCCESS) {
         fprintf(stderr, "ERROR: Could not write archive header to output file pointer.\n");
         return STARCH_EXIT_FAILURE;
@@ -1693,7 +1704,7 @@ STARCH2_transformHeaderedBEDInput(const FILE *inFp, Metadata **md, const Compres
     fprintf(stderr, "\n--- STARCH2_transformHeaderedBEDInput() ---\n");
 #endif
     int c;
-    int cIdx = 0;
+    unsigned int cIdx = 0;
     char untransformedBuffer[STARCH_BUFFER_MAX_LENGTH];
     char intermediateBuffer[STARCH_BUFFER_MAX_LENGTH];
     char transformedBuffer[STARCH_BUFFER_MAX_LENGTH];
@@ -1746,7 +1757,7 @@ STARCH2_transformHeaderedBEDInput(const FILE *inFp, Metadata **md, const Compres
     char const *nullSig = "null";
     struct sha1_ctx perChromosomeHashCtx;
     LineLengthType maxStringLength = STARCH_DEFAULT_LINE_STRING_LENGTH;
-    
+
     /* increment total file size by header bytes */
 #ifdef DEBUG
     fprintf(stderr, "\tincrementing file size by sizeof(header)\n");
@@ -1852,7 +1863,8 @@ STARCH2_transformHeaderedBEDInput(const FILE *inFp, Metadata **md, const Compres
                         fprintf(stderr, "ERROR: Elements with same start and stop coordinates have remainders in wrong sort order.\nBe sure to first sort input with sort-bed or remove --do-not-sort option from conversion script.\n");
                         return STARCH_FATAL_ERROR;
                     }
-                    free(pRemainder), pRemainder = NULL;
+                    free(pRemainder);
+                    pRemainder = NULL;
                 }
 
                 if ((reportProgressFlag == kStarchTrue) && (lineIdx % reportProgressN == 0)) {
@@ -2123,8 +2135,10 @@ STARCH2_transformHeaderedBEDInput(const FILE *inFp, Metadata **md, const Compres
                         }
 
                         /* clean up per-chromosome hash digest */
-                        if (base64EncodedSha1Digest)
-                            free(base64EncodedSha1Digest), base64EncodedSha1Digest = NULL;
+                        if (base64EncodedSha1Digest) {
+                            free(base64EncodedSha1Digest);
+                            base64EncodedSha1Digest = NULL;
+                        }
                     }
 
                     /* create placeholder records at current chromosome */
@@ -2192,7 +2206,10 @@ STARCH2_transformHeaderedBEDInput(const FILE *inFp, Metadata **md, const Compres
                     lastPosition = 0;
                     pStart = -1;
                     pStop = -1;
-                    if (pRemainder) { free(pRemainder), pRemainder = NULL; }
+                    if (pRemainder) { 
+                        free(pRemainder);
+                        pRemainder = NULL; 
+                    }
                     previousStop = 0;
                     lcDiff = 0;
                     lineIdx = 0UL;
@@ -2430,10 +2447,14 @@ STARCH2_transformHeaderedBEDInput(const FILE *inFp, Metadata **md, const Compres
                         pRemainder = STARCH_strndup(remainder, strlen(remainder));
                 }
 
-                if (withinChr == kStarchTrue) 
-                    free(chromosome), chromosome = NULL;
-                if (remainder) 
-                    free(remainder), remainder = NULL;
+                if (withinChr == kStarchTrue) {
+                    free(chromosome);
+                    chromosome = NULL;
+                }
+                if (remainder) {
+                    free(remainder);
+                    remainder = NULL;
+                }
                 cIdx = 0;
             }
             else {
@@ -2539,7 +2560,8 @@ STARCH2_transformHeaderedBEDInput(const FILE *inFp, Metadata **md, const Compres
                     fprintf(stderr, "ERROR: Elements with same start and stop coordinates have remainders in wrong sort order.\nBe sure to first sort input with sort-bed or remove --do-not-sort option from conversion script.\n");
                     return STARCH_FATAL_ERROR;
                 }
-                free(pRemainder), pRemainder = NULL;
+                free(pRemainder);
+                pRemainder = NULL;
             }
         }
         else {
@@ -2731,8 +2753,10 @@ STARCH2_transformHeaderedBEDInput(const FILE *inFp, Metadata **md, const Compres
     }
 
     /* clean up per-chromosome hash digest */
-    if (base64EncodedSha1Digest)
-        free(base64EncodedSha1Digest), base64EncodedSha1Digest = NULL;
+    if (base64EncodedSha1Digest) {
+        free(base64EncodedSha1Digest);
+        base64EncodedSha1Digest = NULL;
+    }
 
     /* reset metadata pointer */
     *md = firstRecord;
@@ -2805,14 +2829,22 @@ STARCH2_transformHeaderedBEDInput(const FILE *inFp, Metadata **md, const Compres
     fprintf(stdout, "%s", footerBuffer);
     fflush(stdout);
 
-    if (json)
-        free(json), json = NULL;
-    if (compressedFn)
-        free(compressedFn), compressedFn = NULL;
-    if (prevChromosome)
-        free(prevChromosome), prevChromosome = NULL;
-    if (base64EncodedSha1Digest)
-        free(base64EncodedSha1Digest), base64EncodedSha1Digest = NULL;
+    if (json) {
+        free(json);
+        json = NULL;
+    }
+    if (compressedFn) {
+        free(compressedFn);
+        compressedFn = NULL;
+    }
+    if (prevChromosome) {
+        free(prevChromosome);
+        prevChromosome = NULL;
+    }
+    if (base64EncodedSha1Digest) {
+        free(base64EncodedSha1Digest);
+        base64EncodedSha1Digest = NULL;
+    }
 
     return STARCH_EXIT_SUCCESS;
 }
@@ -2824,7 +2856,7 @@ STARCH2_transformHeaderlessBEDInput(const FILE *inFp, Metadata **md, const Compr
     fprintf(stderr, "\n--- STARCH2_transformHeaderlessBEDInput() ---\n");
 #endif
     int c;
-    int cIdx = 0;
+    unsigned int cIdx = 0;
     char untransformedBuffer[STARCH_BUFFER_MAX_LENGTH + 1] = {0};
     char intermediateBuffer[STARCH_BUFFER_MAX_LENGTH + 1] = {0};
     char transformedBuffer[STARCH_BUFFER_MAX_LENGTH + 1] = {0};
@@ -2981,7 +3013,8 @@ STARCH2_transformHeaderlessBEDInput(const FILE *inFp, Metadata **md, const Compr
                         fprintf(stderr, "ERROR: Elements with same start and stop coordinates have remainders in wrong sort order.\nBe sure to first sort input with sort-bed or remove --do-not-sort option from conversion script.\n");
                         return STARCH_FATAL_ERROR;
                     }
-                    free(pRemainder), pRemainder = NULL;
+                    free(pRemainder); 
+                    pRemainder = NULL;
                 }
 
                 if ((reportProgressFlag == kStarchTrue) && (lineIdx % reportProgressN == 0)) {
@@ -3251,8 +3284,10 @@ STARCH2_transformHeaderlessBEDInput(const FILE *inFp, Metadata **md, const Compr
                         }
 
                         /* clean up per-chromosome hash digest */
-                        if (base64EncodedSha1Digest)
-                            free(base64EncodedSha1Digest), base64EncodedSha1Digest = NULL;
+                        if (base64EncodedSha1Digest) {
+                            free(base64EncodedSha1Digest);
+                            base64EncodedSha1Digest = NULL;
+                        }
                     }
 
                     /* create placeholder records at current chromosome */
@@ -3320,7 +3355,10 @@ STARCH2_transformHeaderlessBEDInput(const FILE *inFp, Metadata **md, const Compr
                     lastPosition = 0;
                     pStart = -1;
                     pStop = -1;
-                    if (pRemainder) { free(pRemainder), pRemainder = NULL; }
+                    if (pRemainder) { 
+                        free(pRemainder);
+                        pRemainder = NULL; 
+                    }
                     previousStop = 0;
                     lcDiff = 0;
                     lineIdx = 0UL;
@@ -3545,10 +3583,14 @@ STARCH2_transformHeaderlessBEDInput(const FILE *inFp, Metadata **md, const Compr
                 if (remainder)
                     pRemainder = STARCH_strndup(remainder, strlen(remainder));
 
-                if (withinChr == kStarchTrue) 
-                    free(chromosome), chromosome = NULL;
-                if (remainder) 
-                    free(remainder), remainder = NULL;
+                if (withinChr == kStarchTrue)  {
+                    free(chromosome);
+                    chromosome = NULL;
+                }
+                if (remainder) {
+                    free(remainder);
+                    remainder = NULL;
+                }
                 cIdx = 0;
             }
             else {
@@ -3680,7 +3722,8 @@ STARCH2_transformHeaderlessBEDInput(const FILE *inFp, Metadata **md, const Compr
                     fprintf(stderr, "ERROR: Elements with same start and stop coordinates have remainders in wrong sort order.\nBe sure to first sort input with sort-bed or remove --do-not-sort option from conversion script.\n");
                     return STARCH_FATAL_ERROR;
                 }
-                free(pRemainder), pRemainder = NULL;
+                free(pRemainder);
+                pRemainder = NULL;
             }
         }
         else {
@@ -3882,8 +3925,10 @@ STARCH2_transformHeaderlessBEDInput(const FILE *inFp, Metadata **md, const Compr
     }
 
     /* clean up per-chromosome hash digest */
-    if (base64EncodedSha1Digest)
-        free(base64EncodedSha1Digest), base64EncodedSha1Digest = NULL;
+    if (base64EncodedSha1Digest) {
+        free(base64EncodedSha1Digest);
+        base64EncodedSha1Digest = NULL;
+    }
 
     /* reset metadata pointer */
     *md = firstRecord;
@@ -3958,14 +4003,22 @@ STARCH2_transformHeaderlessBEDInput(const FILE *inFp, Metadata **md, const Compr
     fprintf(stdout, "%s", footerBuffer);
     fflush(stdout);
 
-    if (json)
-        free(json), json = NULL;
-    if (compressedFn)
-        free(compressedFn), compressedFn = NULL;
-    if (prevChromosome)
-        free(prevChromosome), prevChromosome = NULL;
-    if (base64EncodedSha1Digest)
-        free(base64EncodedSha1Digest), base64EncodedSha1Digest = NULL;
+    if (json) {
+        free(json);
+        json = NULL;
+    }
+    if (compressedFn) {
+        free(compressedFn); 
+        compressedFn = NULL;
+    }
+    if (prevChromosome) {
+        free(prevChromosome); 
+        prevChromosome = NULL;
+    }
+    if (base64EncodedSha1Digest) {
+        free(base64EncodedSha1Digest); 
+        base64EncodedSha1Digest = NULL;
+    }
 
     return STARCH_EXIT_SUCCESS;
 }
diff --git a/interfaces/src/data/starch/starchMetadataHelpers.c b/interfaces/src/data/starch/starchMetadataHelpers.c
index 69b07f8..a2b1d80 100644
--- a/interfaces/src/data/starch/starchMetadataHelpers.c
+++ b/interfaces/src/data/starch/starchMetadataHelpers.c
@@ -285,7 +285,8 @@ STARCH_updateMetadataForChromosome(Metadata **md,
                 return STARCH_EXIT_FAILURE;
             }
             if (iter->signature) {
-                free(iter->signature), iter->signature = NULL;
+                free(iter->signature);
+                iter->signature = NULL;
             }
             if (signature) {
 #ifdef __cplusplus
@@ -365,7 +366,7 @@ STARCH_listMetadata(const Metadata *md,
             if ( (strcmp((const char *)iter->chromosome, chr) == 0) || (strcmp("all", chr) == 0) )
 #endif
                 fprintf(stdout, 
-                        "%-25s|%-65s|%-15" PRIu64 "|%-25" PRIu64 "|%-30d|%-20" PRIu64 "|%-20" PRIu64 "|%-25s|%-25s|%-25s\n", 
+                        "%-25s|%-65s|%-15" PRIu64 "|%-25" PRIu64 "|%-30lu|%-20" PRIu64 "|%-20" PRIu64 "|%-25s|%-25s|%-25s\n", 
                         iter->chromosome, 
                         iter->filename, 
                         iter->size, 
@@ -1911,10 +1912,14 @@ STARCH_readLegacyMetadata(const char *buf,
                                               STARCH_DEFAULT_LINE_STRING_LENGTH);
 
                 /* cleanup */
-                if (recFilename)
-                    free(recFilename), recFilename = NULL;
-                if (recChromosome)
-                    free(recChromosome), recChromosome = NULL;
+                if (recFilename) {
+                    free(recFilename);
+                    recFilename = NULL;
+                }
+                if (recChromosome) {
+                    free(recChromosome);
+                    recChromosome = NULL;
+                }
             }
             else
                 break;
diff --git a/interfaces/src/data/starch/starchSha1Digest.c b/interfaces/src/data/starch/starchSha1Digest.c
index 52c5f2a..6538556 100644
--- a/interfaces/src/data/starch/starchSha1Digest.c
+++ b/interfaces/src/data/starch/starchSha1Digest.c
@@ -227,109 +227,109 @@ sha1_process_bytes (const void *buffer, size_t len, struct sha1_ctx *ctx)
     /* When we already have some bits in our internal buffer concatenate
        both inputs first.  */
     if (ctx->buflen != 0)
-	{
-	    size_t left_over = ctx->buflen;
-	    size_t add = 128 - left_over > len ? len : 128 - left_over;
-	    
+    {
+        size_t left_over = ctx->buflen;
+        size_t add = 128 - left_over > len ? len : 128 - left_over;
+        
 #ifdef __cplusplus
-	    memcpy (&(reinterpret_cast<char *>( ctx->buffer ))[left_over], buffer, add);
+        memcpy (&(reinterpret_cast<char *>( ctx->buffer ))[left_over], buffer, add);
 #else
-	    memcpy (&((char *) ctx->buffer)[left_over], buffer, add);
+        memcpy (&((char *) ctx->buffer)[left_over], buffer, add);
 #endif
-	    ctx->buflen += add;
-	    
-	    if (ctx->buflen > 64)
-		{
+        ctx->buflen += add;
+        
+        if (ctx->buflen > 64)
+        {
 #ifdef __cplusplus
-		    sha1_process_block (ctx->buffer, static_cast<size_t> (ctx->buflen & static_cast<sha1_uint32>( ~63 )), ctx);
+            sha1_process_block (ctx->buffer, static_cast<size_t> (ctx->buflen & static_cast<sha1_uint32>( ~63 )), ctx);
 #else
-		    sha1_process_block (ctx->buffer, (size_t) (ctx->buflen & (sha1_uint32) ~63), ctx);
+            sha1_process_block (ctx->buffer, (size_t) (ctx->buflen & (sha1_uint32) ~63), ctx);
 #endif
-		    
-		    ctx->buflen &= 63;
-		    /* The regions in the following copy operation cannot overlap.  */
+            
+            ctx->buflen &= 63;
+            /* The regions in the following copy operation cannot overlap.  */
 #ifdef __cplusplus
-		    memcpy (ctx->buffer,
-			    &(reinterpret_cast<char *>( ctx->buffer ))[(left_over + add) & static_cast<sha1_uint32>( ~63 )],
-			    ctx->buflen);
+            memcpy (ctx->buffer,
+                &(reinterpret_cast<char *>( ctx->buffer ))[(left_over + add) & static_cast<sha1_uint32>( ~63 )],
+                ctx->buflen);
 #else
-		    memcpy (ctx->buffer,
-			    &((char *) ctx->buffer)[(left_over + add) & (sha1_uint32) ~63],
-			    ctx->buflen);
+            memcpy (ctx->buffer,
+                &((char *) ctx->buffer)[(left_over + add) & (sha1_uint32) ~63],
+                ctx->buflen);
 #endif
-		}
-	    
+        }
+        
 #ifdef __cplusplus
-	    buffer = reinterpret_cast<const char *>( buffer ) + add;
+        buffer = reinterpret_cast<const char *>( buffer ) + add;
 #else
-	    buffer = (const char *) buffer + add;
+        buffer = (const char *) buffer + add;
 #endif
-	    len -= add;
-	}
+        len -= add;
+    }
     
     /* Process available complete blocks.  */
     if (len >= 64)
-	{
-	    
+    {
+        
 #ifndef __GLIBC__
 #define _STRING_ARCH_unaligned 0
 #endif
-	    
+        
 #if !_STRING_ARCH_unaligned
-# define alignof(type) offsetof (offset_test, x)
+# define alignof(type) offsetof (struct offset_test, x)
 #ifdef __cplusplus
 # define UNALIGNED_P(p) ((reinterpret_cast<size_t>( const_cast<void *>( p ) )) % alignof (sha1_uint32) != 0)
 #else
 # define UNALIGNED_P(p) (((size_t) p) % alignof (sha1_uint32) != 0)
 #endif
-	    if (UNALIGNED_P (buffer))
-		while (len > 64)
-		    {
-			sha1_process_block (memcpy (ctx->buffer, buffer, 64), 64, ctx);
-#ifdef __cplusplus
-			buffer = reinterpret_cast<const char *>( buffer ) + 64;
-#else
-			buffer = (const char *) buffer + 64;
-#endif
-			len -= 64;
-		    }
-	    else
+        if (UNALIGNED_P (buffer))
+            while (len > 64)
+                {
+                sha1_process_block (memcpy (ctx->buffer, buffer, 64), 64, ctx);
+        #ifdef __cplusplus
+                buffer = reinterpret_cast<const char *>( buffer ) + 64;
+        #else
+                buffer = (const char *) buffer + 64;
+        #endif
+                len -= 64;
+                }
+        else
 #endif
-		{
+        {
 #ifdef __cplusplus
-		    sha1_process_block (buffer, len & static_cast<sha1_uint32>( ~63 ), ctx);
-		    buffer = reinterpret_cast<const char *>( buffer ) + (len & static_cast<sha1_uint32>( ~63 ));
+            sha1_process_block (buffer, len & static_cast<sha1_uint32>( ~63 ), ctx);
+            buffer = reinterpret_cast<const char *>( buffer ) + (len & static_cast<sha1_uint32>( ~63 ));
 #else
-		    sha1_process_block (buffer, len & (sha1_uint32) ~63, ctx);
-		    buffer = (const char *) buffer + (len & (sha1_uint32) ~63);
+            sha1_process_block (buffer, len & (sha1_uint32) ~63, ctx);
+            buffer = (const char *) buffer + (len & (sha1_uint32) ~63);
 #endif
-		    len &= 63;
-		}
-	}
+            len &= 63;
+        }
+    }
     
     /* Move remaining bytes in internal buffer.  */
     if (len > 0)
-	{
-	    size_t left_over = ctx->buflen;
-	    
+    {
+        size_t left_over = ctx->buflen;
+        
 #ifdef __cplusplus
-	    memcpy (&(reinterpret_cast<char *>( ctx->buffer ))[left_over], buffer, len);
+        memcpy (&(reinterpret_cast<char *>( ctx->buffer ))[left_over], buffer, len);
 #else
-	    memcpy (&((char *) ctx->buffer)[left_over], buffer, len);
+        memcpy (&((char *) ctx->buffer)[left_over], buffer, len);
 #endif
-	    left_over += len;
-	    if (left_over >= 64)
-		{
-		    sha1_process_block (ctx->buffer, 64, ctx);
-		    left_over -= 64;
-		    memcpy (ctx->buffer, &ctx->buffer[16], left_over);
-		}
+        left_over += len;
+        if (left_over >= 64)
+        {
+            sha1_process_block (ctx->buffer, 64, ctx);
+            left_over -= 64;
+            memcpy (ctx->buffer, &ctx->buffer[16], left_over);
+        }
 #ifdef __cplusplus
-	    ctx->buflen = static_cast<sha1_uint32>( left_over );
+        ctx->buflen = static_cast<sha1_uint32>( left_over );
 #else
-	    ctx->buflen = (sha1_uint32) left_over;
+        ctx->buflen = (sha1_uint32) left_over;
 #endif
-	}
+    }
 }
 
 /* --- Code below is the primary difference between md5.c and sha1.c --- */
@@ -372,7 +372,7 @@ sha1_process_block (const void *buffer, size_t len, struct sha1_ctx *ctx)
        number of bytes.  Do a double word increment.  */
     ctx->total[0] += len;
     if (ctx->total[0] < len)
-	++ctx->total[1];
+    ++ctx->total[1];
 
 #ifdef __cplusplus
 #define rol(x, n) (((x) << (n)) | (static_cast<sha1_uint32>( x ) >> (32 - (n))))
@@ -380,114 +380,114 @@ sha1_process_block (const void *buffer, size_t len, struct sha1_ctx *ctx)
 #define rol(x, n) (((x) << (n)) | ((sha1_uint32) (x) >> (32 - (n))))
 #endif
 
-#define M(I) ( tm =   x[I&0x0f] ^ x[(I-14)&0x0f]	\
-	       ^ x[(I-8)&0x0f] ^ x[(I-3)&0x0f]		\
-	       , (x[I&0x0f] = rol(tm, 1)) )
+#define M(I) ( tm =   x[I&0x0f] ^ x[(I-14)&0x0f]    \
+           ^ x[(I-8)&0x0f] ^ x[(I-3)&0x0f]        \
+           , (x[I&0x0f] = rol(tm, 1)) )
     
-#define R(A,B,C,D,E,F,K,M)  do { E += rol( A, 5 )	\
-	    + F( B, C, D )				\
-	    + K						\
-	    + M;					\
-	B = rol( B, 30 );				\
+#define R(A,B,C,D,E,F,K,M)  do { E += rol( A, 5 )    \
+        + F( B, C, D )                \
+        + K                        \
+        + M;                    \
+    B = rol( B, 30 );                \
     } while(0)
     
     while (words < endp)
-	{
-	    sha1_uint32 tm;
-	    int t;
-	    for (t = 0; t < 16; t++)
-		{
-		    x[t] = SWAP (*words);
-		    words++;
-		}
-	    
-	    R( a, b, c, d, e, F1, K1, x[ 0] );
-	    R( e, a, b, c, d, F1, K1, x[ 1] );
-	    R( d, e, a, b, c, F1, K1, x[ 2] );
-	    R( c, d, e, a, b, F1, K1, x[ 3] );
-	    R( b, c, d, e, a, F1, K1, x[ 4] );
-	    R( a, b, c, d, e, F1, K1, x[ 5] );
-	    R( e, a, b, c, d, F1, K1, x[ 6] );
-	    R( d, e, a, b, c, F1, K1, x[ 7] );
-	    R( c, d, e, a, b, F1, K1, x[ 8] );
-	    R( b, c, d, e, a, F1, K1, x[ 9] );
-	    R( a, b, c, d, e, F1, K1, x[10] );
-	    R( e, a, b, c, d, F1, K1, x[11] );
-	    R( d, e, a, b, c, F1, K1, x[12] );
-	    R( c, d, e, a, b, F1, K1, x[13] );
-	    R( b, c, d, e, a, F1, K1, x[14] );
-	    R( a, b, c, d, e, F1, K1, x[15] );
-	    R( e, a, b, c, d, F1, K1, M(16) );
-	    R( d, e, a, b, c, F1, K1, M(17) );
-	    R( c, d, e, a, b, F1, K1, M(18) );
-	    R( b, c, d, e, a, F1, K1, M(19) );
-	    R( a, b, c, d, e, F2, K2, M(20) );
-	    R( e, a, b, c, d, F2, K2, M(21) );
-	    R( d, e, a, b, c, F2, K2, M(22) );
-	    R( c, d, e, a, b, F2, K2, M(23) );
-	    R( b, c, d, e, a, F2, K2, M(24) );
-	    R( a, b, c, d, e, F2, K2, M(25) );
-	    R( e, a, b, c, d, F2, K2, M(26) );
-	    R( d, e, a, b, c, F2, K2, M(27) );
-	    R( c, d, e, a, b, F2, K2, M(28) );
-	    R( b, c, d, e, a, F2, K2, M(29) );
-	    R( a, b, c, d, e, F2, K2, M(30) );
-	    R( e, a, b, c, d, F2, K2, M(31) );
-	    R( d, e, a, b, c, F2, K2, M(32) );
-	    R( c, d, e, a, b, F2, K2, M(33) );
-	    R( b, c, d, e, a, F2, K2, M(34) );
-	    R( a, b, c, d, e, F2, K2, M(35) );
-	    R( e, a, b, c, d, F2, K2, M(36) );
-	    R( d, e, a, b, c, F2, K2, M(37) );
-	    R( c, d, e, a, b, F2, K2, M(38) );
-	    R( b, c, d, e, a, F2, K2, M(39) );
-	    R( a, b, c, d, e, F3, K3, M(40) );
-	    R( e, a, b, c, d, F3, K3, M(41) );
-	    R( d, e, a, b, c, F3, K3, M(42) );
-	    R( c, d, e, a, b, F3, K3, M(43) );
-	    R( b, c, d, e, a, F3, K3, M(44) );
-	    R( a, b, c, d, e, F3, K3, M(45) );
-	    R( e, a, b, c, d, F3, K3, M(46) );
-	    R( d, e, a, b, c, F3, K3, M(47) );
-	    R( c, d, e, a, b, F3, K3, M(48) );
-	    R( b, c, d, e, a, F3, K3, M(49) );
-	    R( a, b, c, d, e, F3, K3, M(50) );
-	    R( e, a, b, c, d, F3, K3, M(51) );
-	    R( d, e, a, b, c, F3, K3, M(52) );
-	    R( c, d, e, a, b, F3, K3, M(53) );
-	    R( b, c, d, e, a, F3, K3, M(54) );
-	    R( a, b, c, d, e, F3, K3, M(55) );
-	    R( e, a, b, c, d, F3, K3, M(56) );
-	    R( d, e, a, b, c, F3, K3, M(57) );
-	    R( c, d, e, a, b, F3, K3, M(58) );
-	    R( b, c, d, e, a, F3, K3, M(59) );
-	    R( a, b, c, d, e, F4, K4, M(60) );
-	    R( e, a, b, c, d, F4, K4, M(61) );
-	    R( d, e, a, b, c, F4, K4, M(62) );
-	    R( c, d, e, a, b, F4, K4, M(63) );
-	    R( b, c, d, e, a, F4, K4, M(64) );
-	    R( a, b, c, d, e, F4, K4, M(65) );
-	    R( e, a, b, c, d, F4, K4, M(66) );
-	    R( d, e, a, b, c, F4, K4, M(67) );
-	    R( c, d, e, a, b, F4, K4, M(68) );
-	    R( b, c, d, e, a, F4, K4, M(69) );
-	    R( a, b, c, d, e, F4, K4, M(70) );
-	    R( e, a, b, c, d, F4, K4, M(71) );
-	    R( d, e, a, b, c, F4, K4, M(72) );
-	    R( c, d, e, a, b, F4, K4, M(73) );
-	    R( b, c, d, e, a, F4, K4, M(74) );
-	    R( a, b, c, d, e, F4, K4, M(75) );
-	    R( e, a, b, c, d, F4, K4, M(76) );
-	    R( d, e, a, b, c, F4, K4, M(77) );
-	    R( c, d, e, a, b, F4, K4, M(78) );
-	    R( b, c, d, e, a, F4, K4, M(79) );
-	    
-	    a = ctx->A += a;
-	    b = ctx->B += b;
-	    c = ctx->C += c;
-	    d = ctx->D += d;
-	    e = ctx->E += e;
-	}
+    {
+        sha1_uint32 tm;
+        int t;
+        for (t = 0; t < 16; t++)
+        {
+            x[t] = SWAP (*words);
+            words++;
+        }
+        
+        R( a, b, c, d, e, F1, K1, x[ 0] );
+        R( e, a, b, c, d, F1, K1, x[ 1] );
+        R( d, e, a, b, c, F1, K1, x[ 2] );
+        R( c, d, e, a, b, F1, K1, x[ 3] );
+        R( b, c, d, e, a, F1, K1, x[ 4] );
+        R( a, b, c, d, e, F1, K1, x[ 5] );
+        R( e, a, b, c, d, F1, K1, x[ 6] );
+        R( d, e, a, b, c, F1, K1, x[ 7] );
+        R( c, d, e, a, b, F1, K1, x[ 8] );
+        R( b, c, d, e, a, F1, K1, x[ 9] );
+        R( a, b, c, d, e, F1, K1, x[10] );
+        R( e, a, b, c, d, F1, K1, x[11] );
+        R( d, e, a, b, c, F1, K1, x[12] );
+        R( c, d, e, a, b, F1, K1, x[13] );
+        R( b, c, d, e, a, F1, K1, x[14] );
+        R( a, b, c, d, e, F1, K1, x[15] );
+        R( e, a, b, c, d, F1, K1, M(16) );
+        R( d, e, a, b, c, F1, K1, M(17) );
+        R( c, d, e, a, b, F1, K1, M(18) );
+        R( b, c, d, e, a, F1, K1, M(19) );
+        R( a, b, c, d, e, F2, K2, M(20) );
+        R( e, a, b, c, d, F2, K2, M(21) );
+        R( d, e, a, b, c, F2, K2, M(22) );
+        R( c, d, e, a, b, F2, K2, M(23) );
+        R( b, c, d, e, a, F2, K2, M(24) );
+        R( a, b, c, d, e, F2, K2, M(25) );
+        R( e, a, b, c, d, F2, K2, M(26) );
+        R( d, e, a, b, c, F2, K2, M(27) );
+        R( c, d, e, a, b, F2, K2, M(28) );
+        R( b, c, d, e, a, F2, K2, M(29) );
+        R( a, b, c, d, e, F2, K2, M(30) );
+        R( e, a, b, c, d, F2, K2, M(31) );
+        R( d, e, a, b, c, F2, K2, M(32) );
+        R( c, d, e, a, b, F2, K2, M(33) );
+        R( b, c, d, e, a, F2, K2, M(34) );
+        R( a, b, c, d, e, F2, K2, M(35) );
+        R( e, a, b, c, d, F2, K2, M(36) );
+        R( d, e, a, b, c, F2, K2, M(37) );
+        R( c, d, e, a, b, F2, K2, M(38) );
+        R( b, c, d, e, a, F2, K2, M(39) );
+        R( a, b, c, d, e, F3, K3, M(40) );
+        R( e, a, b, c, d, F3, K3, M(41) );
+        R( d, e, a, b, c, F3, K3, M(42) );
+        R( c, d, e, a, b, F3, K3, M(43) );
+        R( b, c, d, e, a, F3, K3, M(44) );
+        R( a, b, c, d, e, F3, K3, M(45) );
+        R( e, a, b, c, d, F3, K3, M(46) );
+        R( d, e, a, b, c, F3, K3, M(47) );
+        R( c, d, e, a, b, F3, K3, M(48) );
+        R( b, c, d, e, a, F3, K3, M(49) );
+        R( a, b, c, d, e, F3, K3, M(50) );
+        R( e, a, b, c, d, F3, K3, M(51) );
+        R( d, e, a, b, c, F3, K3, M(52) );
+        R( c, d, e, a, b, F3, K3, M(53) );
+        R( b, c, d, e, a, F3, K3, M(54) );
+        R( a, b, c, d, e, F3, K3, M(55) );
+        R( e, a, b, c, d, F3, K3, M(56) );
+        R( d, e, a, b, c, F3, K3, M(57) );
+        R( c, d, e, a, b, F3, K3, M(58) );
+        R( b, c, d, e, a, F3, K3, M(59) );
+        R( a, b, c, d, e, F4, K4, M(60) );
+        R( e, a, b, c, d, F4, K4, M(61) );
+        R( d, e, a, b, c, F4, K4, M(62) );
+        R( c, d, e, a, b, F4, K4, M(63) );
+        R( b, c, d, e, a, F4, K4, M(64) );
+        R( a, b, c, d, e, F4, K4, M(65) );
+        R( e, a, b, c, d, F4, K4, M(66) );
+        R( d, e, a, b, c, F4, K4, M(67) );
+        R( c, d, e, a, b, F4, K4, M(68) );
+        R( b, c, d, e, a, F4, K4, M(69) );
+        R( a, b, c, d, e, F4, K4, M(70) );
+        R( e, a, b, c, d, F4, K4, M(71) );
+        R( d, e, a, b, c, F4, K4, M(72) );
+        R( c, d, e, a, b, F4, K4, M(73) );
+        R( b, c, d, e, a, F4, K4, M(74) );
+        R( a, b, c, d, e, F4, K4, M(75) );
+        R( e, a, b, c, d, F4, K4, M(76) );
+        R( d, e, a, b, c, F4, K4, M(77) );
+        R( c, d, e, a, b, F4, K4, M(78) );
+        R( b, c, d, e, a, F4, K4, M(79) );
+        
+        a = ctx->A += a;
+        b = ctx->B += b;
+        c = ctx->C += c;
+        d = ctx->D += d;
+        e = ctx->E += e;
+    }
 }
 
 /* We want to digest in one go, so we run everything at once */
diff --git a/interfaces/src/data/starch/unstarchHelpers.c b/interfaces/src/data/starch/unstarchHelpers.c
index 255bb5d..b79a8a5 100644
--- a/interfaces/src/data/starch/unstarchHelpers.c
+++ b/interfaces/src/data/starch/unstarchHelpers.c
@@ -971,13 +971,13 @@ UNSTARCH_sReverseTransformIgnoringHeaderedInput(const char *chr, const unsigned
                     *currentChr = currentChrCopy;
                     *currentChrLen = strlen(chr) * 2;
                 }
-                strncpy(*currentChr, chr, strlen(chr) + 1);                
+                strncpy(*currentChr, chr, strlen(chr) + 1);
                 if (!*currentChr) {
                     fprintf(stderr, "ERROR: Current chromosome name is not set\n");
-                    return UNSTARCH_FATAL_ERROR;                
+                    return UNSTARCH_FATAL_ERROR;
                 }
                 *currentStart = *start;
-                *currentStop = *lastEnd;                
+                *currentStop = *lastEnd;
                 if (! *currentRemainder) {
 #ifdef __cplusplus
                     *currentRemainder = static_cast<char *>( malloc(strlen(elemTok2) + 1) );
@@ -1054,7 +1054,7 @@ UNSTARCH_sReverseTransformIgnoringHeaderedInput(const char *chr, const unsigned
                 /* strncpy(*currentChr, chr, strlen(chr) + 1); */
                 if (! *currentChr) {
                     fprintf(stderr, "ERROR: Current chromosome name could not be copied\n");
-                    return UNSTARCH_FATAL_ERROR;                
+                    return UNSTARCH_FATAL_ERROR;
                 }
 #ifdef __cplusplus
                 *currentStart = static_cast<SignedCoordType>( strtoull(elemTok1, NULL, UNSTARCH_RADIX) );
@@ -1086,7 +1086,7 @@ UNSTARCH_sReverseTransformIgnoringHeaderedInput(const char *chr, const unsigned
                 strncpy(*currentRemainder, elemTok2, strlen(elemTok2) + 1);
                 if (!*currentRemainder) {
                     fprintf(stderr, "ERROR: Current remainder token could not be copied\n");
-                    return UNSTARCH_FATAL_ERROR;                
+                    return UNSTARCH_FATAL_ERROR;
                 }
             }
         }
@@ -1119,7 +1119,7 @@ UNSTARCH_sReverseTransformIgnoringHeaderedInput(const char *chr, const unsigned
             strncpy(*currentChr, chr, strlen(chr) + 1);
             if (! *currentChr) {
                 fprintf(stderr, "ERROR: Current chromosome name could not be copied\n");
-                return UNSTARCH_FATAL_ERROR;                
+                return UNSTARCH_FATAL_ERROR;
             }
 
             if (elemTok1[0] == 'p') {
@@ -1143,6 +1143,11 @@ UNSTARCH_sReverseTransformIgnoringHeaderedInput(const char *chr, const unsigned
                 *currentStart = *start;
                 *currentStop = *lastEnd;
             }
+            if (*currentRemainder) {
+                free(*currentRemainder);
+                *currentRemainder = NULL;
+                *currentRemainderLen = 0;
+            }
         }
     }
     else {
@@ -1458,7 +1463,7 @@ UNSTARCH_sReverseTransformHeaderlessInput(const char *chr, const unsigned char *
                 strncpy(*currentRemainder, elemTok2, strlen(elemTok2) + 1);
                 if (!*currentRemainder) {
                     fprintf(stderr, "ERROR: Current remainder token could not be copied\n");
-                    return UNSTARCH_FATAL_ERROR;                
+                    return UNSTARCH_FATAL_ERROR;
                 }
             }
         }
@@ -1519,7 +1524,7 @@ UNSTARCH_sReverseTransformHeaderlessInput(const char *chr, const unsigned char *
                 strncpy(*currentChr, chr, strlen(chr) + 1);
                 if (!*currentChr) {
                     fprintf(stderr, "ERROR: Current chromosome name could not be copied\n");
-                    return UNSTARCH_FATAL_ERROR;                
+                    return UNSTARCH_FATAL_ERROR;
                 }
                 *currentStart = *start;
                 *currentStop = *lastEnd;
@@ -1534,8 +1539,8 @@ UNSTARCH_sReverseTransformHeaderlessInput(const char *chr, const unsigned char *
     return 0;
 }
 
-int 
-UNSTARCH_createInverseTransformTokens(const unsigned char *s, const char delim, char elemTok1[], char elemTok2[]) 
+int
+UNSTARCH_createInverseTransformTokens(const unsigned char *s, const char delim, char elemTok1[], char elemTok2[])
 {
 #ifdef DEBUG
     fprintf(stderr, "\n--- UNSTARCH_createInverseTransformTokens() ---\n");
@@ -1546,18 +1551,21 @@ UNSTARCH_createInverseTransformTokens(const unsigned char *s, const char delim,
     charCnt = 0;
     sCnt = 0;
     elemCnt = 0;
-	
+
+    elemTok1[0] = '\0';
+    elemTok2[0] = '\0';
+
     do {
         buffer[charCnt++] = s[sCnt];
         if (buffer[(charCnt - 1)] == delim) {
-            if (elemCnt == 0) { 
+            if (elemCnt == 0) {
                 buffer[(charCnt - 1)] = '\0';
 #ifdef __cplusplus
-                strncpy(elemTok1, reinterpret_cast<const char *>( buffer ), strlen(reinterpret_cast<const char *>( buffer )) + 1); 
+                strncpy(elemTok1, reinterpret_cast<const char *>( buffer ), strlen(reinterpret_cast<const char *>( buffer )) + 1);
 #else
-                strncpy(elemTok1, (const char *) buffer, strlen((const char *) buffer) + 1); 
+                strncpy(elemTok1, (const char *) buffer, strlen((const char *) buffer) + 1);
 #endif
-                elemCnt++; 
+                elemCnt++;
                 charCnt = 0;
             }
         }
@@ -1593,7 +1601,7 @@ UNSTARCH_strnstr(const char *haystack, const char *needle, size_t haystackLen)
     size_t pLen;
     size_t len = strlen(needle);
 
-    if (*needle == '\0') {    
+    if (*needle == '\0') {
 	/* everything matches empty string */
 #ifdef __cplusplus
         return const_cast<char *>( haystack );
@@ -1732,7 +1740,7 @@ UNSTARCH_printLineMaxStringLengthForChromosome(const Metadata *md, const char *c
     if (strcmp(chr, "all") == 0)
         UNSTARCH_printLineMaxStringLengthForAllChromosomes(md);
     else
-        fprintf(stdout, "%d\n", UNSTARCH_lineMaxStringLengthForChromosome(md, chr));
+        fprintf(stdout, "%lu\n", UNSTARCH_lineMaxStringLengthForChromosome(md, chr));
 }
 
 void
@@ -1747,7 +1755,7 @@ UNSTARCH_printLineMaxStringLengthForAllChromosomes(const Metadata *md)
     for (iter = md; iter != NULL; iter = iter->next)
         lineMaxStringLength = (lineMaxStringLength >= iter->lineMaxStringLength) ? lineMaxStringLength : iter->lineMaxStringLength;
 
-    fprintf(stdout, "%d\n", lineMaxStringLength);
+    fprintf(stdout, "%lu\n", lineMaxStringLength);
 }
 
 BaseCountType
@@ -2110,7 +2118,8 @@ UNSTARCH_printMetadataSignature(const unsigned char *mdSha1Buffer)
         exit(-1);
     }
     fprintf(stdout, "metadata\t%s\n", jsonBase64String);
-    free(jsonBase64String), jsonBase64String = NULL;
+    free(jsonBase64String);
+    jsonBase64String = NULL;
 }
 
 void
@@ -2162,7 +2171,10 @@ UNSTARCH_verifySignature(FILE **inFp, const Metadata *md, const uint64_t mdOffse
             }
         }
     }
-    if (observedSignature) { free(observedSignature), observedSignature = NULL; }
+    if (observedSignature) { 
+        free(observedSignature);
+        observedSignature = NULL; 
+    }
     return signaturesVerifiedFlag;
 }
 
diff --git a/interfaces/src/utility/SingletonType.cpp b/interfaces/src/utility/SingletonType.cpp
new file mode 100644
index 0000000..02c554f
--- /dev/null
+++ b/interfaces/src/utility/SingletonType.cpp
@@ -0,0 +1,14 @@
+#include <cstdlib>
+
+namespace Ext {
+
+template <typename T>
+T* SingletonType<T>::_instance = 0;
+
+template <typename T>
+void SingletonType<T>::Cleanup() { delete _instance; _instance = 0; }
+
+template <typename T>
+SingletonType<T>::SingletonType() { std::atexit(&Cleanup); }
+
+} // namespace Ext
diff --git a/packaging/deb/Dockerfile b/packaging/deb/Dockerfile
index d42f210..192c67a 100644
--- a/packaging/deb/Dockerfile
+++ b/packaging/deb/Dockerfile
@@ -10,16 +10,16 @@ RUN apt-get clean
 ADD . /bedops
 
 # populate base debian package tree
-RUN mkdir /bedops_2.4.26
-WORKDIR /bedops_2.4.26
+RUN mkdir /bedops_2.4.28
+WORKDIR /bedops_2.4.28
 RUN mkdir -p DEBIAN usr/bin usr/share/doc/bedops
 RUN cp /bedops/LICENSE /bedops/README.md usr/share/doc/bedops
 RUN cp /bedops/packaging/deb/control DEBIAN
 
 # build and install bedops into debian package tree
 WORKDIR /bedops
-RUN make -j `nproc` && make install BINDIR=/bedops_2.4.26/usr/bin
+RUN make -j `nproc` && make install BINDIR=/bedops_2.4.28/usr/bin
 WORKDIR /
-RUN dpkg-deb --build bedops_2.4.26
+RUN dpkg-deb --build bedops_2.4.28
 
 # deb file should now be located in / directory
diff --git a/packaging/deb/control b/packaging/deb/control
index b9dc7a0..e209c38 100644
--- a/packaging/deb/control
+++ b/packaging/deb/control
@@ -1,5 +1,5 @@
 Package: bedops
-Version: 2.4.26
+Version: 2.4.28
 Section: base
 Priority: optional
 Architecture: amd64
diff --git a/packaging/os_x/BEDOPS.pkgproj b/packaging/os_x/BEDOPS.pkgproj
index c6edc43..9eed121 100755
--- a/packaging/os_x/BEDOPS.pkgproj
+++ b/packaging/os_x/BEDOPS.pkgproj
@@ -593,6 +593,38 @@
 													<key>GID</key>
 													<integer>0</integer>
 													<key>PATH</key>
+													<string>resources/bin/convert2bed-megarow</string>
+													<key>PATH_TYPE</key>
+													<integer>1</integer>
+													<key>PERMISSIONS</key>
+													<integer>493</integer>
+													<key>TYPE</key>
+													<integer>3</integer>
+													<key>UID</key>
+													<integer>0</integer>
+												</dict>
+												<dict>
+													<key>CHILDREN</key>
+													<array/>
+													<key>GID</key>
+													<integer>0</integer>
+													<key>PATH</key>
+													<string>resources/bin/convert2bed-typical</string>
+													<key>PATH_TYPE</key>
+													<integer>1</integer>
+													<key>PERMISSIONS</key>
+													<integer>493</integer>
+													<key>TYPE</key>
+													<integer>3</integer>
+													<key>UID</key>
+													<integer>0</integer>
+												</dict>
+												<dict>
+													<key>CHILDREN</key>
+													<array/>
+													<key>GID</key>
+													<integer>0</integer>
+													<key>PATH</key>
 													<string>resources/bin/gff2bed</string>
 													<key>PATH_TYPE</key>
 													<integer>1</integer>
@@ -917,6 +949,8 @@
 				<integer>1</integer>
 				<key>CONCLUSION_ACTION</key>
 				<integer>0</integer>
+				<key>FOLLOW_SYMBOLIC_LINKS</key>
+				<true/>
 				<key>IDENTIFIER</key>
 				<string>org.uwencode.bedops.conversion</string>
 				<key>LOCATION</key>
@@ -1388,6 +1422,38 @@
 													<key>UID</key>
 													<integer>0</integer>
 												</dict>
+												<dict>
+													<key>CHILDREN</key>
+													<array/>
+													<key>GID</key>
+													<integer>0</integer>
+													<key>PATH</key>
+													<string>resources/bin/bedextract-megarow</string>
+													<key>PATH_TYPE</key>
+													<integer>1</integer>
+													<key>PERMISSIONS</key>
+													<integer>493</integer>
+													<key>TYPE</key>
+													<integer>3</integer>
+													<key>UID</key>
+													<integer>0</integer>
+												</dict>
+												<dict>
+													<key>CHILDREN</key>
+													<array/>
+													<key>GID</key>
+													<integer>0</integer>
+													<key>PATH</key>
+													<string>resources/bin/bedextract-typical</string>
+													<key>PATH_TYPE</key>
+													<integer>1</integer>
+													<key>PERMISSIONS</key>
+													<integer>493</integer>
+													<key>TYPE</key>
+													<integer>3</integer>
+													<key>UID</key>
+													<integer>0</integer>
+												</dict>
 											</array>
 											<key>GID</key>
 											<integer>0</integer>
@@ -1462,6 +1528,8 @@
 				<integer>1</integer>
 				<key>CONCLUSION_ACTION</key>
 				<integer>0</integer>
+				<key>FOLLOW_SYMBOLIC_LINKS</key>
+				<true/>
 				<key>IDENTIFIER</key>
 				<string>org.uwencode.bedops.bedextract</string>
 				<key>LOCATION</key>
@@ -1933,6 +2001,38 @@
 													<key>UID</key>
 													<integer>0</integer>
 												</dict>
+												<dict>
+													<key>CHILDREN</key>
+													<array/>
+													<key>GID</key>
+													<integer>0</integer>
+													<key>PATH</key>
+													<string>resources/bin/bedmap-megarow</string>
+													<key>PATH_TYPE</key>
+													<integer>1</integer>
+													<key>PERMISSIONS</key>
+													<integer>493</integer>
+													<key>TYPE</key>
+													<integer>3</integer>
+													<key>UID</key>
+													<integer>0</integer>
+												</dict>
+												<dict>
+													<key>CHILDREN</key>
+													<array/>
+													<key>GID</key>
+													<integer>0</integer>
+													<key>PATH</key>
+													<string>resources/bin/bedmap-typical</string>
+													<key>PATH_TYPE</key>
+													<integer>1</integer>
+													<key>PERMISSIONS</key>
+													<integer>493</integer>
+													<key>TYPE</key>
+													<integer>3</integer>
+													<key>UID</key>
+													<integer>0</integer>
+												</dict>
 											</array>
 											<key>GID</key>
 											<integer>0</integer>
@@ -2007,6 +2107,8 @@
 				<integer>1</integer>
 				<key>CONCLUSION_ACTION</key>
 				<integer>0</integer>
+				<key>FOLLOW_SYMBOLIC_LINKS</key>
+				<true/>
 				<key>IDENTIFIER</key>
 				<string>org.uwencode.bedops.bedmap</string>
 				<key>LOCATION</key>
@@ -2478,6 +2580,38 @@
 													<key>UID</key>
 													<integer>0</integer>
 												</dict>
+												<dict>
+													<key>CHILDREN</key>
+													<array/>
+													<key>GID</key>
+													<integer>0</integer>
+													<key>PATH</key>
+													<string>resources/bin/bedops-megarow</string>
+													<key>PATH_TYPE</key>
+													<integer>1</integer>
+													<key>PERMISSIONS</key>
+													<integer>493</integer>
+													<key>TYPE</key>
+													<integer>3</integer>
+													<key>UID</key>
+													<integer>0</integer>
+												</dict>
+												<dict>
+													<key>CHILDREN</key>
+													<array/>
+													<key>GID</key>
+													<integer>0</integer>
+													<key>PATH</key>
+													<string>resources/bin/bedops-typical</string>
+													<key>PATH_TYPE</key>
+													<integer>1</integer>
+													<key>PERMISSIONS</key>
+													<integer>493</integer>
+													<key>TYPE</key>
+													<integer>3</integer>
+													<key>UID</key>
+													<integer>0</integer>
+												</dict>
 											</array>
 											<key>GID</key>
 											<integer>0</integer>
@@ -2552,6 +2686,8 @@
 				<integer>1</integer>
 				<key>CONCLUSION_ACTION</key>
 				<integer>0</integer>
+				<key>FOLLOW_SYMBOLIC_LINKS</key>
+				<true/>
 				<key>IDENTIFIER</key>
 				<string>org.uwencode.bedops.bedops</string>
 				<key>LOCATION</key>
@@ -3023,6 +3159,38 @@
 													<key>UID</key>
 													<integer>0</integer>
 												</dict>
+												<dict>
+													<key>CHILDREN</key>
+													<array/>
+													<key>GID</key>
+													<integer>0</integer>
+													<key>PATH</key>
+													<string>resources/bin/closest-features-megarow</string>
+													<key>PATH_TYPE</key>
+													<integer>1</integer>
+													<key>PERMISSIONS</key>
+													<integer>493</integer>
+													<key>TYPE</key>
+													<integer>3</integer>
+													<key>UID</key>
+													<integer>0</integer>
+												</dict>
+												<dict>
+													<key>CHILDREN</key>
+													<array/>
+													<key>GID</key>
+													<integer>0</integer>
+													<key>PATH</key>
+													<string>resources/bin/closest-features-typical</string>
+													<key>PATH_TYPE</key>
+													<integer>1</integer>
+													<key>PERMISSIONS</key>
+													<integer>493</integer>
+													<key>TYPE</key>
+													<integer>3</integer>
+													<key>UID</key>
+													<integer>0</integer>
+												</dict>
 											</array>
 											<key>GID</key>
 											<integer>0</integer>
@@ -3097,6 +3265,8 @@
 				<integer>1</integer>
 				<key>CONCLUSION_ACTION</key>
 				<integer>0</integer>
+				<key>FOLLOW_SYMBOLIC_LINKS</key>
+				<true/>
 				<key>IDENTIFIER</key>
 				<string>org.uwencode.bedops.closest-features</string>
 				<key>LOCATION</key>
@@ -3574,6 +3744,38 @@
 													<key>GID</key>
 													<integer>0</integer>
 													<key>PATH</key>
+													<string>resources/bin/sort-bed-megarow</string>
+													<key>PATH_TYPE</key>
+													<integer>1</integer>
+													<key>PERMISSIONS</key>
+													<integer>493</integer>
+													<key>TYPE</key>
+													<integer>3</integer>
+													<key>UID</key>
+													<integer>0</integer>
+												</dict>
+												<dict>
+													<key>CHILDREN</key>
+													<array/>
+													<key>GID</key>
+													<integer>0</integer>
+													<key>PATH</key>
+													<string>resources/bin/sort-bed-typical</string>
+													<key>PATH_TYPE</key>
+													<integer>1</integer>
+													<key>PERMISSIONS</key>
+													<integer>493</integer>
+													<key>TYPE</key>
+													<integer>3</integer>
+													<key>UID</key>
+													<integer>0</integer>
+												</dict>
+												<dict>
+													<key>CHILDREN</key>
+													<array/>
+													<key>GID</key>
+													<integer>0</integer>
+													<key>PATH</key>
 													<string>resources/bin/update-sort-bed-migrate-candidates</string>
 													<key>PATH_TYPE</key>
 													<integer>1</integer>
@@ -3590,6 +3792,38 @@
 													<key>GID</key>
 													<integer>0</integer>
 													<key>PATH</key>
+													<string>resources/bin/update-sort-bed-migrate-candidates-megarow</string>
+													<key>PATH_TYPE</key>
+													<integer>1</integer>
+													<key>PERMISSIONS</key>
+													<integer>493</integer>
+													<key>TYPE</key>
+													<integer>3</integer>
+													<key>UID</key>
+													<integer>0</integer>
+												</dict>
+												<dict>
+													<key>CHILDREN</key>
+													<array/>
+													<key>GID</key>
+													<integer>0</integer>
+													<key>PATH</key>
+													<string>resources/bin/update-sort-bed-migrate-candidates-typical</string>
+													<key>PATH_TYPE</key>
+													<integer>1</integer>
+													<key>PERMISSIONS</key>
+													<integer>493</integer>
+													<key>TYPE</key>
+													<integer>3</integer>
+													<key>UID</key>
+													<integer>0</integer>
+												</dict>
+												<dict>
+													<key>CHILDREN</key>
+													<array/>
+													<key>GID</key>
+													<integer>0</integer>
+													<key>PATH</key>
 													<string>resources/bin/update-sort-bed-slurm</string>
 													<key>PATH_TYPE</key>
 													<integer>1</integer>
@@ -3606,6 +3840,38 @@
 													<key>GID</key>
 													<integer>0</integer>
 													<key>PATH</key>
+													<string>resources/bin/update-sort-bed-slurm-megarow</string>
+													<key>PATH_TYPE</key>
+													<integer>1</integer>
+													<key>PERMISSIONS</key>
+													<integer>493</integer>
+													<key>TYPE</key>
+													<integer>3</integer>
+													<key>UID</key>
+													<integer>0</integer>
+												</dict>
+												<dict>
+													<key>CHILDREN</key>
+													<array/>
+													<key>GID</key>
+													<integer>0</integer>
+													<key>PATH</key>
+													<string>resources/bin/update-sort-bed-slurm-typical</string>
+													<key>PATH_TYPE</key>
+													<integer>1</integer>
+													<key>PERMISSIONS</key>
+													<integer>493</integer>
+													<key>TYPE</key>
+													<integer>3</integer>
+													<key>UID</key>
+													<integer>0</integer>
+												</dict>
+												<dict>
+													<key>CHILDREN</key>
+													<array/>
+													<key>GID</key>
+													<integer>0</integer>
+													<key>PATH</key>
 													<string>resources/bin/update-sort-bed-starch-slurm</string>
 													<key>PATH_TYPE</key>
 													<integer>1</integer>
@@ -3616,22 +3882,54 @@
 													<key>UID</key>
 													<integer>0</integer>
 												</dict>
-											</array>
-											<key>GID</key>
-											<integer>0</integer>
-											<key>PATH</key>
-											<string>bin</string>
-											<key>PATH_TYPE</key>
-											<integer>0</integer>
-											<key>PERMISSIONS</key>
-											<integer>493</integer>
-											<key>TYPE</key>
-											<integer>2</integer>
-											<key>UID</key>
-											<integer>0</integer>
-										</dict>
-									</array>
-									<key>GID</key>
+												<dict>
+													<key>CHILDREN</key>
+													<array/>
+													<key>GID</key>
+													<integer>0</integer>
+													<key>PATH</key>
+													<string>resources/bin/update-sort-bed-starch-slurm-megarow</string>
+													<key>PATH_TYPE</key>
+													<integer>1</integer>
+													<key>PERMISSIONS</key>
+													<integer>493</integer>
+													<key>TYPE</key>
+													<integer>3</integer>
+													<key>UID</key>
+													<integer>0</integer>
+												</dict>
+												<dict>
+													<key>CHILDREN</key>
+													<array/>
+													<key>GID</key>
+													<integer>0</integer>
+													<key>PATH</key>
+													<string>resources/bin/update-sort-bed-starch-slurm-typical</string>
+													<key>PATH_TYPE</key>
+													<integer>1</integer>
+													<key>PERMISSIONS</key>
+													<integer>493</integer>
+													<key>TYPE</key>
+													<integer>3</integer>
+													<key>UID</key>
+													<integer>0</integer>
+												</dict>
+											</array>
+											<key>GID</key>
+											<integer>0</integer>
+											<key>PATH</key>
+											<string>bin</string>
+											<key>PATH_TYPE</key>
+											<integer>0</integer>
+											<key>PERMISSIONS</key>
+											<integer>493</integer>
+											<key>TYPE</key>
+											<integer>2</integer>
+											<key>UID</key>
+											<integer>0</integer>
+										</dict>
+									</array>
+									<key>GID</key>
 									<integer>0</integer>
 									<key>PATH</key>
 									<string>local</string>
@@ -3690,6 +3988,8 @@
 				<integer>1</integer>
 				<key>CONCLUSION_ACTION</key>
 				<integer>0</integer>
+				<key>FOLLOW_SYMBOLIC_LINKS</key>
+				<true/>
 				<key>IDENTIFIER</key>
 				<string>org.uwencode.bedops.sort-bed</string>
 				<key>LOCATION</key>
@@ -4183,6 +4483,70 @@
 													<key>GID</key>
 													<integer>0</integer>
 													<key>PATH</key>
+													<string>resources/bin/starch-diff-megarow</string>
+													<key>PATH_TYPE</key>
+													<integer>1</integer>
+													<key>PERMISSIONS</key>
+													<integer>493</integer>
+													<key>TYPE</key>
+													<integer>3</integer>
+													<key>UID</key>
+													<integer>0</integer>
+												</dict>
+												<dict>
+													<key>CHILDREN</key>
+													<array/>
+													<key>GID</key>
+													<integer>0</integer>
+													<key>PATH</key>
+													<string>resources/bin/starch-diff-typical</string>
+													<key>PATH_TYPE</key>
+													<integer>1</integer>
+													<key>PERMISSIONS</key>
+													<integer>493</integer>
+													<key>TYPE</key>
+													<integer>3</integer>
+													<key>UID</key>
+													<integer>0</integer>
+												</dict>
+												<dict>
+													<key>CHILDREN</key>
+													<array/>
+													<key>GID</key>
+													<integer>0</integer>
+													<key>PATH</key>
+													<string>resources/bin/starch-megarow</string>
+													<key>PATH_TYPE</key>
+													<integer>1</integer>
+													<key>PERMISSIONS</key>
+													<integer>493</integer>
+													<key>TYPE</key>
+													<integer>3</integer>
+													<key>UID</key>
+													<integer>0</integer>
+												</dict>
+												<dict>
+													<key>CHILDREN</key>
+													<array/>
+													<key>GID</key>
+													<integer>0</integer>
+													<key>PATH</key>
+													<string>resources/bin/starch-typical</string>
+													<key>PATH_TYPE</key>
+													<integer>1</integer>
+													<key>PERMISSIONS</key>
+													<integer>493</integer>
+													<key>TYPE</key>
+													<integer>3</integer>
+													<key>UID</key>
+													<integer>0</integer>
+												</dict>
+												<dict>
+													<key>CHILDREN</key>
+													<array/>
+													<key>GID</key>
+													<integer>0</integer>
+													<key>PATH</key>
 													<string>resources/bin/starchcat</string>
 													<key>PATH_TYPE</key>
 													<integer>1</integer>
@@ -4199,6 +4563,38 @@
 													<key>GID</key>
 													<integer>0</integer>
 													<key>PATH</key>
+													<string>resources/bin/starchcat-megarow</string>
+													<key>PATH_TYPE</key>
+													<integer>1</integer>
+													<key>PERMISSIONS</key>
+													<integer>493</integer>
+													<key>TYPE</key>
+													<integer>3</integer>
+													<key>UID</key>
+													<integer>0</integer>
+												</dict>
+												<dict>
+													<key>CHILDREN</key>
+													<array/>
+													<key>GID</key>
+													<integer>0</integer>
+													<key>PATH</key>
+													<string>resources/bin/starchcat-typical</string>
+													<key>PATH_TYPE</key>
+													<integer>1</integer>
+													<key>PERMISSIONS</key>
+													<integer>493</integer>
+													<key>TYPE</key>
+													<integer>3</integer>
+													<key>UID</key>
+													<integer>0</integer>
+												</dict>
+												<dict>
+													<key>CHILDREN</key>
+													<array/>
+													<key>GID</key>
+													<integer>0</integer>
+													<key>PATH</key>
 													<string>resources/bin/starchstrip</string>
 													<key>PATH_TYPE</key>
 													<integer>1</integer>
@@ -4215,6 +4611,38 @@
 													<key>GID</key>
 													<integer>0</integer>
 													<key>PATH</key>
+													<string>resources/bin/starchstrip-megarow</string>
+													<key>PATH_TYPE</key>
+													<integer>1</integer>
+													<key>PERMISSIONS</key>
+													<integer>493</integer>
+													<key>TYPE</key>
+													<integer>3</integer>
+													<key>UID</key>
+													<integer>0</integer>
+												</dict>
+												<dict>
+													<key>CHILDREN</key>
+													<array/>
+													<key>GID</key>
+													<integer>0</integer>
+													<key>PATH</key>
+													<string>resources/bin/starchstrip-typical</string>
+													<key>PATH_TYPE</key>
+													<integer>1</integer>
+													<key>PERMISSIONS</key>
+													<integer>493</integer>
+													<key>TYPE</key>
+													<integer>3</integer>
+													<key>UID</key>
+													<integer>0</integer>
+												</dict>
+												<dict>
+													<key>CHILDREN</key>
+													<array/>
+													<key>GID</key>
+													<integer>0</integer>
+													<key>PATH</key>
 													<string>resources/bin/unstarch</string>
 													<key>PATH_TYPE</key>
 													<integer>1</integer>
@@ -4225,6 +4653,38 @@
 													<key>UID</key>
 													<integer>0</integer>
 												</dict>
+												<dict>
+													<key>CHILDREN</key>
+													<array/>
+													<key>GID</key>
+													<integer>0</integer>
+													<key>PATH</key>
+													<string>resources/bin/unstarch-megarow</string>
+													<key>PATH_TYPE</key>
+													<integer>1</integer>
+													<key>PERMISSIONS</key>
+													<integer>493</integer>
+													<key>TYPE</key>
+													<integer>3</integer>
+													<key>UID</key>
+													<integer>0</integer>
+												</dict>
+												<dict>
+													<key>CHILDREN</key>
+													<array/>
+													<key>GID</key>
+													<integer>0</integer>
+													<key>PATH</key>
+													<string>resources/bin/unstarch-typical</string>
+													<key>PATH_TYPE</key>
+													<integer>1</integer>
+													<key>PERMISSIONS</key>
+													<integer>493</integer>
+													<key>TYPE</key>
+													<integer>3</integer>
+													<key>UID</key>
+													<integer>0</integer>
+												</dict>
 											</array>
 											<key>GID</key>
 											<integer>0</integer>
@@ -4299,6 +4759,8 @@
 				<integer>1</integer>
 				<key>CONCLUSION_ACTION</key>
 				<integer>0</integer>
+				<key>FOLLOW_SYMBOLIC_LINKS</key>
+				<true/>
 				<key>IDENTIFIER</key>
 				<string>org.uwencode.bedops.starch</string>
 				<key>LOCATION</key>
@@ -4776,6 +5238,38 @@
 													<key>GID</key>
 													<integer>0</integer>
 													<key>PATH</key>
+													<string>resources/bin/starchcluster_gnuParallel-megarow</string>
+													<key>PATH_TYPE</key>
+													<integer>1</integer>
+													<key>PERMISSIONS</key>
+													<integer>493</integer>
+													<key>TYPE</key>
+													<integer>3</integer>
+													<key>UID</key>
+													<integer>0</integer>
+												</dict>
+												<dict>
+													<key>CHILDREN</key>
+													<array/>
+													<key>GID</key>
+													<integer>0</integer>
+													<key>PATH</key>
+													<string>resources/bin/starchcluster_gnuParallel-typical</string>
+													<key>PATH_TYPE</key>
+													<integer>1</integer>
+													<key>PERMISSIONS</key>
+													<integer>493</integer>
+													<key>TYPE</key>
+													<integer>3</integer>
+													<key>UID</key>
+													<integer>0</integer>
+												</dict>
+												<dict>
+													<key>CHILDREN</key>
+													<array/>
+													<key>GID</key>
+													<integer>0</integer>
+													<key>PATH</key>
 													<string>resources/bin/starchcluster_sge</string>
 													<key>PATH_TYPE</key>
 													<integer>1</integer>
@@ -4792,6 +5286,38 @@
 													<key>GID</key>
 													<integer>0</integer>
 													<key>PATH</key>
+													<string>resources/bin/starchcluster_sge-megarow</string>
+													<key>PATH_TYPE</key>
+													<integer>1</integer>
+													<key>PERMISSIONS</key>
+													<integer>493</integer>
+													<key>TYPE</key>
+													<integer>3</integer>
+													<key>UID</key>
+													<integer>0</integer>
+												</dict>
+												<dict>
+													<key>CHILDREN</key>
+													<array/>
+													<key>GID</key>
+													<integer>0</integer>
+													<key>PATH</key>
+													<string>resources/bin/starchcluster_sge-typical</string>
+													<key>PATH_TYPE</key>
+													<integer>1</integer>
+													<key>PERMISSIONS</key>
+													<integer>493</integer>
+													<key>TYPE</key>
+													<integer>3</integer>
+													<key>UID</key>
+													<integer>0</integer>
+												</dict>
+												<dict>
+													<key>CHILDREN</key>
+													<array/>
+													<key>GID</key>
+													<integer>0</integer>
+													<key>PATH</key>
 													<string>resources/bin/starchcluster_slurm</string>
 													<key>PATH_TYPE</key>
 													<integer>1</integer>
@@ -4802,6 +5328,552 @@
 													<key>UID</key>
 													<integer>0</integer>
 												</dict>
+												<dict>
+													<key>CHILDREN</key>
+													<array/>
+													<key>GID</key>
+													<integer>0</integer>
+													<key>PATH</key>
+													<string>resources/bin/starchcluster_slurm-megarow</string>
+													<key>PATH_TYPE</key>
+													<integer>1</integer>
+													<key>PERMISSIONS</key>
+													<integer>493</integer>
+													<key>TYPE</key>
+													<integer>3</integer>
+													<key>UID</key>
+													<integer>0</integer>
+												</dict>
+												<dict>
+													<key>CHILDREN</key>
+													<array/>
+													<key>GID</key>
+													<integer>0</integer>
+													<key>PATH</key>
+													<string>resources/bin/starchcluster_slurm-typical</string>
+													<key>PATH_TYPE</key>
+													<integer>1</integer>
+													<key>PERMISSIONS</key>
+													<integer>493</integer>
+													<key>TYPE</key>
+													<integer>3</integer>
+													<key>UID</key>
+													<integer>0</integer>
+												</dict>
+											</array>
+											<key>GID</key>
+											<integer>0</integer>
+											<key>PATH</key>
+											<string>bin</string>
+											<key>PATH_TYPE</key>
+											<integer>0</integer>
+											<key>PERMISSIONS</key>
+											<integer>493</integer>
+											<key>TYPE</key>
+											<integer>2</integer>
+											<key>UID</key>
+											<integer>0</integer>
+										</dict>
+									</array>
+									<key>GID</key>
+									<integer>0</integer>
+									<key>PATH</key>
+									<string>local</string>
+									<key>PATH_TYPE</key>
+									<integer>0</integer>
+									<key>PERMISSIONS</key>
+									<integer>493</integer>
+									<key>TYPE</key>
+									<integer>2</integer>
+									<key>UID</key>
+									<integer>0</integer>
+								</dict>
+							</array>
+							<key>GID</key>
+							<integer>0</integer>
+							<key>PATH</key>
+							<string>usr</string>
+							<key>PATH_TYPE</key>
+							<integer>0</integer>
+							<key>PERMISSIONS</key>
+							<integer>493</integer>
+							<key>TYPE</key>
+							<integer>2</integer>
+							<key>UID</key>
+							<integer>0</integer>
+						</dict>
+					</array>
+					<key>GID</key>
+					<integer>0</integer>
+					<key>PATH</key>
+					<string>/</string>
+					<key>PATH_TYPE</key>
+					<integer>0</integer>
+					<key>PERMISSIONS</key>
+					<integer>493</integer>
+					<key>TYPE</key>
+					<integer>1</integer>
+					<key>UID</key>
+					<integer>0</integer>
+				</dict>
+				<key>PAYLOAD_TYPE</key>
+				<integer>0</integer>
+				<key>VERSION</key>
+				<integer>2</integer>
+			</dict>
+			<key>PACKAGE_SCRIPTS</key>
+			<dict>
+				<key>POSTINSTALL_PATH</key>
+				<dict/>
+				<key>PREINSTALL_PATH</key>
+				<dict/>
+				<key>RESOURCES</key>
+				<array/>
+			</dict>
+			<key>PACKAGE_SETTINGS</key>
+			<dict>
+				<key>AUTHENTICATION</key>
+				<integer>1</integer>
+				<key>CONCLUSION_ACTION</key>
+				<integer>0</integer>
+				<key>FOLLOW_SYMBOLIC_LINKS</key>
+				<true/>
+				<key>IDENTIFIER</key>
+				<string>org.uwencode.bedops.starchcluster</string>
+				<key>LOCATION</key>
+				<integer>0</integer>
+				<key>NAME</key>
+				<string>starchcluster</string>
+				<key>OVERWRITE_PERMISSIONS</key>
+				<false/>
+				<key>VERSION</key>
+				<string>1.0</string>
+			</dict>
+			<key>TYPE</key>
+			<integer>0</integer>
+			<key>UUID</key>
+			<string>F995F366-BC68-4AC7-B2AE-C7C05BAF635D</string>
+		</dict>
+		<dict>
+			<key>PACKAGE_FILES</key>
+			<dict>
+				<key>DEFAULT_INSTALL_LOCATION</key>
+				<string>/</string>
+				<key>HIERARCHY</key>
+				<dict>
+					<key>CHILDREN</key>
+					<array>
+						<dict>
+							<key>CHILDREN</key>
+							<array/>
+							<key>GID</key>
+							<integer>80</integer>
+							<key>PATH</key>
+							<string>Applications</string>
+							<key>PATH_TYPE</key>
+							<integer>0</integer>
+							<key>PERMISSIONS</key>
+							<integer>509</integer>
+							<key>TYPE</key>
+							<integer>1</integer>
+							<key>UID</key>
+							<integer>0</integer>
+						</dict>
+						<dict>
+							<key>CHILDREN</key>
+							<array>
+								<dict>
+									<key>CHILDREN</key>
+									<array/>
+									<key>GID</key>
+									<integer>80</integer>
+									<key>PATH</key>
+									<string>Application Support</string>
+									<key>PATH_TYPE</key>
+									<integer>0</integer>
+									<key>PERMISSIONS</key>
+									<integer>493</integer>
+									<key>TYPE</key>
+									<integer>1</integer>
+									<key>UID</key>
+									<integer>0</integer>
+								</dict>
+								<dict>
+									<key>CHILDREN</key>
+									<array/>
+									<key>GID</key>
+									<integer>0</integer>
+									<key>PATH</key>
+									<string>Automator</string>
+									<key>PATH_TYPE</key>
+									<integer>0</integer>
+									<key>PERMISSIONS</key>
+									<integer>493</integer>
+									<key>TYPE</key>
+									<integer>1</integer>
+									<key>UID</key>
+									<integer>0</integer>
+								</dict>
+								<dict>
+									<key>CHILDREN</key>
+									<array/>
+									<key>GID</key>
+									<integer>0</integer>
+									<key>PATH</key>
+									<string>Documentation</string>
+									<key>PATH_TYPE</key>
+									<integer>0</integer>
+									<key>PERMISSIONS</key>
+									<integer>493</integer>
+									<key>TYPE</key>
+									<integer>1</integer>
+									<key>UID</key>
+									<integer>0</integer>
+								</dict>
+								<dict>
+									<key>CHILDREN</key>
+									<array/>
+									<key>GID</key>
+									<integer>0</integer>
+									<key>PATH</key>
+									<string>Extensions</string>
+									<key>PATH_TYPE</key>
+									<integer>0</integer>
+									<key>PERMISSIONS</key>
+									<integer>493</integer>
+									<key>TYPE</key>
+									<integer>1</integer>
+									<key>UID</key>
+									<integer>0</integer>
+								</dict>
+								<dict>
+									<key>CHILDREN</key>
+									<array/>
+									<key>GID</key>
+									<integer>0</integer>
+									<key>PATH</key>
+									<string>Filesystems</string>
+									<key>PATH_TYPE</key>
+									<integer>0</integer>
+									<key>PERMISSIONS</key>
+									<integer>493</integer>
+									<key>TYPE</key>
+									<integer>1</integer>
+									<key>UID</key>
+									<integer>0</integer>
+								</dict>
+								<dict>
+									<key>CHILDREN</key>
+									<array/>
+									<key>GID</key>
+									<integer>0</integer>
+									<key>PATH</key>
+									<string>Frameworks</string>
+									<key>PATH_TYPE</key>
+									<integer>0</integer>
+									<key>PERMISSIONS</key>
+									<integer>493</integer>
+									<key>TYPE</key>
+									<integer>1</integer>
+									<key>UID</key>
+									<integer>0</integer>
+								</dict>
+								<dict>
+									<key>CHILDREN</key>
+									<array/>
+									<key>GID</key>
+									<integer>0</integer>
+									<key>PATH</key>
+									<string>Input Methods</string>
+									<key>PATH_TYPE</key>
+									<integer>0</integer>
+									<key>PERMISSIONS</key>
+									<integer>493</integer>
+									<key>TYPE</key>
+									<integer>1</integer>
+									<key>UID</key>
+									<integer>0</integer>
+								</dict>
+								<dict>
+									<key>CHILDREN</key>
+									<array/>
+									<key>GID</key>
+									<integer>0</integer>
+									<key>PATH</key>
+									<string>Internet Plug-Ins</string>
+									<key>PATH_TYPE</key>
+									<integer>0</integer>
+									<key>PERMISSIONS</key>
+									<integer>493</integer>
+									<key>TYPE</key>
+									<integer>1</integer>
+									<key>UID</key>
+									<integer>0</integer>
+								</dict>
+								<dict>
+									<key>CHILDREN</key>
+									<array/>
+									<key>GID</key>
+									<integer>0</integer>
+									<key>PATH</key>
+									<string>LaunchAgents</string>
+									<key>PATH_TYPE</key>
+									<integer>0</integer>
+									<key>PERMISSIONS</key>
+									<integer>493</integer>
+									<key>TYPE</key>
+									<integer>1</integer>
+									<key>UID</key>
+									<integer>0</integer>
+								</dict>
+								<dict>
+									<key>CHILDREN</key>
+									<array/>
+									<key>GID</key>
+									<integer>0</integer>
+									<key>PATH</key>
+									<string>LaunchDaemons</string>
+									<key>PATH_TYPE</key>
+									<integer>0</integer>
+									<key>PERMISSIONS</key>
+									<integer>493</integer>
+									<key>TYPE</key>
+									<integer>1</integer>
+									<key>UID</key>
+									<integer>0</integer>
+								</dict>
+								<dict>
+									<key>CHILDREN</key>
+									<array/>
+									<key>GID</key>
+									<integer>0</integer>
+									<key>PATH</key>
+									<string>PreferencePanes</string>
+									<key>PATH_TYPE</key>
+									<integer>0</integer>
+									<key>PERMISSIONS</key>
+									<integer>493</integer>
+									<key>TYPE</key>
+									<integer>1</integer>
+									<key>UID</key>
+									<integer>0</integer>
+								</dict>
+								<dict>
+									<key>CHILDREN</key>
+									<array/>
+									<key>GID</key>
+									<integer>0</integer>
+									<key>PATH</key>
+									<string>Preferences</string>
+									<key>PATH_TYPE</key>
+									<integer>0</integer>
+									<key>PERMISSIONS</key>
+									<integer>493</integer>
+									<key>TYPE</key>
+									<integer>1</integer>
+									<key>UID</key>
+									<integer>0</integer>
+								</dict>
+								<dict>
+									<key>CHILDREN</key>
+									<array/>
+									<key>GID</key>
+									<integer>80</integer>
+									<key>PATH</key>
+									<string>Printers</string>
+									<key>PATH_TYPE</key>
+									<integer>0</integer>
+									<key>PERMISSIONS</key>
+									<integer>493</integer>
+									<key>TYPE</key>
+									<integer>1</integer>
+									<key>UID</key>
+									<integer>0</integer>
+								</dict>
+								<dict>
+									<key>CHILDREN</key>
+									<array/>
+									<key>GID</key>
+									<integer>0</integer>
+									<key>PATH</key>
+									<string>PrivilegedHelperTools</string>
+									<key>PATH_TYPE</key>
+									<integer>0</integer>
+									<key>PERMISSIONS</key>
+									<integer>493</integer>
+									<key>TYPE</key>
+									<integer>1</integer>
+									<key>UID</key>
+									<integer>0</integer>
+								</dict>
+								<dict>
+									<key>CHILDREN</key>
+									<array/>
+									<key>GID</key>
+									<integer>0</integer>
+									<key>PATH</key>
+									<string>QuickLook</string>
+									<key>PATH_TYPE</key>
+									<integer>0</integer>
+									<key>PERMISSIONS</key>
+									<integer>493</integer>
+									<key>TYPE</key>
+									<integer>1</integer>
+									<key>UID</key>
+									<integer>0</integer>
+								</dict>
+								<dict>
+									<key>CHILDREN</key>
+									<array/>
+									<key>GID</key>
+									<integer>0</integer>
+									<key>PATH</key>
+									<string>QuickTime</string>
+									<key>PATH_TYPE</key>
+									<integer>0</integer>
+									<key>PERMISSIONS</key>
+									<integer>493</integer>
+									<key>TYPE</key>
+									<integer>1</integer>
+									<key>UID</key>
+									<integer>0</integer>
+								</dict>
+								<dict>
+									<key>CHILDREN</key>
+									<array/>
+									<key>GID</key>
+									<integer>0</integer>
+									<key>PATH</key>
+									<string>Screen Savers</string>
+									<key>PATH_TYPE</key>
+									<integer>0</integer>
+									<key>PERMISSIONS</key>
+									<integer>493</integer>
+									<key>TYPE</key>
+									<integer>1</integer>
+									<key>UID</key>
+									<integer>0</integer>
+								</dict>
+								<dict>
+									<key>CHILDREN</key>
+									<array/>
+									<key>GID</key>
+									<integer>0</integer>
+									<key>PATH</key>
+									<string>Scripts</string>
+									<key>PATH_TYPE</key>
+									<integer>0</integer>
+									<key>PERMISSIONS</key>
+									<integer>493</integer>
+									<key>TYPE</key>
+									<integer>1</integer>
+									<key>UID</key>
+									<integer>0</integer>
+								</dict>
+								<dict>
+									<key>CHILDREN</key>
+									<array/>
+									<key>GID</key>
+									<integer>0</integer>
+									<key>PATH</key>
+									<string>Services</string>
+									<key>PATH_TYPE</key>
+									<integer>0</integer>
+									<key>PERMISSIONS</key>
+									<integer>493</integer>
+									<key>TYPE</key>
+									<integer>1</integer>
+									<key>UID</key>
+									<integer>0</integer>
+								</dict>
+								<dict>
+									<key>CHILDREN</key>
+									<array/>
+									<key>GID</key>
+									<integer>0</integer>
+									<key>PATH</key>
+									<string>Widgets</string>
+									<key>PATH_TYPE</key>
+									<integer>0</integer>
+									<key>PERMISSIONS</key>
+									<integer>493</integer>
+									<key>TYPE</key>
+									<integer>1</integer>
+									<key>UID</key>
+									<integer>0</integer>
+								</dict>
+							</array>
+							<key>GID</key>
+							<integer>0</integer>
+							<key>PATH</key>
+							<string>Library</string>
+							<key>PATH_TYPE</key>
+							<integer>0</integer>
+							<key>PERMISSIONS</key>
+							<integer>493</integer>
+							<key>TYPE</key>
+							<integer>1</integer>
+							<key>UID</key>
+							<integer>0</integer>
+						</dict>
+						<dict>
+							<key>CHILDREN</key>
+							<array>
+								<dict>
+									<key>CHILDREN</key>
+									<array/>
+									<key>GID</key>
+									<integer>0</integer>
+									<key>PATH</key>
+									<string>Shared</string>
+									<key>PATH_TYPE</key>
+									<integer>0</integer>
+									<key>PERMISSIONS</key>
+									<integer>1023</integer>
+									<key>TYPE</key>
+									<integer>1</integer>
+									<key>UID</key>
+									<integer>0</integer>
+								</dict>
+							</array>
+							<key>GID</key>
+							<integer>80</integer>
+							<key>PATH</key>
+							<string>Users</string>
+							<key>PATH_TYPE</key>
+							<integer>0</integer>
+							<key>PERMISSIONS</key>
+							<integer>493</integer>
+							<key>TYPE</key>
+							<integer>1</integer>
+							<key>UID</key>
+							<integer>0</integer>
+						</dict>
+						<dict>
+							<key>CHILDREN</key>
+							<array>
+								<dict>
+									<key>CHILDREN</key>
+									<array>
+										<dict>
+											<key>CHILDREN</key>
+											<array>
+												<dict>
+													<key>CHILDREN</key>
+													<array/>
+													<key>GID</key>
+													<integer>0</integer>
+													<key>PATH</key>
+													<string>resources/bin/switch-BEDOPS-binary-type</string>
+													<key>PATH_TYPE</key>
+													<integer>1</integer>
+													<key>PERMISSIONS</key>
+													<integer>493</integer>
+													<key>TYPE</key>
+													<integer>3</integer>
+													<key>UID</key>
+													<integer>0</integer>
+												</dict>
 											</array>
 											<key>GID</key>
 											<integer>0</integer>
@@ -4861,14 +5933,10 @@
 				<key>PAYLOAD_TYPE</key>
 				<integer>0</integer>
 				<key>VERSION</key>
-				<integer>2</integer>
+				<integer>4</integer>
 			</dict>
 			<key>PACKAGE_SCRIPTS</key>
 			<dict>
-				<key>POSTINSTALL_PATH</key>
-				<dict/>
-				<key>PREINSTALL_PATH</key>
-				<dict/>
 				<key>RESOURCES</key>
 				<array/>
 			</dict>
@@ -4878,12 +5946,14 @@
 				<integer>1</integer>
 				<key>CONCLUSION_ACTION</key>
 				<integer>0</integer>
+				<key>FOLLOW_SYMBOLIC_LINKS</key>
+				<true/>
 				<key>IDENTIFIER</key>
-				<string>org.uwencode.bedops.starchcluster</string>
+				<string>org.uwencode.bedops.switch-binary-type</string>
 				<key>LOCATION</key>
 				<integer>0</integer>
 				<key>NAME</key>
-				<string>starchcluster</string>
+				<string>binary-type selection</string>
 				<key>OVERWRITE_PERMISSIONS</key>
 				<false/>
 				<key>VERSION</key>
@@ -4892,7 +5962,7 @@
 			<key>TYPE</key>
 			<integer>0</integer>
 			<key>UUID</key>
-			<string>F995F366-BC68-4AC7-B2AE-C7C05BAF635D</string>
+			<string>A54C7634-8547-497B-8024-9E7FC4B8756D</string>
 		</dict>
 	</array>
 	<key>PROJECT</key>
@@ -5206,7 +6276,7 @@
 										<key>LANGUAGE</key>
 										<string>English</string>
 										<key>VALUE</key>
-										<string>This package installs the SGE- (Sun Grid Engine) and GNU Parallels-based starchcluster scripts, which parallelize Starch v2 archive creation.</string>
+										<string>This package installs Slurm-, SGE- (Sun Grid Engine) and GNU Parallels-based starchcluster scripts, which parallelize Starch v2 archive creation.</string>
 									</dict>
 								</array>
 								<key>OPTIONS</key>
@@ -5236,6 +6306,43 @@
 								<key>UUID</key>
 								<string>BB83605B-AB9C-4E69-BF71-DA3A9A013506</string>
 							</dict>
+							<dict>
+								<key>DESCRIPTION</key>
+								<array>
+									<dict>
+										<key>LANGUAGE</key>
+										<string>English</string>
+										<key>VALUE</key>
+										<string>Allows easy switching between 'typical' and 'megarow' builds of BEDOPS binaries</string>
+									</dict>
+								</array>
+								<key>OPTIONS</key>
+								<dict>
+									<key>HIDDEN</key>
+									<false/>
+									<key>STATE</key>
+									<integer>1</integer>
+								</dict>
+								<key>PACKAGE_UUID</key>
+								<string>A54C7634-8547-497B-8024-9E7FC4B8756D</string>
+								<key>REQUIREMENTS</key>
+								<array/>
+								<key>TITLE</key>
+								<array>
+									<dict>
+										<key>LANGUAGE</key>
+										<string>English</string>
+										<key>VALUE</key>
+										<string>binary-type selection</string>
+									</dict>
+								</array>
+								<key>TOOLTIP</key>
+								<array/>
+								<key>TYPE</key>
+								<integer>0</integer>
+								<key>UUID</key>
+								<string>2FE0AE7E-84B4-4FD9-BAAF-A1B3D1A1D6C0</string>
+							</dict>
 						</array>
 						<key>REMOVED</key>
 						<dict/>
@@ -5359,7 +6466,7 @@
 						<key>LANGUAGE</key>
 						<string>English</string>
 						<key>VALUE</key>
-						<string>BEDOPS 2.4.26</string>
+						<string>BEDOPS 2.4.28</string>
 					</dict>
 				</array>
 			</dict>
@@ -5378,7 +6485,7 @@
 						<key>IC_REQUIREMENT_OS_DISTRIBUTION_TYPE</key>
 						<integer>0</integer>
 						<key>IC_REQUIREMENT_OS_MINIMUM_VERSION</key>
-						<integer>100700</integer>
+						<integer>101000</integer>
 					</dict>
 					<key>IC_REQUIREMENT_CHECK_TYPE</key>
 					<integer>1</integer>
@@ -5390,7 +6497,7 @@
 							<key>LANGUAGE</key>
 							<string>English</string>
 							<key>VALUE</key>
-							<string>This installer requires at least Mac OS X 10.7</string>
+							<string>This installer requires at least Mac OS X 10.10</string>
 						</dict>
 					</array>
 					<key>NAME</key>
@@ -5398,38 +6505,6 @@
 					<key>STATE</key>
 					<true/>
 				</dict>
-				<dict>
-					<key>BEHAVIOR</key>
-					<integer>3</integer>
-					<key>DICTIONARY</key>
-					<dict>
-						<key>IC_REQUIREMENT_OS_DISK_TYPE</key>
-						<integer>0</integer>
-						<key>IC_REQUIREMENT_OS_DISTRIBUTION_TYPE</key>
-						<integer>0</integer>
-						<key>IC_REQUIREMENT_OS_MINIMUM_VERSION</key>
-						<integer>100700</integer>
-					</dict>
-					<key>IC_REQUIREMENT_CHECK_TYPE</key>
-					<integer>1</integer>
-					<key>IDENTIFIER</key>
-					<string>fr.whitebox.Packages.requirement.os</string>
-					<key>MESSAGE</key>
-					<array>
-						<dict>
-							<key>LANGUAGE</key>
-							<string>English</string>
-							<key>SECONDARY_VALUE</key>
-							<string>BEDOPS for Mac OS X requires an Intel processor</string>
-							<key>VALUE</key>
-							<string>Processor requirement</string>
-						</dict>
-					</array>
-					<key>NAME</key>
-					<string>Processor</string>
-					<key>STATE</key>
-					<true/>
-				</dict>
 			</array>
 			<key>POSTINSTALL_PATH</key>
 			<dict/>
@@ -5622,7 +6697,7 @@
 				</dict>
 			</array>
 			<key>NAME</key>
-			<string>BEDOPS 2.4.26</string>
+			<string>BEDOPS 2.4.28</string>
 		</dict>
 	</dict>
 	<key>TYPE</key>
diff --git a/packaging/rpm/Dockerfile b/packaging/rpm/Dockerfile
index 604e049..9ed14f5 100644
--- a/packaging/rpm/Dockerfile
+++ b/packaging/rpm/Dockerfile
@@ -11,9 +11,9 @@ RUN yum -y install tar \
 
 # copy the source context into the local image & build/install
 #  note: make sure .dockerignore is up to date
-RUN mkdir /bedops-2.4.26
-ADD . /bedops-2.4.26
-RUN tar zcf /bedops-2.4.26.tar.gz bedops-2.4.26
-RUN rm -rf /bedops-2.4.26
-RUN rpmbuild -ta bedops-2.4.26.tar.gz
-RUN rm /bedops-2.4.26.tar.gz
+RUN mkdir /bedops-2.4.28
+ADD . /bedops-2.4.28
+RUN tar zcf /bedops-2.4.28.tar.gz bedops-2.4.28
+RUN rm -rf /bedops-2.4.28
+RUN rpmbuild -ta bedops-2.4.28.tar.gz
+RUN rm /bedops-2.4.28.tar.gz
diff --git a/packaging/rpm/bedops.spec b/packaging/rpm/bedops.spec
index 1ec8295..7b67bae 100644
--- a/packaging/rpm/bedops.spec
+++ b/packaging/rpm/bedops.spec
@@ -1,5 +1,5 @@
 Name:           bedops
-Version:        2.4.26
+Version:        2.4.28
 Release:        1
 Summary:        A suite of tools to address common questions raised in genomic studies.
 Group:          Applications/Productivity
diff --git a/system.mk/Makefile.darwin b/system.mk/Makefile.darwin
index 14979fe..ba21929 100644
--- a/system.mk/Makefile.darwin
+++ b/system.mk/Makefile.darwin
@@ -1,204 +1,82 @@
-PARTY3           = third-party
-BZIP2VERSION     = bzip2-1.0.6
-WHICHBZIP2      := ${PARTY3}/${BZIP2VERSION}
-JANSSONVERSION   = jansson-2.6
-WHICHJANSSON    := ${PARTY3}/${JANSSONVERSION}
-ZLIBVERSION      = zlib-1.2.7
-WHICHZLIB       := ${PARTY3}/${ZLIBVERSION}
-APPDIR           = applications/bed
-BINDIR           = bin
-OSXPKGROOT       = packaging/os_x
-OSXBUILDDIR      = ${OSXPKGROOT}/build
-OSXPKGDIR        = ${OSXPKGROOT}/resources/bin
-OSXLIBDIR        = ${OSXPKGROOT}/resources/lib
-WDIR             = ${shell pwd}
-export CC        = clang
-export CXX       = clang++
-SELF             = ${WDIR}/system.mk/Makefile.darwin
-I386             = darwin_intel_i386
-X86_64           = darwin_intel_x86_64
-
+PARTY3                = third-party
+BZIP2VERSION          = bzip2-1.0.6
+WHICHBZIP2           := ${PARTY3}/${BZIP2VERSION}
+JANSSONVERSION        = jansson-2.6
+WHICHJANSSON         := ${PARTY3}/${JANSSONVERSION}
+ZLIBVERSION           = zlib-1.2.7
+WHICHZLIB            := ${PARTY3}/${ZLIBVERSION}
+APPDIR                = applications/bed
+OSXPKGROOT            = packaging/os_x
+OSXBUILDDIR           = ${OSXPKGROOT}/build
+OSXPKGDIR             = ${OSXPKGROOT}/resources/bin
+OSXLIBDIR             = ${OSXPKGROOT}/resources/lib
+WDIR                  = ${shell pwd}
+export CC             = clang
+export CXX            = clang++
+SELF                  = ${WDIR}/system.mk/Makefile.darwin
+I386                  = darwin_intel_i386
+X86_64                = darwin_intel_x86_64
+MIN_OSX_VERSION       = 10.10
+MEGAROW               = megarow
+TYPICAL               = typical
+BINDIR                = bin
+BINDIR_MODULE         = modules
+BINDIR_MODULE_TYPICAL = ${BINDIR_MODULE}/${TYPICAL}
+BINDIR_MODULE_MEGAROW = ${BINDIR_MODULE}/${MEGAROW}
+
+ifeq ($(BUILD_ARCH),)
+BUILD_ARCH := x86_64
+endif
 
 default: support
 	$(MAKE) build -f $(SELF)
 
 SUBDIRS = bedmap/src sort-bed/src bedops/src closestfeats/src bedextract/src starch/src conversion/src
 SUBDIRS_FULL := $(patsubst %,${APPDIR}/%,$(SUBDIRS))
-SUBDIRS_I386 := $(patsubst %,%_i386,$(SUBDIRS))
-SUBDIRS_X86_64 := $(patsubst %,%_x86_64,$(SUBDIRS))
 
-.PHONY: $(SUBDIRS)
 .PHONY: $(SUBDIRS_FULL)
-.PHONY: $(SUBDIRS_I386)
-.PHONY: $(SUBDIRS_X86_64)
-
-# $@ needs ${APPDIR}/ as a prefix
-$(SUBDIRS):
-	export ARCH=i386 && $(MAKE) -C ${APPDIR}/$@ -f Makefile.darwin $(MAKECMDGOALS)
 
 # $@ has full path info
 $(SUBDIRS_FULL):
-	export ARCH=x86_64 && $(MAKE) -C $@ -f Makefile.darwin $(MAKECMDGOALS)
-
-# prereq is $(SUBDIRS)
-.SECONDEXPANSION:
-$(SUBDIRS_I386): $$(patsubst %_i386,%,$$@)
-
-# prereq is $(SUBDIRS_FULL)
-.SECONDEXPANSION:
-$(SUBDIRS_X86_64): $$(patsubst %_x86_64,${APPDIR}/%,$$@)
+	export ARCH=${BUILD_ARCH} MIN_OSX_VERSION=${MIN_OSX_VERSION} && $(MAKE) -C $@ -f Makefile.darwin $(MAKECMDGOALS)
 
-all: $(SUBDIRS_I386) $(SUBDIRS_X86_64)
+all: $(SUBDIRS_FULL)
 
 build: all
-	$(MAKE) build_fat -f $(SELF)
-
-build_fat: sort_c_intel_fat bedops_c_intel_fat closestfeatures_c_intel_fat bedmap_c_intel_fat bedextract_c_intel_fat convert2bed_c_intel_fat starch_c_intel_fat
 
 debug: support
 	$(MAKE) build_debug -f $(SELF)
 
 build_debug: all
-	$(MAKE) dbg_build_fat -f $(SELF)
-
-dbg_build_fat: dbg_sort_c_intel_fat dbg_bedops_c_intel_fat dbg_closestfeatures_c_intel_fat dbg_bedmap_c_intel_fat dbg_bedextract_c_intel_fat dbg_convert2bed_c_intel_fat dbg_starch_c_intel_fat
 
 #
 # clean ups
 #
 clean: clean_debug clean_gprof all
-	rm -f ${BINDIR}/sort-bed
-	rm -f ${BINDIR}/update-sort-bed-slurm
-	rm -f ${BINDIR}/update-sort-bed-starch-slurm
-	rm -f ${BINDIR}/update-sort-bed-migrate-candidates
-	rm -f ${BINDIR}/bedops
-	rm -f ${BINDIR}/closest-features
-	rm -f ${BINDIR}/bedmap
-	rm -f ${BINDIR}/bedextract
-	rm -f ${BINDIR}/starch
-	rm -f ${BINDIR}/unstarch
-	rm -f ${BINDIR}/starchcat
-	rm -f ${BINDIR}/starchstrip
-	rm -f ${BINDIR}/starchcluster*
-	rm -f ${BINDIR}/starch-diff
-	rm -f ${BINDIR}/bam2bed
-	rm -f ${BINDIR}/bam2bed*
-	rm -f ${BINDIR}/gff2bed
-	rm -f ${BINDIR}/gtf2bed
-	rm -f ${BINDIR}/gvf2bed
-	rm -f ${BINDIR}/psl2bed
-	rm -f ${BINDIR}/rmsk2bed
-	rm -f ${BINDIR}/sam2bed
-	rm -f ${BINDIR}/vcf2bed
-	rm -f ${BINDIR}/wig2bed
-	rm -f ${BINDIR}/convert2bed
-	rm -f ${BINDIR}/bam2starch
-	rm -f ${BINDIR}/bam2starch*
-	rm -f ${BINDIR}/gff2starch
-	rm -f ${BINDIR}/gtf2starch
-	rm -f ${BINDIR}/gvf2starch
-	rm -f ${BINDIR}/psl2starch
-	rm -f ${BINDIR}/rmsk2starch
-	rm -f ${BINDIR}/sam2starch
-	rm -f ${BINDIR}/vcf2starch
-	rm -f ${BINDIR}/wig2starch
-	rm -f ${OSXPKGDIR}/*
-	rm -f ${OSXLIBDIR}/*
-	rm -Rf ${OSXBUILDDIR}/*
+	rm -rf ${BINDIR}
+	rm -rf ${BINDIR_MODULE}
+	rm -rf ${OSXPKGDIR}
+	rm -rf ${OSXLIBDIR}
+	rm -rf ${OSXBUILDDIR}
 	rm -rf ${WHICHBZIP2}
 	rm -f ${PARTY3}/bzip2
 	rm -rf ${WHICHJANSSON}
 	rm -f ${PARTY3}/jansson
 	rm -rf ${WHICHZLIB}
 	rm -f ${PARTY3}/zlib
-	rm -rf ${PARTY3}/$(I386)
-	rm -rf ${PARTY3}/$(X86_64)
-	rm -f ${APPDIR}/starch/bin/*starch*
-	rm -Rf ${BINDIR}
+	rm -rf ${PARTY3}/darwin_intel_${BUILD_ARCH}
 
 clean_debug:
-	rm -f ${BINDIR}/debug.sort-bed
-	rm -f ${BINDIR}/update-sort-bed-slurm
-	rm -f ${BINDIR}/update-sort-bed-starch-slurm
-	rm -f ${BINDIR}/update-sort-bed-migrate-candidates
-	rm -f ${BINDIR}/debug.bedops
-	rm -f ${BINDIR}/debug.closest-features
-	rm -f ${BINDIR}/debug.bedmap
-	rm -f ${BINDIR}/debug.bedextract
-	rm -f ${BINDIR}/debug.starch
-	rm -f ${BINDIR}/debug.unstarch
-	rm -f ${BINDIR}/debug.starchcat
-	rm -f ${BINDIR}/debug.starchstrip
-	rm -f ${BINDIR}/starchcluster*
-	rm -f ${BINDIR}/starch-diff
-	rm -f ${BINDIR}/bam2bed
-	rm -f ${BINDIR}/bam2bed*
-	rm -f ${BINDIR}/gff2bed
-	rm -f ${BINDIR}/gtf2bed
-	rm -f ${BINDIR}/gvf2bed
-	rm -f ${BINDIR}/psl2bed
-	rm -f ${BINDIR}/rmsk2bed
-	rm -f ${BINDIR}/sam2bed
-	rm -f ${BINDIR}/vcf2bed
-	rm -f ${BINDIR}/wig2bed
-	rm -f ${BINDIR}/debug.convert2bed
-	rm -f ${BINDIR}/bam2starch
-	rm -f ${BINDIR}/bam2starch*
-	rm -f ${BINDIR}/gff2starch
-	rm -f ${BINDIR}/gtf2starch
-	rm -f ${BINDIR}/gvf2starch
-	rm -f ${BINDIR}/psl2starch
-	rm -f ${BINDIR}/rmsk2starch
-	rm -f ${BINDIR}/sam2starch
-	rm -f ${BINDIR}/vcf2starch
-	rm -f ${BINDIR}/wig2starch
-	rm -Rf ${BINDIR}
+	rm -rf ${BINDIR}
 
 clean_gprof:
-	rm -f ${BINDIR}/gprof.sort-bed
-	rm -f ${BINDIR}/update-sort-bed-slurm
-	rm -f ${BINDIR}/update-sort-bed-starch-slurm
-	rm -f ${BINDIR}/update-sort-bed-migrate-candidates
-	rm -f ${BINDIR}/gprof.bedops
-	rm -f ${BINDIR}/gprof.closest-features
-	rm -f ${BINDIR}/gprof.bedmap
-	rm -f ${BINDIR}/gprof.bedextract
-	rm -f ${BINDIR}/gprof.starch
-	rm -f ${BINDIR}/gprof.unstarch
-	rm -f ${BINDIR}/gprof.starchcat
-	rm -f ${BINDIR}/gprof.starchstrip
-	rm -f ${BINDIR}/starchcluster*
-	rm -f ${BINDIR}/starch-diff
-	rm -f ${BINDIR}/bam2bed
-	rm -f ${BINDIR}/bam2bed*
-	rm -f ${BINDIR}/gff2bed
-	rm -f ${BINDIR}/gtf2bed
-	rm -f ${BINDIR}/gvf2bed
-	rm -f ${BINDIR}/psl2bed
-	rm -f ${BINDIR}/rmsk2bed
-	rm -f ${BINDIR}/sam2bed
-	rm -f ${BINDIR}/vcf2bed
-	rm -f ${BINDIR}/wig2bed
-	rm -f ${BINDIR}/gprof.convert2bed
-	rm -f ${BINDIR}/bam2starch
-	rm -f ${BINDIR}/bam2starch*
-	rm -f ${BINDIR}/gff2starch
-	rm -f ${BINDIR}/gtf2starch
-	rm -f ${BINDIR}/gvf2starch
-	rm -f ${BINDIR}/psl2starch
-	rm -f ${BINDIR}/rmsk2starch
-	rm -f ${BINDIR}/sam2starch
-	rm -f ${BINDIR}/vcf2starch
-	rm -f ${BINDIR}/wig2starch
-	rm -Rf ${BINDIR}
-	
+	rm -rf ${BINDIR}	
 
 #
 # mkdir's
 #
 mkdirs:
-	mkdir -p ${PARTY3}/$(I386)
-	mkdir -p ${PARTY3}/$(X86_64)
+	mkdir -p ${PARTY3}/darwin_intel_${BUILD_ARCH}
 	mkdir -p ${APPDIR}/sort-bed/bin
 	mkdir -p ${APPDIR}/bedops/bin
 	mkdir -p ${APPDIR}/closestfeats/bin
@@ -211,101 +89,20 @@ mkdirs:
 #
 # third-party libraries
 #
-support_intel_i386: jansson_support_intel_i386_c bzip2_support_intel_i386_c zlib_support_intel_i386_c
-
-support_intel_x86_64: jansson_support_intel_x86_64_c bzip2_support_intel_x86_64_c zlib_support_intel_x86_64_c
-
-support_intel: support_intel_i386 support_intel_x86_64
+support_intel: jansson_support_c bzip2_support_c zlib_support_intel_c
 
 support: | mkdirs
 	$(MAKE) support_intel -f $(SELF)
 
-jansson_support_intel_i386_c:
-	bzcat ${WHICHJANSSON}.tar.bz2 | tar -x -C ${PARTY3}/$(I386)/
-	cd ${PARTY3}/$(I386)/${JANSSONVERSION} && export MACOSX_DEPLOYMENT_TARGET=10.7 && export ARCH=i386 && export CC=${CC} && export CXX=${CXX} && ./configure --prefix=${WDIR}/${PARTY3}/$(I386)/${JANSSONVERSION} CFLAGS="-arch i386" --build="i386" && $(MAKE) && $(MAKE) install && cd ../ && rm -f jansson && ln -sf ${JANSSONVERSION} jansson && cd ${WDIR}
-
-jansson_support_intel_x86_64_c:
-	bzcat ${WHICHJANSSON}.tar.bz2 | tar -x -C ${PARTY3}/$(X86_64)/
-	cd ${PARTY3}/$(X86_64)/${JANSSONVERSION} && export MACOSX_DEPLOYMENT_TARGET=10.7 && export ARCH=x86_64 && export CC=${CC} && export CXX=${CXX} && ./configure --prefix=${WDIR}/${PARTY3}/$(X86_64)/${JANSSONVERSION} CFLAGS="-arch x86_64" --build="x86_64" && $(MAKE) && $(MAKE) install && cd ../ && rm -f jansson && ln -sf ${JANSSONVERSION} jansson && cd ${WDIR}
-
-bzip2_support_intel_i386_c:
-	bzcat ${WHICHBZIP2}.tar.bz2 | tar -x -C ${PARTY3}/$(I386)/
-	cd ${PARTY3}/$(I386)/${BZIP2VERSION} && export MACOSX_DEPLOYMENT_TARGET=10.7 && export ARCH=i386 && export CC=${CC} && export CXX=${CXX} && $(MAKE) -f Makefile.darwin_i386 libbz2.a && cd ../ && rm -f bzip2 && ln -sf ${BZIP2VERSION} bzip2 && cd ${WDIR}
-
-bzip2_support_intel_x86_64_c:
-	bzcat ${WHICHBZIP2}.tar.bz2 | tar -x -C ${PARTY3}/$(X86_64)/
-	cd ${PARTY3}/$(X86_64)/${BZIP2VERSION} && export MACOSX_DEPLOYMENT_TARGET=10.7 && export ARCH=x86_64 && export CC=${CC} && export CXX=${CXX} && $(MAKE) -f Makefile.darwin_x86_64 libbz2.a && cd ../ && rm -f bzip2 && ln -sf ${BZIP2VERSION} bzip2 && cd ${WDIR}
-
-zlib_support_intel_i386_c:
-	bzcat ${WHICHZLIB}.tar.bz2 | tar -x -C ${PARTY3}/$(I386)/
-	cd ${PARTY3}/$(I386)/${ZLIBVERSION} && export MACOSX_DEPLOYMENT_TARGET=10.7 && export ARCH=i386 && export CC=${CC} && export CXX=${CXX} && ./configure --static --archs="-arch i386" && $(MAKE) && cd ../ && rm -f zlib && ln -sf ${ZLIBVERSION} zlib && cd ${WDIR}
-
-zlib_support_intel_x86_64_c:
-	bzcat ${WHICHZLIB}.tar.bz2 | tar -x -C ${PARTY3}/$(X86_64)/
-	cd ${PARTY3}/$(X86_64)/${ZLIBVERSION} && export MACOSX_DEPLOYMENT_TARGET=10.7 && export ARCH=x86_64 && export CC=${CC} && export CXX=${CXX} && ./configure --static --archs="-arch x86_64" && $(MAKE) && cd ../ && rm -f zlib && ln -sf ${ZLIBVERSION} zlib && cd ${WDIR}
-
-
-
-#
-# Darwin fat build targets
-#
-sort_c_intel_fat:
-	-test -e ${APPDIR}/sort-bed/bin/sort-bed_i386 && test -e ${APPDIR}/sort-bed/bin/sort-bed_x86_64 && { lipo -create ${APPDIR}/sort-bed/bin/sort-bed_i386 ${APPDIR}/sort-bed/bin/sort-bed_x86_64 -output ${APPDIR}/sort-bed/bin/sort-bed; }
-
-bedops_c_intel_fat:
-	-test -e ${APPDIR}/bedops/bin/bedops_i386 && test -e ${APPDIR}/bedops/bin/bedops_x86_64 && { lipo -create ${APPDIR}/bedops/bin/bedops_i386 ${APPDIR}/bedops/bin/bedops_x86_64 -output ${APPDIR}/bedops/bin/bedops; }
-
-closestfeatures_c_intel_fat:
-	-test -e ${APPDIR}/closestfeats/bin/closest-features_i386 && test -e ${APPDIR}/closestfeats/bin/closest-features_x86_64 && { lipo -create ${APPDIR}/closestfeats/bin/closest-features_i386 ${APPDIR}/closestfeats/bin/closest-features_x86_64 -output ${APPDIR}/closestfeats/bin/closest-features; }
-
-bedmap_c_intel_fat:
-	-test -e ${APPDIR}/bedmap/bin/bedmap_i386 && test -e ${APPDIR}/bedmap/bin/bedmap_x86_64 && { lipo -create ${APPDIR}/bedmap/bin/bedmap_i386 ${APPDIR}/bedmap/bin/bedmap_x86_64 -output ${APPDIR}/bedmap/bin/bedmap; }
-
-bedextract_c_intel_fat:
-	-test -e ${APPDIR}/bedextract/bin/bedextract_i386 && test -e ${APPDIR}/bedextract/bin/bedextract_x86_64 && { lipo -create ${APPDIR}/bedextract/bin/bedextract_i386 ${APPDIR}/bedextract/bin/bedextract_x86_64 -output ${APPDIR}/bedextract/bin/bedextract; }
-
-convert2bed_c_intel_fat:
-	-test -e ${APPDIR}/conversion/bin/convert2bed_i386 && test -e ${APPDIR}/conversion/bin/convert2bed_x86_64 && { lipo -create ${APPDIR}/conversion/bin/convert2bed_i386 ${APPDIR}/conversion/bin/convert2bed_x86_64 -output ${APPDIR}/conversion/bin/convert2bed; }
-
-starch_c_intel_fat:
-	cp ${APPDIR}/starch/src/starchcluster_sge.tcsh ${APPDIR}/starch/bin/starchcluster_sge
-	cp ${APPDIR}/starch/src/starchcluster_gnuParallel.tcsh ${APPDIR}/starch/bin/starchcluster_gnuParallel
-	cp ${APPDIR}/starch/src/starchcluster_slurm.tcsh ${APPDIR}/starch/bin/starchcluster_slurm
-	cp ${APPDIR}/starch/src/starch-diff.py ${APPDIR}/starch/bin/starch-diff
-	-test -e ${APPDIR}/starch/bin_i386/starch && test -e ${APPDIR}/starch/bin_x86_64/starch && { lipo -create ${APPDIR}/starch/bin_i386/starch ${APPDIR}/starch/bin_x86_64/starch -output ${APPDIR}/starch/bin/starch; }
-	-test -e ${APPDIR}/starch/bin_i386/unstarch && test -e ${APPDIR}/starch/bin_x86_64/unstarch && { lipo -create ${APPDIR}/starch/bin_i386/unstarch ${APPDIR}/starch/bin_x86_64/unstarch -output ${APPDIR}/starch/bin/unstarch; }
-	-test -e ${APPDIR}/starch/bin_i386/starchcat && test -e ${APPDIR}/starch/bin_x86_64/starchcat && { lipo -create ${APPDIR}/starch/bin_i386/starchcat ${APPDIR}/starch/bin_x86_64/starchcat -output ${APPDIR}/starch/bin/starchcat; }
-	-test -e ${APPDIR}/starch/bin_i386/starchstrip && test -e ${APPDIR}/starch/bin_x86_64/starchstrip && { lipo -create ${APPDIR}/starch/bin_i386/starchstrip ${APPDIR}/starch/bin_x86_64/starchstrip -output ${APPDIR}/starch/bin/starchstrip; }
-
-
-
-#
-# Debug: Darwin fat build targets
-#
-dbg_sort_c_intel_fat:
-	-test -e ${APPDIR}/sort-bed/bin/debug.sort-bed_i386 && test -e ${APPDIR}/sort-bed/bin/debug.sort-bed_x86_64 && { lipo -create ${APPDIR}/sort-bed/bin/debug.sort-bed_i386 ${APPDIR}/sort-bed/bin/debug.sort-bed_x86_64 -output ${APPDIR}/sort-bed/bin/debug.sort-bed; }
-
-dbg_bedops_c_intel_fat:
-	-test -e ${APPDIR}/bedops/bin/debug.bedops_i386 && test -e ${APPDIR}/bedops/bin/debug.bedops_x86_64 && { lipo -create ${APPDIR}/bedops/bin/debug.bedops_i386 ${APPDIR}/bedops/bin/debug.bedops_x86_64 -output ${APPDIR}/bedops/bin/debug.bedops; }
-
-dbg_closestfeatures_c_intel_fat:
-	-test -e ${APPDIR}/closestfeats/bin/debug.closest-features_i386 && test -e ${APPDIR}/closestfeats/bin/debug.closest-features_x86_64 && { lipo -create ${APPDIR}/closestfeats/bin/debug.closest-features_i386 ${APPDIR}/closestfeats/bin/debug.closest-features_x86_64 -output ${APPDIR}/closestfeats/bin/debug.closest-features; }
-
-dbg_bedmap_c_intel_fat:
-	-test -e ${APPDIR}/bedmap/bin/debug.bedmap_i386 && test -e ${APPDIR}/bedmap/bin/debug.bedmap_x86_64 && { lipo -create ${APPDIR}/bedmap/bin/debug.bedmap_i386 ${APPDIR}/bedmap/bin/debug.bedmap_x86_64 -output ${APPDIR}/bedmap/bin/debug.bedmap; }
+jansson_support_c:
+	bzcat ${WHICHJANSSON}.tar.bz2 | tar -x -C ${PARTY3}/darwin_intel_${BUILD_ARCH}/
+	cd ${PARTY3}/darwin_intel_${BUILD_ARCH}/${JANSSONVERSION} && export MACOSX_DEPLOYMENT_TARGET=${MIN_OSX_VERSION} && export ARCH=${BUILD_ARCH} && export CC=${CC} && export CXX=${CXX} && ./configure --prefix=${WDIR}/${PARTY3}/darwin_intel_${BUILD_ARCH}/${JANSSONVERSION} CFLAGS="-arch ${BUILD_ARCH}" --build="${BUILD_ARCH}" && $(MAKE) && $(MAKE) install && cd ../ && rm -f jansson && ln -sf ${JANSSONVERSION} jansson && cd ${WDIR}
 
-dbg_bedextract_c_intel_fat:
-	-test -e ${APPDIR}/bedextract/bin/debug.bedextract_i386 && test -e ${APPDIR}/bedextract/bin/debug.bedextract_x86_64 && { lipo -create ${APPDIR}/bedextract/bin/debug.bedextract_i386 ${APPDIR}/bedextract/bin/debug.bedextract_x86_64 -output ${APPDIR}/bedextract/bin/debug.bedextract; }
+bzip2_support_c:
+	bzcat ${WHICHBZIP2}.tar.bz2 | tar -x -C ${PARTY3}/darwin_intel_${BUILD_ARCH}/
+	cd ${PARTY3}/darwin_intel_${BUILD_ARCH}/${BZIP2VERSION} && export MACOSX_DEPLOYMENT_TARGET=${MIN_OSX_VERSION} && export ARCH=${BUILD_ARCH} && export CC=${CC} && export CXX=${CXX} && $(MAKE) -f Makefile.darwin_${BUILD_ARCH} libbz2.a && cd ../ && rm -f bzip2 && ln -sf ${BZIP2VERSION} bzip2 && cd ${WDIR}
 
-dbg_convert2bed_c_intel_fat:
-	-test -e ${APPDIR}/conversion/bin/debug.convert2bed_i386 && test -e ${APPDIR}/conversion/bin/debug.convert2bed_x86_64 && { lipo -create ${APPDIR}/conversion/bin/debug.convert2bed_i386 ${APPDIR}/conversion/bin/debug.convert2bed_x86_64 -output ${APPDIR}/conversion/bin/debug.convert2bed; }
+zlib_support_intel_c:
+	bzcat ${WHICHZLIB}.tar.bz2 | tar -x -C ${PARTY3}/darwin_intel_${BUILD_ARCH}/
+	cd ${PARTY3}/darwin_intel_${BUILD_ARCH}/${ZLIBVERSION} && export MACOSX_DEPLOYMENT_TARGET=${MIN_OSX_VERSION} && export ARCH=${BUILD_ARCH} && export CC=${CC} && export CXX=${CXX} && ./configure --static --archs="-arch ${BUILD_ARCH}" && $(MAKE) && cd ../ && rm -f zlib && ln -sf ${ZLIBVERSION} zlib && cd ${WDIR}
 
-dbg_starch_c_intel_fat:
-	cp ${APPDIR}/starch/src/starchcluster_sge.tcsh ${APPDIR}/starch/bin/starchcluster_sge
-	cp ${APPDIR}/starch/src/starchcluster_gnuParallel.tcsh ${APPDIR}/starch/bin/starchcluster_gnuParallel
-	cp ${APPDIR}/starch/src/starchcluster_slurm.tcsh ${APPDIR}/starch/bin/starchcluster_slurm
-	cp ${APPDIR}/starch/src/starch-diff.py ${APPDIR}/starch/bin/starch-diff
-	-test -e ${APPDIR}/starch/bin_i386/debug.starch && test -e ${APPDIR}/starch/bin_x86_64/debug.starch && { lipo -create ${APPDIR}/starch/bin_i386/debug.starch ${APPDIR}/starch/bin_x86_64/debug.starch -output ${APPDIR}/starch/bin/debug.starch; }
-	-test -e ${APPDIR}/starch/bin_i386/debug.unstarch && test -e ${APPDIR}/starch/bin_x86_64/debug.unstarch && { lipo -create ${APPDIR}/starch/bin_i386/debug.unstarch ${APPDIR}/starch/bin_x86_64/debug.unstarch -output ${APPDIR}/starch/bin/debug.unstarch; }
-	-test -e ${APPDIR}/starch/bin_i386/debug.starchcat && test -e ${APPDIR}/starch/bin_x86_64/debug.starchcat && { lipo -create ${APPDIR}/starch/bin_i386/debug.starchcat ${APPDIR}/starch/bin_x86_64/debug.starchcat -output ${APPDIR}/starch/bin/debug.starchcat; }
-	-test -e ${APPDIR}/starch/bin_i386/debug.starchstrip && test -e ${APPDIR}/starch/bin_x86_64/debug.starchstrip && { lipo -create ${APPDIR}/starch/bin_i386/debug.starchstrip ${APPDIR}/starch/bin_x86_64/debug.starchstrip -output ${APPDIR}/starch/bin/debug.starchstrip; }
diff --git a/system.mk/Makefile.linux b/system.mk/Makefile.linux
index 236ae0a..0c326a7 100644
--- a/system.mk/Makefile.linux
+++ b/system.mk/Makefile.linux
@@ -1,26 +1,26 @@
-PARTY3           = third-party
-BZIP2VERSION     = bzip2-1.0.6
-WHICHBZIP2      := ${PARTY3}/${BZIP2VERSION}
-JANSSONVERSION   = jansson-2.6
-WHICHJANSSON    := ${PARTY3}/${JANSSONVERSION}
-ZLIBVERSION      = zlib-1.2.7
-WHICHZLIB       := ${PARTY3}/${ZLIBVERSION}
-APPDIR           = applications/bed
-BINDIR           = bin
-OSXPKGROOT       = packaging/os_x
-OSXBUILDDIR      = ${OSXPKGROOT}/build
-OSXPKGDIR        = ${OSXPKGROOT}/resources/bin
-OSXLIBDIR        = ${OSXPKGROOT}/resources/lib
-WDIR             = ${shell pwd}
-export CC        = gcc
-export CXX       = g++
-SELF             = ${WDIR}/system.mk/Makefile.linux
+PARTY3                = third-party
+BZIP2VERSION          = bzip2-1.0.6
+WHICHBZIP2           := ${PARTY3}/${BZIP2VERSION}
+JANSSONVERSION        = jansson-2.6
+WHICHJANSSON         := ${PARTY3}/${JANSSONVERSION}
+ZLIBVERSION           = zlib-1.2.7
+WHICHZLIB            := ${PARTY3}/${ZLIBVERSION}
+APPDIR                = applications/bed
+WDIR                  = ${shell pwd}
+export CC             = gcc
+export CXX            = g++
+SELF                  = ${WDIR}/system.mk/Makefile.linux
+MEGAROW               = megarow
+TYPICAL               = typical
+BINDIR                = bin
+BINDIR_MODULE         = modules
+BINDIR_MODULE_TYPICAL = ${BINDIR_MODULE}/${TYPICAL}
+BINDIR_MODULE_MEGAROW = ${BINDIR_MODULE}/${MEGAROW}
 
 default: support
 	$(MAKE) build -f $(SELF)
 
 SUBDIRS = ${APPDIR}/bedmap/src ${APPDIR}/sort-bed/src ${APPDIR}/bedops/src ${APPDIR}/closestfeats/src ${APPDIR}/bedextract/src ${APPDIR}/starch/src ${APPDIR}/conversion/src
-
 .PHONY: $(SUBDIRS)
 
 build: $(SUBDIRS)
@@ -38,45 +38,7 @@ gprof: support
 
 build_gprof: $(SUBDIRS)
 
-clean: clean_debug clean_gprof $(SUBDIRS)
-	rm -f ${BINDIR}/sort-bed
-	rm -f ${BINDIR}/update-sort-bed-slurm
-	rm -f ${BINDIR}/update-sort-bed-starch-slurm
-	rm -f ${BINDIR}/update-sort-bed-migrate-candidates
-	rm -f ${BINDIR}/bedops
-	rm -f ${BINDIR}/closest-features
-	rm -f ${BINDIR}/bedmap
-	rm -f ${BINDIR}/bedextract
-	rm -f ${BINDIR}/starch
-	rm -f ${BINDIR}/unstarch
-	rm -f ${BINDIR}/starchcat
-	rm -f ${BINDIR}/starchstrip
-	rm -f ${BINDIR}/starchcluster*
-	rm -f ${BINDIR}/starch-diff
-	rm -f ${BINDIR}/bam2bed
-	rm -f ${BINDIR}/bam2bed*
-	rm -f ${BINDIR}/gff2bed
-	rm -f ${BINDIR}/gtf2bed
-	rm -f ${BINDIR}/gvf2bed
-	rm -f ${BINDIR}/psl2bed
-	rm -f ${BINDIR}/rmsk2bed
-	rm -f ${BINDIR}/sam2bed
-	rm -f ${BINDIR}/vcf2bed
-	rm -f ${BINDIR}/wig2bed
-	rm -f ${BINDIR}/convert2bed
-	rm -f ${BINDIR}/bam2starch
-	rm -f ${BINDIR}/bam2starch*
-	rm -f ${BINDIR}/gff2starch
-	rm -f ${BINDIR}/gtf2starch
-	rm -f ${BINDIR}/gvf2starch
-	rm -f ${BINDIR}/psl2starch
-	rm -f ${BINDIR}/rmsk2starch
-	rm -f ${BINDIR}/sam2starch
-	rm -f ${BINDIR}/vcf2starch
-	rm -f ${BINDIR}/wig2starch
-	rm -f ${OSXPKGDIR}/*
-	rm -f ${OSXLIBDIR}/*
-	rm -Rf ${OSXBUILDDIR}/*
+clean: clean_debug clean_gprof clean_postfix $(SUBDIRS)
 	rm -rf ${WHICHBZIP2}
 	rm -f ${PARTY3}/bzip2
 	rm -rf ${WHICHJANSSON}
@@ -86,81 +48,14 @@ clean: clean_debug clean_gprof $(SUBDIRS)
 	rm -rf ${BINDIR}
 
 clean_debug:
-	rm -f ${BINDIR}/debug.sort-bed
-	rm -f ${BINDIR}/update-sort-bed-slurm
-	rm -f ${BINDIR}/update-sort-bed-starch-slurm
-	rm -f ${BINDIR}/update-sort-bed-migrate-candidates
-	rm -f ${BINDIR}/debug.bedops
-	rm -f ${BINDIR}/debug.closest-features
-	rm -f ${BINDIR}/debug.bedmap
-	rm -f ${BINDIR}/debug.bedextract
-	rm -f ${BINDIR}/debug.starch
-	rm -f ${BINDIR}/debug.unstarch
-	rm -f ${BINDIR}/debug.starchcat
-	rm -f ${BINDIR}/debug.starchstrip
-	rm -f ${BINDIR}/starchcluster*
-	rm -f ${BINDIR}/starch-diff
-	rm -f ${BINDIR}/bam2bed
-	rm -f ${BINDIR}/bam2bed*
-	rm -f ${BINDIR}/gff2bed
-	rm -f ${BINDIR}/gtf2bed
-	rm -f ${BINDIR}/gvf2bed
-	rm -f ${BINDIR}/psl2bed
-	rm -f ${BINDIR}/rmsk2bed
-	rm -f ${BINDIR}/sam2bed
-	rm -f ${BINDIR}/vcf2bed
-	rm -f ${BINDIR}/wig2bed
-	rm -f ${BINDIR}/debug.convert2bed
-	rm -f ${BINDIR}/bam2starch
-	rm -f ${BINDIR}/bam2starch*
-	rm -f ${BINDIR}/gff2starch
-	rm -f ${BINDIR}/gtf2starch
-	rm -f ${BINDIR}/gvf2starch
-	rm -f ${BINDIR}/psl2starch
-	rm -f ${BINDIR}/rmsk2starch
-	rm -f ${BINDIR}/sam2starch
-	rm -f ${BINDIR}/vcf2starch
-	rm -f ${BINDIR}/wig2starch
 	rm -rf ${BINDIR}
 
 clean_gprof:
-	rm -f ${BINDIR}/gprof.sort-bed
-	rm -f ${BINDIR}/update-sort-bed-slurm
-	rm -f ${BINDIR}/update-sort-bed-starch-slurm
-	rm -f ${BINDIR}/update-sort-bed-migrate-candidates
-	rm -f ${BINDIR}/gprof.bedops
-	rm -f ${BINDIR}/gprof.closest-features
-	rm -f ${BINDIR}/gprof.bedmap
-	rm -f ${BINDIR}/gprof.bedextract
-	rm -f ${BINDIR}/gprof.starch
-	rm -f ${BINDIR}/gprof.unstarch
-	rm -f ${BINDIR}/gprof.starchcat
-	rm -f ${BINDIR}/gprof.starchstrip
-	rm -f ${BINDIR}/starchcluster*
-	rm -f ${BINDIR}/starch-diff
-	rm -f ${BINDIR}/bam2bed
-	rm -f ${BINDIR}/bam2bed*
-	rm -f ${BINDIR}/gff2bed
-	rm -f ${BINDIR}/gtf2bed
-	rm -f ${BINDIR}/gvf2bed
-	rm -f ${BINDIR}/psl2bed
-	rm -f ${BINDIR}/rmsk2bed
-	rm -f ${BINDIR}/sam2bed
-	rm -f ${BINDIR}/vcf2bed
-	rm -f ${BINDIR}/wig2bed
-	rm -f ${BINDIR}/gprof.convert2bed
-	rm -f ${BINDIR}/bam2starch
-	rm -f ${BINDIR}/bam2starch*
-	rm -f ${BINDIR}/gff2starch
-	rm -f ${BINDIR}/gtf2starch
-	rm -f ${BINDIR}/gvf2starch
-	rm -f ${BINDIR}/psl2starch
-	rm -f ${BINDIR}/rmsk2starch
-	rm -f ${BINDIR}/sam2starch
-	rm -f ${BINDIR}/vcf2starch
-	rm -f ${BINDIR}/wig2starch
 	rm -rf ${BINDIR}
 
+clean_postfix:
+	rm -rf ${BINDIR}
+	rm -rf ${BINDIR_MODULE}
 
 #
 # third-party libraries

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/bedops.git



More information about the debian-med-commit mailing list