diff --git a/src/bamFillMateSeq/Makefile b/src/bamFillMateSeq/Makefile
new file mode 100755
index 0000000000000000000000000000000000000000..da902162427ce42bc8ef6cee9f019db69fa46b7b
--- /dev/null
+++ b/src/bamFillMateSeq/Makefile
@@ -0,0 +1,45 @@
+CXX=		g++
+CXXFLAGS=	-Wall  -g
+LIBS=		-lz
+UTILITIES_DIR = ../utils/
+OBJ_DIR = ../../obj/
+BIN_DIR = ../../bin/
+
+# -------------------
+# define our includes
+# -------------------
+INCLUDES = -I$(UTILITIES_DIR)/BamTools/ -I$(UTILITIES_DIR)/sequenceUtilities/ -I$(UTILITIES_DIR)/version/
+
+# ----------------------------------
+# define our source and object files
+# ----------------------------------
+SOURCES= bamFillMateSeq.cpp
+OBJECTS= $(SOURCES:.cpp=.o)
+_EXT_OBJECTS=BamReader.o BamWriter.o sequenceUtils.o BGZF.o
+EXT_OBJECTS=$(patsubst %,$(OBJ_DIR)/%,$(_EXT_OBJECTS))
+BUILT_OBJECTS= $(patsubst %,$(OBJ_DIR)/%,$(OBJECTS))
+PROGRAM= bamFillMateSeq
+
+
+all: $(PROGRAM)
+
+.PHONY: all
+
+
+$(PROGRAM): $(BUILT_OBJECTS) $(EXT_OBJECTS)
+	@echo "  * linking $(PROGRAM)"
+	@$(CXX) $(LDFLAGS) $(CXXFLAGS) -o $(BIN_DIR)/$@ $^ $(LIBS)
+
+$(BUILT_OBJECTS): $(SOURCES)
+	@echo "  * compiling" $(*F).cpp
+	@$(CXX) -c -o $@ $(*F).cpp $(LDFLAGS) $(CXXFLAGS) $(INCLUDES)
+
+$(EXT_OBJECTS):
+	@$(MAKE) --no-print-directory -C $(UTILITIES_DIR)/sequenceUtilities/
+	@$(MAKE) --no-print-directory -C $(UTILITIES_DIR)/BamTools/	
+	
+clean:
+	@echo "Cleaning up."
+	@rm -f $(OBJ_DIR)/* $(BIN_DIR)/*
+
+.PHONY: clean
diff --git a/src/bamToBed/Makefile b/src/bamToBed/Makefile
index 263bebc58713c2d9c0cd3e30079830bc0ce9a2c8..d9baa942a59ed618f4e502836cf29f4a7defe18b 100755
--- a/src/bamToBed/Makefile
+++ b/src/bamToBed/Makefile
@@ -1,5 +1,5 @@
 CXX=		g++
-CXXFLAGS=	-Wall -O3
+CXXFLAGS=	-Wall -O2
 LIBS=		-lz
 UTILITIES_DIR = ../utils/
 OBJ_DIR = ../../obj/
diff --git a/src/bedToBam/Makefile b/src/bedToBam/Makefile
index 06f35b12dc43975df0f1bc7265cd56075b80ed20..f5493cda77fd09a4f311791fa982fc4ccd4910ae 100755
--- a/src/bedToBam/Makefile
+++ b/src/bedToBam/Makefile
@@ -1,5 +1,5 @@
 CXX=		g++
-CXXFLAGS=	-Wall -O3
+CXXFLAGS=	-Wall -O2
 LIBS=		-lz
 UTILITIES_DIR = ../utils/
 OBJ_DIR = ../../obj/
diff --git a/src/closestBed/Makefile b/src/closestBed/Makefile
index 2d8365bca1ea95ee603b439221c4db0b76c4be7b..bc1cff42c220492e2ca5013f3c872f5635841b5a 100755
--- a/src/closestBed/Makefile
+++ b/src/closestBed/Makefile
@@ -1,5 +1,5 @@
 CXX = g++
-CXXFLAGS = -O3 -Wall
+CXXFLAGS = -O2 -Wall
 LDFLAGS = 
 LIBS = -lz
 UTILITIES_DIR = ../utils/
diff --git a/src/complementBed/Makefile b/src/complementBed/Makefile
index 9a391333502348f91beb237e348f3e57fe7b60b3..53046ece01190b4784905ea5f369afe54b57ccd6 100755
--- a/src/complementBed/Makefile
+++ b/src/complementBed/Makefile
@@ -1,5 +1,5 @@
 CXX = g++
-CXXFLAGS = -O3  -Wall
+CXXFLAGS = -O2  -Wall
 LDFLAGS = 
 LIBS= -lz
 
diff --git a/src/coverageBed/Makefile b/src/coverageBed/Makefile
index 34c7a023975cad88bb19d5635a5bfecdfc254dc8..b05419076f50eaedb8f920cad63c4107f2d90fd1 100755
--- a/src/coverageBed/Makefile
+++ b/src/coverageBed/Makefile
@@ -1,5 +1,5 @@
 CXX = g++
-CXXFLAGS = -O3  -Wall
+CXXFLAGS = -O2  -Wall
 LDFLAGS = 
 LIBS=	-lz
 
diff --git a/src/fastaFromBed/Makefile b/src/fastaFromBed/Makefile
index dfb77b311c85c43e6f69f1053f258a09abf70c85..a8fe494ff4dd51f23904c5210bf3bb667f5ea90e 100755
--- a/src/fastaFromBed/Makefile
+++ b/src/fastaFromBed/Makefile
@@ -1,5 +1,5 @@
 CXX = g++
-CXXFLAGS = -O3  -Wall
+CXXFLAGS = -O2  -Wall
 LDFLAGS = 
 LIBS = -lz
 UTILITIES_DIR = ../utils/
diff --git a/src/genomeCoverageBed/Makefile b/src/genomeCoverageBed/Makefile
index 6914f42a3d14377a44ebab2e861e22bfa6c5271e..eab20b126443c3793022813279b76058076705af 100755
--- a/src/genomeCoverageBed/Makefile
+++ b/src/genomeCoverageBed/Makefile
@@ -1,5 +1,5 @@
 CXX = g++
-CXXFLAGS = -O3  -Wall
+CXXFLAGS = -O2  -Wall
 LDFLAGS = 
 LIBS=	-lz
 
diff --git a/src/intersectBed/Makefile b/src/intersectBed/Makefile
index 91f1cac4fe820996299490df892a40b669e6303b..789c63336b999b83111b5d7a04408f9e076ec8ea 100644
--- a/src/intersectBed/Makefile
+++ b/src/intersectBed/Makefile
@@ -1,5 +1,5 @@
 CXX = g++
-CXXFLAGS = -O3  -Wall
+CXXFLAGS = -O2  -Wall
 LDFLAGS = 
 LIBS=	-lz
 
diff --git a/src/linksBed/Makefile b/src/linksBed/Makefile
index 52adfd4f86d548956872fa07e6df7ed3d0b9e234..e31a5d1770d7030929f0419198b7600df9afa32f 100755
--- a/src/linksBed/Makefile
+++ b/src/linksBed/Makefile
@@ -1,5 +1,5 @@
 CXX = g++
-CXXFLAGS = -O3  -Wall
+CXXFLAGS = -O2  -Wall
 LDFLAGS =
 LIBS = -lz
 
diff --git a/src/maskFastaFromBed/Makefile b/src/maskFastaFromBed/Makefile
index 4f04142b19b81ea565d2b317e910042f808c02f9..0b7bae53520519da4744b23649b37cc01ceabb76 100755
--- a/src/maskFastaFromBed/Makefile
+++ b/src/maskFastaFromBed/Makefile
@@ -1,5 +1,5 @@
 CXX = g++
-CXXFLAGS = -O3  -Wall
+CXXFLAGS = -O2  -Wall
 LDFLAGS = 
 LIBS = -lz
 UTILITIES_DIR = ../utils/
diff --git a/src/mergeBed/Makefile b/src/mergeBed/Makefile
index c7baa9235a674e71238e8eece4227bc47608c68d..8ac8079e33164a8d623aae90b338d157756a5102 100755
--- a/src/mergeBed/Makefile
+++ b/src/mergeBed/Makefile
@@ -1,5 +1,5 @@
 CXX = g++
-CXXFLAGS = -O3  -Wall
+CXXFLAGS = -O2  -Wall
 LDFLAGS = 
 LIBS = -lz
 UTILITIES_DIR = ../utils/
diff --git a/src/overlap/Makefile b/src/overlap/Makefile
index d6c6b178f99b2a2378f4658d4b6aa98bc0b2aaec..3e1faaff8809f51460e65946feeef383c2dbb59f 100755
--- a/src/overlap/Makefile
+++ b/src/overlap/Makefile
@@ -1,5 +1,5 @@
 CXX=		g++
-CXXFLAGS=	-Wall -O3
+CXXFLAGS=	-Wall -O2
 LDFLAGS = 
 LIBS= -lz
 
diff --git a/src/pairToBed/Makefile b/src/pairToBed/Makefile
index bbb8a601edcdc80d0189361eec85e8bbadfd766b..1964ae97725f637f2a6bbeea0929d3cd900c79b2 100755
--- a/src/pairToBed/Makefile
+++ b/src/pairToBed/Makefile
@@ -1,5 +1,5 @@
 CXX = g++
-CXXFLAGS = -O3  -Wall
+CXXFLAGS = -O2  -Wall
 LDFLAGS = 
 LIBS=	-lz
 
diff --git a/src/pairToPair/Makefile b/src/pairToPair/Makefile
index 80f356ad5e5b5c0da784760f00457f642c6ffea8..60091e6da2a4a99da97f1edf62c0f29980fda3a9 100755
--- a/src/pairToPair/Makefile
+++ b/src/pairToPair/Makefile
@@ -1,5 +1,5 @@
 CXX = g++
-CXXFLAGS = -O3  -Wall
+CXXFLAGS = -O2  -Wall
 LDFLAGS = 
 LIBS = -lz
 UTILITIES_DIR = ../utils/
diff --git a/src/shuffleBed/Makefile b/src/shuffleBed/Makefile
index d917f3a5198f22a207ce5f786e6e9c8a1f415de5..c439ed8940e03562bf3165ad54ed79ed9960572a 100755
--- a/src/shuffleBed/Makefile
+++ b/src/shuffleBed/Makefile
@@ -1,5 +1,5 @@
 CXX = g++
-CXXFLAGS = -O3  -Wall
+CXXFLAGS = -O2  -Wall
 LDFLAGS =  
 LIBS = -lz
 
diff --git a/src/slopBed/Makefile b/src/slopBed/Makefile
index e7b88d61629bfcde45a1edd5eb37576879657755..7cb1f1e57b166fa2920c7eecc4aef52033095a45 100755
--- a/src/slopBed/Makefile
+++ b/src/slopBed/Makefile
@@ -1,5 +1,5 @@
 CXX = g++
-CXXFLAGS = -O3  -Wall
+CXXFLAGS = -O2  -Wall
 LDFLAGS =  
 LIBS = -lz
 
diff --git a/src/sortBed/Makefile b/src/sortBed/Makefile
index 73e600768878b54f3b5346cea814fceb022a35c3..542c0d39de7b05516ea5010dd0c7314e24fe3b78 100755
--- a/src/sortBed/Makefile
+++ b/src/sortBed/Makefile
@@ -1,5 +1,5 @@
 CXX = g++
-CXXFLAGS = -O3  -Wall
+CXXFLAGS = -O2  -Wall
 LDFLAGS = 
 LIBS = -lz
 UTILITIES_DIR = ../utils/
diff --git a/src/subtractBed/Makefile b/src/subtractBed/Makefile
index 701a5325edb655d993bfcea99b906aa849fd70aa..aef07ed24f96f66715d54f0b8e05e0bd1e4fab84 100755
--- a/src/subtractBed/Makefile
+++ b/src/subtractBed/Makefile
@@ -1,5 +1,5 @@
 CXX = g++
-CXXFLAGS = -O3  -Wall
+CXXFLAGS = -O2  -Wall
 LDFLAGS = 
 LIBS = -lz
 UTILITIES_DIR = ../utils/
diff --git a/src/utils/BamTools/Makefile b/src/utils/BamTools/Makefile
index 20a4193233453cbe6a29cd9515802cc7f1633f83..1bac7b531d9ef185b566d4931342173708b687d0 100644
--- a/src/utils/BamTools/Makefile
+++ b/src/utils/BamTools/Makefile
@@ -1,5 +1,5 @@
 CXX = g++
-CXXFLAGS = -O3  -Wall
+CXXFLAGS = -O2  -Wall
 LDFLAGS = 
 OBJ_DIR = ../../../obj/
 BIN_DIR = ../../../bin/
diff --git a/src/utils/bedFile/Makefile b/src/utils/bedFile/Makefile
index cbbd4d717f82956d3d6f410b3edd7314693fedf9..31bee672313953d2f656ccf18817072178d5e6f9 100755
--- a/src/utils/bedFile/Makefile
+++ b/src/utils/bedFile/Makefile
@@ -1,5 +1,5 @@
 CXX = g++ -c
-CXXFLAGS = -O3  -Wall
+CXXFLAGS = -O2  -Wall
 LDFLAGS = 
 OBJ_DIR = ../../../obj/
 BIN_DIR = ../../../bin/
diff --git a/src/utils/bedFilePE/Makefile b/src/utils/bedFilePE/Makefile
index c1b9bff0fa267447a61ad67284c487eb390f39e7..7927fc99f57b6cd83363c9595fd80d6a40ac9a30 100755
--- a/src/utils/bedFilePE/Makefile
+++ b/src/utils/bedFilePE/Makefile
@@ -1,5 +1,5 @@
 CXX = g++ -c
-CXXFLAGS = -O3  -Wall
+CXXFLAGS = -O2  -Wall
 LDFLAGS = 
 OBJ_DIR = ../../../obj/
 BIN_DIR = ../../../bin/
diff --git a/src/utils/genomeFile/Makefile b/src/utils/genomeFile/Makefile
index 3f753f715ae0727fd67265b90f77cda81f10a3b4..61d56693d006b696b5962ee3ec935cddaec5c9a1 100755
--- a/src/utils/genomeFile/Makefile
+++ b/src/utils/genomeFile/Makefile
@@ -1,5 +1,5 @@
 CXX = g++ -c
-CXXFLAGS = -O3  -Wall
+CXXFLAGS = -O2  -Wall
 LDFLAGS = 
 OBJ_DIR = ../../../obj/
 BIN_DIR = ../../../bin/
diff --git a/src/utils/gzstream/Makefile b/src/utils/gzstream/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..d93607c6efaa3c95ee45b885cb39d301193eeae8
--- /dev/null
+++ b/src/utils/gzstream/Makefile
@@ -0,0 +1,51 @@
+# ============================================================================
+# gzstream, C++ iostream classes wrapping the zlib compression library.
+# Copyright (C) 2001  Deepak Bandyopadhyay, Lutz Kettner
+# 
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+# 
+# This library 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
+# Lesser General Public License for more details.
+# 
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+# ============================================================================
+# 
+# File          : Makefile
+# Revision      : $Revision: 1.3 $
+# Revision_date : $Date: 2001/10/04 15:09:28 $
+# Author(s)     : Deepak Bandyopadhyay, Lutz Kettner
+# 
+# ============================================================================
+
+# ----------------------------------------------------------------------------
+# adapt these settings to your need:
+# add '-DGZSTREAM_NAMESPACE=name' to CPPFLAGS to place the classes
+# in its own namespace. Note, this macro needs to be set while creating
+# the library as well while compiling applications based on it.
+# As an alternative, gzstream.C and gzstream.h can be edited.
+# ----------------------------------------------------------------------------
+
+CXX = g++ 
+CXXFLAGS = -I. -O -Wall
+LDFLAGS  =  -L. -lgzstream -lz
+OBJ_DIR = ../../../obj/
+BIN_DIR = ../../../bin/
+UTILITIES_DIR = ../../utils/
+	
+${OBJ_DIR}/gzstream.o : gzstream.C gzstream.h
+	${CXX} ${CXXFLAGS} -c -o ${OBJ_DIR}/gzstream.o gzstream.C
+
+clean:
+	@echo "Cleaning up."
+	@rm -f $(OBJ_DIR)/* $(BIN_DIR)/*
+
+.PHONY: clean
+
+
diff --git a/src/utils/lineFileUtilities/Makefile b/src/utils/lineFileUtilities/Makefile
index fe18aa0b3c7f35ca8d20e4eeae03a58464cfb4a7..875a191b7ed08d58be88968ead4975def8557700 100755
--- a/src/utils/lineFileUtilities/Makefile
+++ b/src/utils/lineFileUtilities/Makefile
@@ -1,5 +1,5 @@
 CXX = g++ -c
-CXXFLAGS = -O3  -Wall
+CXXFLAGS = -O2  -Wall
 LDFLAGS = 
 OBJ_DIR = ../../../obj/
 BIN_DIR = ../../../bin/
diff --git a/src/utils/sequenceUtilities/Makefile b/src/utils/sequenceUtilities/Makefile
index 81d16baeb824c0dff3d3be8efcf391b7ec6c3bb8..68138067c818accdc16bda60183aa3362b505a86 100755
--- a/src/utils/sequenceUtilities/Makefile
+++ b/src/utils/sequenceUtilities/Makefile
@@ -1,5 +1,5 @@
 CXX = g++ -c
-CXXFLAGS = -O3  -Wall
+CXXFLAGS = -O2  -Wall
 LDFLAGS = 
 OBJ_DIR = ../../../obj/
 BIN_DIR = ../../../bin/
diff --git a/src/windowBed/Makefile b/src/windowBed/Makefile
index 8ec6714bb34fb18cd6c8ec27a10977df1a2ce6db..9ec9013a330b692c2db08c51bd1662176a7bcfa2 100755
--- a/src/windowBed/Makefile
+++ b/src/windowBed/Makefile
@@ -1,5 +1,5 @@
 CXX = g++
-CXXFLAGS = -O3  -Wall
+CXXFLAGS = -O2  -Wall
 LDFLAGS = 
 LIBS = -lz
 UTILITIES_DIR = ../utils/