[med-svn] [probabel] 01/03: Imported Upstream version 0.4.2

Lennart Karssen lckarssen-guest at moszumanska.debian.org
Tue Jan 14 15:27:45 UTC 2014


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

lckarssen-guest pushed a commit to branch master
in repository probabel.

commit de88d97d72897ae4c4d0ddf032642a4d47f8092f
Author: L.C. Karssen <lennart at karssen.org>
Date:   Mon Jan 13 18:26:45 2014 +0100

    Imported Upstream version 0.4.2
---
 Makefile.am                                        |    2 +-
 Makefile.in                                        |  297 ++---
 aclocal.m4                                         |  564 +++++-----
 checks/Makefile.am                                 |   93 +-
 checks/Makefile.in                                 |  767 ++++++++-----
 checks/R-tests/Makefile.am                         |  103 ++
 checks/R-tests/Makefile.in                         |  867 +++++++++++++++
 checks/R-tests/initial_checks.R                    |   93 ++
 checks/R-tests/run_R_test_pacox.sh                 |   11 +
 checks/R-tests/run_R_test_palinear.sh              |   11 +
 checks/R-tests/run_R_test_palogist.sh              |   11 +
 checks/R-tests/run_model_coxph.R                   |   98 ++
 checks/R-tests/run_model_linear.R                  |   29 +
 checks/R-tests/run_model_logist.R                  |   23 +
 checks/R-tests/run_models_in_R_pacox.R             |  109 ++
 checks/R-tests/run_models_in_R_palinear.R          |  129 +++
 checks/R-tests/run_models_in_R_palogist.R          |  129 +++
 checks/check_dose_input.sh                         |    2 +-
 ...robabel.pl_chunk.sh => check_probabel_chunk.sh} |   18 +-
 checks/inputfiles/test.dose.fvd                    |  Bin 4000 -> 4800 bytes
 checks/inputfiles/test.dose.fvi                    |  Bin 6608 -> 6640 bytes
 checks/inputfiles/test.map                         |    1 +
 checks/inputfiles/test.mldose                      |  400 +++----
 checks/inputfiles/test.mlinfo                      |    1 +
 checks/inputfiles/test.mlprob                      |  400 +++----
 checks/inputfiles/test.prob.fvd                    |  Bin 8000 -> 9600 bytes
 checks/inputfiles/test.prob.fvi                    |  Bin 6768 -> 6832 bytes
 checks/test_bt.sh                                  |   23 +-
 checks/test_cox.sh                                 |   20 +-
 checks/test_mms.sh                                 |   23 +-
 checks/test_qt.sh                                  |  139 +--
 checks/verified_results/height_base_add.out.txt    |    1 +
 configure                                          |  321 +++---
 configure.ac                                       |   29 +-
 doc/ChangeLog                                      |   29 +
 doc/INSTALL                                        |   15 +-
 doc/Makefile.am                                    |    2 +-
 doc/Makefile.in                                    |  132 ++-
 doc/ProbABEL_manual.tex                            |   39 +-
 doc/pacoxph.1                                      |    2 +-
 doc/palinear.1                                     |    4 +-
 doc/palogist.1                                     |    4 +-
 doc/probabel.1                                     |   91 ++
 doc/probabel.pl.1                                  |   91 ++
 examples/Makefile.am                               |   81 ++
 examples/Makefile.in                               |  191 +++-
 examples/example_bt.sh                             |   24 +-
 examples/example_cox.sh                            |   24 +-
 examples/example_qt.sh                             |   72 +-
 missing                                            |  461 +++-----
 src/Makefile.am                                    |   27 +-
 src/Makefile.in                                    |  332 ++++--
 src/command_line_settings.cpp                      |   31 +-
 src/command_line_settings.h                        |    6 +-
 src/config.h.in                                    |    7 -
 src/coxfit2.c                                      |    1 -
 src/coxph_data.cpp                                 |  206 +++-
 src/coxph_data.h                                   |   25 +-
 src/data.cpp                                       |   33 +-
 src/data.h                                         |   34 +-
 src/eigen_mematrix.cpp                             |   43 +-
 src/eigen_mematrix.h                               |    6 +-
 src/extract-snp.cpp                                |   10 +-
 src/fvlib/AbstractMatrix.cpp                       |   12 +-
 src/fvlib/AbstractMatrix.h                         |  113 +-
 src/fvlib/CastUtils.cpp                            |  295 ++---
 src/fvlib/CastUtils.h                              |  141 +--
 src/fvlib/FileVector.cpp                           | 1145 +++++++++++---------
 src/fvlib/FileVector.h                             |  209 ++--
 src/fvlib/FilteredMatrix.cpp                       |  117 +-
 src/fvlib/FilteredMatrix.h                         |  173 +--
 src/fvlib/Logger.cpp                               |    7 +-
 src/fvlib/Logger.h                                 |   30 +-
 src/fvlib/RealHandlerWrapper.cpp                   |   21 +-
 src/fvlib/RealHandlerWrapper.h                     |   10 +-
 src/fvlib/ReusableFileHandle.cpp                   |   31 +-
 src/fvlib/ReusableFileHandle.h                     |   28 +-
 src/fvlib/Transposer.cpp                           |  237 ++--
 src/fvlib/Transposer.h                             |   38 +-
 src/fvlib/convert_util.cpp                         |  567 +++++-----
 src/fvlib/convert_util.h                           |   10 +-
 src/fvlib/frutil.cpp                               |  238 ++--
 src/fvlib/frutil.h                                 |   86 +-
 src/gendata.cpp                                    |    3 +-
 src/gendata.h                                      |    4 +-
 src/main.cpp                                       |  497 ++-------
 src/main_functions_dump.cpp                        |  428 ++++++++
 src/main_functions_dump.h                          |   38 +
 src/maskedmatrix.h                                 |    6 +-
 src/mematrix.h                                     |    2 +-
 src/phedata.cpp                                    |   30 +-
 src/phedata.h                                      |    2 +-
 src/{probabel.pl => probabel}                      |   25 +-
 src/reg1.cpp                                       |   87 +-
 src/reg1.h                                         |    6 +-
 src/regdata.cpp                                    |   88 +-
 src/regdata.h                                      |   12 +-
 src/usage.cpp                                      |   18 +-
 test-driver                                        |  127 +++
 99 files changed, 7406 insertions(+), 4212 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 7b3d14a..bc25542 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,4 +1,4 @@
 ## Process this file with automake to produce Makefile.in
 
 AUTOMAKE_OPTIONS = foreign
-SUBDIRS = src doc checks examples
+SUBDIRS = src doc checks examples checks/R-tests
diff --git a/Makefile.in b/Makefile.in
index 7f0a0d8..6a577d3 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1,9 +1,8 @@
-# Makefile.in generated by automake 1.11.6 from Makefile.am.
+# Makefile.in generated by automake 1.13.3 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# Copyright (C) 1994-2013 Free Software Foundation, Inc.
+
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -15,23 +14,51 @@
 
 @SET_MAKE@
 VPATH = @srcdir@
-am__make_dryrun = \
-  { \
-    am__dry=no; \
+am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
+am__make_running_with_option = \
+  case $${target_option-} in \
+      ?) ;; \
+      *) echo "am__make_running_with_option: internal error: invalid" \
+              "target option '$${target_option-}' specified" >&2; \
+         exit 1;; \
+  esac; \
+  has_opt=no; \
+  sane_makeflags=$$MAKEFLAGS; \
+  if $(am__is_gnu_make); then \
+    sane_makeflags=$$MFLAGS; \
+  else \
     case $$MAKEFLAGS in \
       *\\[\ \	]*) \
-        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
-          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
-      *) \
-        for am__flg in $$MAKEFLAGS; do \
-          case $$am__flg in \
-            *=*|--*) ;; \
-            *n*) am__dry=yes; break;; \
-          esac; \
-        done;; \
+        bs=\\; \
+        sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+          | sed "s/$$bs$$bs[$$bs $$bs	]*//g"`;; \
+    esac; \
+  fi; \
+  skip_next=no; \
+  strip_trailopt () \
+  { \
+    flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+  }; \
+  for flg in $$sane_makeflags; do \
+    test $$skip_next = yes && { skip_next=no; continue; }; \
+    case $$flg in \
+      *=*|--*) continue;; \
+        -*I) strip_trailopt 'I'; skip_next=yes;; \
+      -*I?*) strip_trailopt 'I';; \
+        -*O) strip_trailopt 'O'; skip_next=yes;; \
+      -*O?*) strip_trailopt 'O';; \
+        -*l) strip_trailopt 'l'; skip_next=yes;; \
+      -*l?*) strip_trailopt 'l';; \
+      -[dEDm]) skip_next=yes;; \
+      -[JT]) skip_next=yes;; \
     esac; \
-    test $$am__dry = yes; \
-  }
+    case $$flg in \
+      *$$target_option*) has_opt=yes; break;; \
+    esac; \
+  done; \
+  test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
 pkgdatadir = $(datadir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
@@ -49,8 +76,8 @@ NORMAL_UNINSTALL = :
 PRE_UNINSTALL = :
 POST_UNINSTALL = :
 subdir = .
-DIST_COMMON = $(am__configure_deps) $(srcdir)/Makefile.am \
-	$(srcdir)/Makefile.in $(top_srcdir)/configure compile depcomp \
+DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
+	$(top_srcdir)/configure $(am__configure_deps) compile depcomp \
 	install-sh missing
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/configure.ac
@@ -62,21 +89,28 @@ mkinstalldirs = $(install_sh) -d
 CONFIG_HEADER = $(top_builddir)/src/config.h
 CONFIG_CLEAN_FILES =
 CONFIG_CLEAN_VPATH_FILES =
+AM_V_P = $(am__v_P_ at AM_V@)
+am__v_P_ = $(am__v_P_ at AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
 AM_V_GEN = $(am__v_GEN_ at AM_V@)
 am__v_GEN_ = $(am__v_GEN_ at AM_DEFAULT_V@)
-am__v_GEN_0 = @echo "  GEN   " $@;
+am__v_GEN_0 = @echo "  GEN     " $@;
+am__v_GEN_1 = 
 AM_V_at = $(am__v_at_ at AM_V@)
 am__v_at_ = $(am__v_at_ at AM_DEFAULT_V@)
 am__v_at_0 = @
+am__v_at_1 = 
 SOURCES =
 DIST_SOURCES =
-RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
-	html-recursive info-recursive install-data-recursive \
-	install-dvi-recursive install-exec-recursive \
-	install-html-recursive install-info-recursive \
-	install-pdf-recursive install-ps-recursive install-recursive \
-	installcheck-recursive installdirs-recursive pdf-recursive \
-	ps-recursive uninstall-recursive
+RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \
+	ctags-recursive dvi-recursive html-recursive info-recursive \
+	install-data-recursive install-dvi-recursive \
+	install-exec-recursive install-html-recursive \
+	install-info-recursive install-pdf-recursive \
+	install-ps-recursive install-recursive installcheck-recursive \
+	installdirs-recursive pdf-recursive ps-recursive \
+	tags-recursive uninstall-recursive
 am__can_run_installinfo = \
   case $$AM_UPDATE_INFO_DIR in \
     n|no|NO) false;; \
@@ -84,11 +118,32 @@ am__can_run_installinfo = \
   esac
 RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive	\
   distclean-recursive maintainer-clean-recursive
-AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
-	$(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
-	distdir dist dist-all distcheck
+am__recursive_targets = \
+  $(RECURSIVE_TARGETS) \
+  $(RECURSIVE_CLEAN_TARGETS) \
+  $(am__extra_recursive_targets)
+AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \
+	cscope distdir dist dist-all distcheck
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+# Read a list of newline-separated strings from the standard input,
+# and print each of them once, without duplicates.  Input order is
+# *not* preserved.
+am__uniquify_input = $(AWK) '\
+  BEGIN { nonempty = 0; } \
+  { items[$$0] = 1; nonempty = 1; } \
+  END { if (nonempty) { for (i in items) print i; }; } \
+'
+# Make sure the list of sources is unique.  This is necessary because,
+# e.g., the same source file might be shared among _SOURCES variables
+# for different programs/libraries.
+am__define_uniq_tagged_files = \
+  list='$(am__tagged_files)'; \
+  unique=`for i in $$list; do \
+    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+  done | $(am__uniquify_input)`
 ETAGS = etags
 CTAGS = ctags
+CSCOPE = cscope
 DIST_SUBDIRS = $(SUBDIRS)
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 distdir = $(PACKAGE)-$(VERSION)
@@ -99,6 +154,7 @@ am__remove_distdir = \
       && rm -rf "$(distdir)" \
       || { sleep 5 && rm -rf "$(distdir)"; }; \
   else :; fi
+am__post_remove_distdir = $(am__remove_distdir)
 am__relativize = \
   dir0=`pwd`; \
   sed_first='s,^\([^/]*\)/.*$$,\1,'; \
@@ -126,6 +182,7 @@ am__relativize = \
   reldir="$$dir2"
 DIST_ARCHIVES = $(distdir).tar.gz
 GZIP_ENV = --best
+DIST_TARGETS = dist-gzip
 distuninstallcheck_listfiles = find . -type f -print
 am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \
   | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$'
@@ -228,7 +285,7 @@ top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 AUTOMAKE_OPTIONS = foreign
-SUBDIRS = src doc checks examples
+SUBDIRS = src doc checks examples checks/R-tests
 all: all-recursive
 
 .SUFFIXES:
@@ -268,22 +325,25 @@ $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
 $(am__aclocal_m4_deps):
 
 # This directory's subdirectories are mostly independent; you can cd
-# into them and run `make' without going through this Makefile.
-# To change the values of `make' variables: instead of editing Makefiles,
-# (1) if the variable is set in `config.status', edit `config.status'
-#     (which will cause the Makefiles to be regenerated when you run `make');
-# (2) otherwise, pass the desired values on the `make' command line.
-$(RECURSIVE_TARGETS):
-	@fail= failcom='exit 1'; \
-	for f in x $$MAKEFLAGS; do \
-	  case $$f in \
-	    *=* | --[!k]*);; \
-	    *k*) failcom='fail=yes';; \
-	  esac; \
-	done; \
+# into them and run 'make' without going through this Makefile.
+# To change the values of 'make' variables: instead of editing Makefiles,
+# (1) if the variable is set in 'config.status', edit 'config.status'
+#     (which will cause the Makefiles to be regenerated when you run 'make');
+# (2) otherwise, pass the desired values on the 'make' command line.
+$(am__recursive_targets):
+	@fail=; \
+	if $(am__make_keepgoing); then \
+	  failcom='fail=yes'; \
+	else \
+	  failcom='exit 1'; \
+	fi; \
 	dot_seen=no; \
 	target=`echo $@ | sed s/-recursive//`; \
-	list='$(SUBDIRS)'; for subdir in $$list; do \
+	case "$@" in \
+	  distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+	  *) list='$(SUBDIRS)' ;; \
+	esac; \
+	for subdir in $$list; do \
 	  echo "Making $$target in $$subdir"; \
 	  if test "$$subdir" = "."; then \
 	    dot_seen=yes; \
@@ -298,57 +358,12 @@ $(RECURSIVE_TARGETS):
 	  $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
 	fi; test -z "$$fail"
 
-$(RECURSIVE_CLEAN_TARGETS):
-	@fail= failcom='exit 1'; \
-	for f in x $$MAKEFLAGS; do \
-	  case $$f in \
-	    *=* | --[!k]*);; \
-	    *k*) failcom='fail=yes';; \
-	  esac; \
-	done; \
-	dot_seen=no; \
-	case "$@" in \
-	  distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
-	  *) list='$(SUBDIRS)' ;; \
-	esac; \
-	rev=''; for subdir in $$list; do \
-	  if test "$$subdir" = "."; then :; else \
-	    rev="$$subdir $$rev"; \
-	  fi; \
-	done; \
-	rev="$$rev ."; \
-	target=`echo $@ | sed s/-recursive//`; \
-	for subdir in $$rev; do \
-	  echo "Making $$target in $$subdir"; \
-	  if test "$$subdir" = "."; then \
-	    local_target="$$target-am"; \
-	  else \
-	    local_target="$$target"; \
-	  fi; \
-	  ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
-	  || eval $$failcom; \
-	done && test -z "$$fail"
-tags-recursive:
-	list='$(SUBDIRS)'; for subdir in $$list; do \
-	  test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
-	done
-ctags-recursive:
-	list='$(SUBDIRS)'; for subdir in $$list; do \
-	  test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
-	done
+ID: $(am__tagged_files)
+	$(am__define_uniq_tagged_files); mkid -fID $$unique
+tags: tags-recursive
+TAGS: tags
 
-ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
-	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
-	unique=`for i in $$list; do \
-	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-	  done | \
-	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
-	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	mkid -fID $$unique
-tags: TAGS
-
-TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
-		$(TAGS_FILES) $(LISP)
+tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
 	set x; \
 	here=`pwd`; \
 	if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
@@ -364,12 +379,7 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 	      set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
 	  fi; \
 	done; \
-	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
-	unique=`for i in $$list; do \
-	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-	  done | \
-	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
-	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	$(am__define_uniq_tagged_files); \
 	shift; \
 	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
 	  test -n "$$unique" || unique=$$empty_fix; \
@@ -381,15 +391,11 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 	      $$unique; \
 	  fi; \
 	fi
-ctags: CTAGS
-CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
-		$(TAGS_FILES) $(LISP)
-	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
-	unique=`for i in $$list; do \
-	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-	  done | \
-	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
-	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+ctags: ctags-recursive
+
+CTAGS: ctags
+ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+	$(am__define_uniq_tagged_files); \
 	test -z "$(CTAGS_ARGS)$$unique" \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
 	     $$unique
@@ -398,9 +404,31 @@ GTAGS:
 	here=`$(am__cd) $(top_builddir) && pwd` \
 	  && $(am__cd) $(top_srcdir) \
 	  && gtags -i $(GTAGS_ARGS) "$$here"
+cscope: cscope.files
+	test ! -s cscope.files \
+	  || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS)
+clean-cscope:
+	-rm -f cscope.files
+cscope.files: clean-cscope cscopelist
+cscopelist: cscopelist-recursive
+
+cscopelist-am: $(am__tagged_files)
+	list='$(am__tagged_files)'; \
+	case "$(srcdir)" in \
+	  [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+	  *) sdir=$(subdir)/$(srcdir) ;; \
+	esac; \
+	for i in $$list; do \
+	  if test -f "$$i"; then \
+	    echo "$(subdir)/$$i"; \
+	  else \
+	    echo "$$sdir/$$i"; \
+	  fi; \
+	done >> $(top_builddir)/cscope.files
 
 distclean-tags:
 	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+	-rm -f cscope.out cscope.in.out cscope.po.out cscope.files
 
 distdir: $(DISTFILES)
 	$(am__remove_distdir)
@@ -468,40 +496,36 @@ distdir: $(DISTFILES)
 	|| chmod -R a+r "$(distdir)"
 dist-gzip: distdir
 	tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
-	$(am__remove_distdir)
+	$(am__post_remove_distdir)
 
 dist-bzip2: distdir
 	tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2
-	$(am__remove_distdir)
+	$(am__post_remove_distdir)
 
 dist-lzip: distdir
 	tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz
-	$(am__remove_distdir)
-
-dist-lzma: distdir
-	tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma
-	$(am__remove_distdir)
+	$(am__post_remove_distdir)
 
 dist-xz: distdir
 	tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz
-	$(am__remove_distdir)
+	$(am__post_remove_distdir)
 
 dist-tarZ: distdir
 	tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
-	$(am__remove_distdir)
+	$(am__post_remove_distdir)
 
 dist-shar: distdir
 	shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
-	$(am__remove_distdir)
+	$(am__post_remove_distdir)
 
 dist-zip: distdir
 	-rm -f $(distdir).zip
 	zip -rq $(distdir).zip $(distdir)
-	$(am__remove_distdir)
+	$(am__post_remove_distdir)
 
-dist dist-all: distdir
-	tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
-	$(am__remove_distdir)
+dist dist-all:
+	$(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:'
+	$(am__post_remove_distdir)
 
 # This target untars the dist file and tries a VPATH configuration.  Then
 # it guarantees that the distribution is self-contained by making another
@@ -512,8 +536,6 @@ distcheck: dist
 	  GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
 	*.tar.bz2*) \
 	  bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
-	*.tar.lzma*) \
-	  lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\
 	*.tar.lz*) \
 	  lzip -dc $(distdir).tar.lz | $(am__untar) ;;\
 	*.tar.xz*) \
@@ -525,9 +547,9 @@ distcheck: dist
 	*.zip*) \
 	  unzip $(distdir).zip ;;\
 	esac
-	chmod -R a-w $(distdir); chmod u+w $(distdir)
-	mkdir $(distdir)/_build
-	mkdir $(distdir)/_inst
+	chmod -R a-w $(distdir)
+	chmod u+w $(distdir)
+	mkdir $(distdir)/_build $(distdir)/_inst
 	chmod a-w $(distdir)
 	test -d $(distdir)/_build || exit 0; \
 	dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
@@ -559,7 +581,7 @@ distcheck: dist
 	  && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \
 	  && cd "$$am__cwd" \
 	  || exit 1
-	$(am__remove_distdir)
+	$(am__post_remove_distdir)
 	@(echo "$(distdir) archives ready for distribution: "; \
 	  list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
 	  sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
@@ -693,13 +715,12 @@ ps-am:
 
 uninstall-am:
 
-.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \
-	install-am install-strip tags-recursive
+.MAKE: $(am__recursive_targets) install-am install-strip
 
-.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
-	all all-am am--refresh check check-am clean clean-generic \
-	ctags ctags-recursive dist dist-all dist-bzip2 dist-gzip \
-	dist-lzip dist-lzma dist-shar dist-tarZ dist-xz dist-zip \
+.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \
+	am--refresh check check-am clean clean-cscope clean-generic \
+	cscope cscopelist-am ctags ctags-am dist dist-all dist-bzip2 \
+	dist-gzip dist-lzip dist-shar dist-tarZ dist-xz dist-zip \
 	distcheck distclean distclean-generic distclean-tags \
 	distcleancheck distdir distuninstallcheck dvi dvi-am html \
 	html-am info info-am install install-am install-data \
@@ -709,7 +730,7 @@ uninstall-am:
 	install-ps install-ps-am install-strip installcheck \
 	installcheck-am installdirs installdirs-am maintainer-clean \
 	maintainer-clean-generic mostlyclean mostlyclean-generic pdf \
-	pdf-am ps ps-am tags tags-recursive uninstall uninstall-am
+	pdf-am ps ps-am tags tags-am uninstall uninstall-am
 
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
diff --git a/aclocal.m4 b/aclocal.m4
index 20b1acc..913076e 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1,8 +1,7 @@
-# generated automatically by aclocal 1.11.6 -*- Autoconf -*-
+# generated automatically by aclocal 1.13.3 -*- Autoconf -*-
+
+# Copyright (C) 1996-2013 Free Software Foundation, Inc.
 
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-# 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation,
-# Inc.
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -12,33 +11,31 @@
 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
 # PARTICULAR PURPOSE.
 
+m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
 m4_ifndef([AC_AUTOCONF_VERSION],
   [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
 m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
 [m4_warning([this file was generated for autoconf 2.69.
 You have another version of autoconf.  It may work, but is not guaranteed to.
 If you have problems, you may need to regenerate the build system entirely.
-To do so, use the procedure documented by the package, typically `autoreconf'.])])
+To do so, use the procedure documented by the package, typically 'autoreconf'.])])
 
-# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008, 2011 Free Software
-# Foundation, Inc.
+# Copyright (C) 2002-2013 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 1
-
 # AM_AUTOMAKE_VERSION(VERSION)
 # ----------------------------
 # Automake X.Y traces this macro to ensure aclocal.m4 has been
 # generated from the m4 files accompanying Automake X.Y.
 # (This private macro should not be called outside this file.)
 AC_DEFUN([AM_AUTOMAKE_VERSION],
-[am__api_version='1.11'
+[am__api_version='1.13'
 dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
 dnl require some minimum version.  Point them to the right macro.
-m4_if([$1], [1.11.6], [],
+m4_if([$1], [1.13.3], [],
       [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
 ])
 
@@ -54,24 +51,22 @@ m4_define([_AM_AUTOCONF_VERSION], [])
 # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
 # This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
 AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
-[AM_AUTOMAKE_VERSION([1.11.6])dnl
+[AM_AUTOMAKE_VERSION([1.13.3])dnl
 m4_ifndef([AC_AUTOCONF_VERSION],
   [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
 _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
 
 # AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
 
-# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
+# Copyright (C) 2001-2013 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 1
-
 # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
-# $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
-# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
+# $ac_aux_dir to '$srcdir/foo'.  In other projects, it is set to
+# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
 #
 # Of course, Automake must honor this variable whenever it calls a
 # tool from the auxiliary directory.  The problem is that $srcdir (and
@@ -90,7 +85,7 @@ _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
 #
 # The reason of the latter failure is that $top_srcdir and $ac_aux_dir
 # are both prefixed by $srcdir.  In an in-source build this is usually
-# harmless because $srcdir is `.', but things will broke when you
+# harmless because $srcdir is '.', but things will broke when you
 # start a VPATH build or use an absolute $srcdir.
 #
 # So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
@@ -116,22 +111,19 @@ am_aux_dir=`cd $ac_aux_dir && pwd`
 
 # AM_CONDITIONAL                                            -*- Autoconf -*-
 
-# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008
-# Free Software Foundation, Inc.
+# Copyright (C) 1997-2013 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 9
-
 # AM_CONDITIONAL(NAME, SHELL-CONDITION)
 # -------------------------------------
 # Define a conditional.
 AC_DEFUN([AM_CONDITIONAL],
-[AC_PREREQ(2.52)dnl
- ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
-	[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
+[AC_PREREQ([2.52])dnl
+ m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
+       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
 AC_SUBST([$1_TRUE])dnl
 AC_SUBST([$1_FALSE])dnl
 _AM_SUBST_NOTMAKE([$1_TRUE])dnl
@@ -150,16 +142,14 @@ AC_CONFIG_COMMANDS_PRE(
 Usually this means the macro was only invoked conditionally.]])
 fi])])
 
-# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009,
-# 2010, 2011 Free Software Foundation, Inc.
+# Copyright (C) 1999-2013 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 12
 
-# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
+# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
 # written in clear, in which case automake, when reading aclocal.m4,
 # will think it sees a *use*, and therefore will trigger all it's
 # C support machinery.  Also note that it means that autoscan, seeing
@@ -169,7 +159,7 @@ fi])])
 # _AM_DEPENDENCIES(NAME)
 # ----------------------
 # See how the compiler implements dependency checking.
-# NAME is "CC", "CXX", "GCJ", or "OBJC".
+# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
 # We try a few techniques and use that to set a single cache variable.
 #
 # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
@@ -182,12 +172,13 @@ AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
 AC_REQUIRE([AM_MAKE_INCLUDE])dnl
 AC_REQUIRE([AM_DEP_TRACK])dnl
 
-ifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
-       [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
-       [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
-       [$1], UPC,  [depcc="$UPC"  am_compiler_list=],
-       [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
-                   [depcc="$$1"   am_compiler_list=])
+m4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
+      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
+      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
+      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
+      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
+      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
+                    [depcc="$$1"   am_compiler_list=])
 
 AC_CACHE_CHECK([dependency style of $depcc],
                [am_cv_$1_dependencies_compiler_type],
@@ -195,8 +186,8 @@ AC_CACHE_CHECK([dependency style of $depcc],
   # We make a subdir and do the tests there.  Otherwise we can end up
   # making bogus files that we don't know about and never remove.  For
   # instance it was reported that on HP-UX the gcc test will end up
-  # making a dummy file named `D' -- because `-MD' means `put the output
-  # in D'.
+  # making a dummy file named 'D' -- because '-MD' means "put the output
+  # in D".
   rm -rf conftest.dir
   mkdir conftest.dir
   # Copy depcomp to subdir because otherwise we won't find it if we're
@@ -236,16 +227,16 @@ AC_CACHE_CHECK([dependency style of $depcc],
     : > sub/conftest.c
     for i in 1 2 3 4 5 6; do
       echo '#include "conftst'$i'.h"' >> sub/conftest.c
-      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
-      # Solaris 8's {/usr,}/bin/sh.
-      touch sub/conftst$i.h
+      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
+      # Solaris 10 /bin/sh.
+      echo '/* dummy */' > sub/conftst$i.h
     done
     echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
 
-    # We check with `-c' and `-o' for the sake of the "dashmstdout"
+    # We check with '-c' and '-o' for the sake of the "dashmstdout"
     # mode.  It turns out that the SunPro C++ compiler does not properly
-    # handle `-M -o', and we need to detect this.  Also, some Intel
-    # versions had trouble with output in subdirs
+    # handle '-M -o', and we need to detect this.  Also, some Intel
+    # versions had trouble with output in subdirs.
     am__obj=sub/conftest.${OBJEXT-o}
     am__minus_obj="-o $am__obj"
     case $depmode in
@@ -254,8 +245,8 @@ AC_CACHE_CHECK([dependency style of $depcc],
       test "$am__universal" = false || continue
       ;;
     nosideeffect)
-      # after this tag, mechanisms are not by side-effect, so they'll
-      # only be used when explicitly requested
+      # After this tag, mechanisms are not by side-effect, so they'll
+      # only be used when explicitly requested.
       if test "x$enable_dependency_tracking" = xyes; then
 	continue
       else
@@ -263,7 +254,7 @@ AC_CACHE_CHECK([dependency style of $depcc],
       fi
       ;;
     msvc7 | msvc7msys | msvisualcpp | msvcmsys)
-      # This compiler won't grok `-c -o', but also, the minuso test has
+      # This compiler won't grok '-c -o', but also, the minuso test has
       # not run yet.  These depmodes are late enough in the game, and
       # so weak that their functioning should not be impacted.
       am__obj=conftest.${OBJEXT-o}
@@ -311,7 +302,7 @@ AM_CONDITIONAL([am__fastdep$1], [
 # AM_SET_DEPDIR
 # -------------
 # Choose a directory name for dependency files.
-# This macro is AC_REQUIREd in _AM_DEPENDENCIES
+# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
 AC_DEFUN([AM_SET_DEPDIR],
 [AC_REQUIRE([AM_SET_LEADING_DOT])dnl
 AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
@@ -321,9 +312,13 @@ AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
 # AM_DEP_TRACK
 # ------------
 AC_DEFUN([AM_DEP_TRACK],
-[AC_ARG_ENABLE(dependency-tracking,
-[  --disable-dependency-tracking  speeds up one-time build
-  --enable-dependency-tracking   do not reject slow dependency extractors])
+[AC_ARG_ENABLE([dependency-tracking], [dnl
+AS_HELP_STRING(
+  [--enable-dependency-tracking],
+  [do not reject slow dependency extractors])
+AS_HELP_STRING(
+  [--disable-dependency-tracking],
+  [speeds up one-time build])])
 if test "x$enable_dependency_tracking" != xno; then
   am_depcomp="$ac_aux_dir/depcomp"
   AMDEPBACKSLASH='\'
@@ -338,20 +333,18 @@ _AM_SUBST_NOTMAKE([am__nodep])dnl
 
 # Generate code to set up dependency tracking.              -*- Autoconf -*-
 
-# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008
-# Free Software Foundation, Inc.
+# Copyright (C) 1999-2013 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-#serial 5
 
 # _AM_OUTPUT_DEPENDENCY_COMMANDS
 # ------------------------------
 AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
 [{
-  # Autoconf 2.62 quotes --file arguments for eval, but not when files
+  # Older Autoconf quotes --file arguments for eval, but not when files
   # are listed without --file.  Let's play safe and only enable the eval
   # if we detect the quoting.
   case $CONFIG_FILES in
@@ -364,7 +357,7 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
     # Strip MF so we end up with the name of the file.
     mf=`echo "$mf" | sed -e 's/:.*$//'`
     # Check whether this is an Automake generated Makefile or not.
-    # We used to match only the files named `Makefile.in', but
+    # We used to match only the files named 'Makefile.in', but
     # some people rename them; so instead we look at the file content.
     # Grep'ing the first line is not enough: some people post-process
     # each Makefile.in and add a new line on top of each file to say so.
@@ -376,21 +369,19 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
       continue
     fi
     # Extract the definition of DEPDIR, am__include, and am__quote
-    # from the Makefile without running `make'.
+    # from the Makefile without running 'make'.
     DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
     test -z "$DEPDIR" && continue
     am__include=`sed -n 's/^am__include = //p' < "$mf"`
-    test -z "am__include" && continue
+    test -z "$am__include" && continue
     am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
-    # When using ansi2knr, U may be empty or an underscore; expand it
-    U=`sed -n 's/^U = //p' < "$mf"`
     # Find all dependency output files, they are included files with
     # $(DEPDIR) in their names.  We invoke sed twice because it is the
     # simplest approach to changing $(DEPDIR) to its actual value in the
     # expansion.
     for file in `sed -n "
       s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
-	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
+	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
       # Make sure the directory exists.
       test -f "$dirpart/$file" && continue
       fdir=`AS_DIRNAME(["$file"])`
@@ -408,7 +399,7 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
 # This macro should only be invoked once -- use via AC_REQUIRE.
 #
 # This code is only required when automatic dependency tracking
-# is enabled.  FIXME.  This creates each `.P' file that we will
+# is enabled.  FIXME.  This creates each '.P' file that we will
 # need in order to bootstrap the dependency handling code.
 AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
 [AC_CONFIG_COMMANDS([depfiles],
@@ -418,15 +409,12 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
 
 # Do all the work for Automake.                             -*- Autoconf -*-
 
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-# 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
+# Copyright (C) 1996-2013 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 16
-
 # This macro actually does too much.  Some checks are only needed if
 # your package does certain things.  But this isn't really a big deal.
 
@@ -442,7 +430,7 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
 # arguments mandatory, and then we can depend on a new Autoconf
 # release and drop the old call support.
 AC_DEFUN([AM_INIT_AUTOMAKE],
-[AC_PREREQ([2.62])dnl
+[AC_PREREQ([2.65])dnl
 dnl Autoconf wants to disallow AM_ names.  We explicitly allow
 dnl the ones we care about.
 m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
@@ -471,31 +459,40 @@ AC_SUBST([CYGPATH_W])
 # Define the identity of the package.
 dnl Distinguish between old-style and new-style calls.
 m4_ifval([$2],
-[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
+[AC_DIAGNOSE([obsolete],
+             [$0: two- and three-arguments forms are deprecated.])
+m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
  AC_SUBST([PACKAGE], [$1])dnl
  AC_SUBST([VERSION], [$2])],
 [_AM_SET_OPTIONS([$1])dnl
 dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
-m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
+m4_if(
+  m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
+  [ok:ok],,
   [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
  AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
  AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
 
 _AM_IF_OPTION([no-define],,
-[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
- AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
+[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
+ AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
 
 # Some tools Automake needs.
 AC_REQUIRE([AM_SANITY_CHECK])dnl
 AC_REQUIRE([AC_ARG_PROGRAM])dnl
-AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
-AM_MISSING_PROG(AUTOCONF, autoconf)
-AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
-AM_MISSING_PROG(AUTOHEADER, autoheader)
-AM_MISSING_PROG(MAKEINFO, makeinfo)
+AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
+AM_MISSING_PROG([AUTOCONF], [autoconf])
+AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
+AM_MISSING_PROG([AUTOHEADER], [autoheader])
+AM_MISSING_PROG([MAKEINFO], [makeinfo])
 AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
 AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
-AC_REQUIRE([AM_PROG_MKDIR_P])dnl
+AC_REQUIRE([AC_PROG_MKDIR_P])dnl
+# For better backward compatibility.  To be removed once Automake 1.9.x
+# dies out for good.  For more background, see:
+# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
+# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
+AC_SUBST([mkdir_p], ['$(MKDIR_P)'])
 # We need awk for the "check" target.  The system "awk" is bad on
 # some platforms.
 AC_REQUIRE([AC_PROG_AWK])dnl
@@ -506,28 +503,32 @@ _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
 			     [_AM_PROG_TAR([v7])])])
 _AM_IF_OPTION([no-dependencies],,
 [AC_PROVIDE_IFELSE([AC_PROG_CC],
-		  [_AM_DEPENDENCIES(CC)],
-		  [define([AC_PROG_CC],
-			  defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
+		  [_AM_DEPENDENCIES([CC])],
+		  [m4_define([AC_PROG_CC],
+			     m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
 AC_PROVIDE_IFELSE([AC_PROG_CXX],
-		  [_AM_DEPENDENCIES(CXX)],
-		  [define([AC_PROG_CXX],
-			  defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
+		  [_AM_DEPENDENCIES([CXX])],
+		  [m4_define([AC_PROG_CXX],
+			     m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
 AC_PROVIDE_IFELSE([AC_PROG_OBJC],
-		  [_AM_DEPENDENCIES(OBJC)],
-		  [define([AC_PROG_OBJC],
-			  defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
+		  [_AM_DEPENDENCIES([OBJC])],
+		  [m4_define([AC_PROG_OBJC],
+			     m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
+		  [_AM_DEPENDENCIES([OBJCXX])],
+		  [m4_define([AC_PROG_OBJCXX],
+			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
 ])
-_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
-dnl The `parallel-tests' driver may need to know about EXEEXT, so add the
-dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This macro
-dnl is hooked onto _AC_COMPILER_EXEEXT early, see below.
+AC_REQUIRE([AM_SILENT_RULES])dnl
+dnl The testsuite driver may need to know about EXEEXT, so add the
+dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
+dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
 AC_CONFIG_COMMANDS_PRE(dnl
 [m4_provide_if([_AM_COMPILER_EXEEXT],
   [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
 ])
 
-dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
+dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
 dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
 dnl mangled by Autoconf and run in a shell conditional statement.
 m4_define([_AC_COMPILER_EXEEXT],
@@ -555,15 +556,12 @@ for _am_header in $config_headers :; do
 done
 echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
 
-# Copyright (C) 2001, 2003, 2005, 2008, 2011 Free Software Foundation,
-# Inc.
+# Copyright (C) 2001-2013 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 1
-
 # AM_PROG_INSTALL_SH
 # ------------------
 # Define $install_sh.
@@ -577,16 +575,14 @@ if test x"${install_sh}" != xset; then
     install_sh="\${SHELL} $am_aux_dir/install-sh"
   esac
 fi
-AC_SUBST(install_sh)])
+AC_SUBST([install_sh])])
 
-# Copyright (C) 2003, 2005  Free Software Foundation, Inc.
+# Copyright (C) 2003-2013 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 2
-
 # Check whether the underlying file-system supports filenames
 # with a leading dot.  For instance MS-DOS doesn't.
 AC_DEFUN([AM_SET_LEADING_DOT],
@@ -603,20 +599,17 @@ AC_SUBST([am__leading_dot])])
 # Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
 # From Jim Meyering
 
-# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008,
-# 2011 Free Software Foundation, Inc.
+# Copyright (C) 1996-2013 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 5
-
 # AM_MAINTAINER_MODE([DEFAULT-MODE])
 # ----------------------------------
 # Control maintainer-specific portions of Makefiles.
-# Default is to disable them, unless `enable' is passed literally.
-# For symmetry, `disable' may be passed as well.  Anyway, the user
+# Default is to disable them, unless 'enable' is passed literally.
+# For symmetry, 'disable' may be passed as well.  Anyway, the user
 # can override the default with the --enable/--disable switch.
 AC_DEFUN([AM_MAINTAINER_MODE],
 [m4_case(m4_default([$1], [disable]),
@@ -627,10 +620,11 @@ AC_DEFUN([AM_MAINTAINER_MODE],
 AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
   dnl maintainer-mode's default is 'disable' unless 'enable' is passed
   AC_ARG_ENABLE([maintainer-mode],
-[  --][am_maintainer_other][-maintainer-mode  am_maintainer_other make rules and dependencies not useful
-			  (and sometimes confusing) to the casual installer],
-      [USE_MAINTAINER_MODE=$enableval],
-      [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
+    [AS_HELP_STRING([--]am_maintainer_other[-maintainer-mode],
+      am_maintainer_other[ make rules and dependencies not useful
+      (and sometimes confusing) to the casual installer])],
+    [USE_MAINTAINER_MODE=$enableval],
+    [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
   AC_MSG_RESULT([$USE_MAINTAINER_MODE])
   AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
   MAINT=$MAINTAINER_MODE_TRUE
@@ -638,18 +632,14 @@ AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
 ]
 )
 
-AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
-
 # Check to see how 'make' treats includes.	            -*- Autoconf -*-
 
-# Copyright (C) 2001, 2002, 2003, 2005, 2009  Free Software Foundation, Inc.
+# Copyright (C) 2001-2013 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 4
-
 # AM_MAKE_INCLUDE()
 # -----------------
 # Check to see how make treats includes.
@@ -667,7 +657,7 @@ am__quote=
 _am_result=none
 # First try GNU make style include.
 echo "include confinc" > confmf
-# Ignore all kinds of additional output from `make'.
+# Ignore all kinds of additional output from 'make'.
 case `$am_make -s -f confmf 2> /dev/null` in #(
 *the\ am__doit\ target*)
   am__include=include
@@ -692,15 +682,12 @@ AC_MSG_RESULT([$_am_result])
 rm -f confinc confmf
 ])
 
-# Copyright (C) 1999, 2000, 2001, 2003, 2004, 2005, 2008
-# Free Software Foundation, Inc.
+# Copyright (C) 1999-2013 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 6
-
 # AM_PROG_CC_C_O
 # --------------
 # Like AC_PROG_CC_C_O, but changed for automake.
@@ -729,15 +716,12 @@ m4_define([AC_PROG_CC],
 
 # Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
 
-# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008
-# Free Software Foundation, Inc.
+# Copyright (C) 1997-2013 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 6
-
 # AM_MISSING_PROG(NAME, PROGRAM)
 # ------------------------------
 AC_DEFUN([AM_MISSING_PROG],
@@ -745,11 +729,10 @@ AC_DEFUN([AM_MISSING_PROG],
 $1=${$1-"${am_missing_run}$2"}
 AC_SUBST($1)])
 
-
 # AM_MISSING_HAS_RUN
 # ------------------
-# Define MISSING if not defined so far and test if it supports --run.
-# If it does, set am_missing_run to use it, otherwise, to nothing.
+# Define MISSING if not defined so far and test if it is modern enough.
+# If it is, set am_missing_run to use it, otherwise, to nothing.
 AC_DEFUN([AM_MISSING_HAS_RUN],
 [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
 AC_REQUIRE_AUX_FILE([missing])dnl
@@ -762,54 +745,22 @@ if test x"${MISSING+set}" != xset; then
   esac
 fi
 # Use eval to expand $SHELL
-if eval "$MISSING --run true"; then
-  am_missing_run="$MISSING --run "
+if eval "$MISSING --is-lightweight"; then
+  am_missing_run="$MISSING "
 else
   am_missing_run=
-  AC_MSG_WARN([`missing' script is too old or missing])
+  AC_MSG_WARN(['missing' script is too old or missing])
 fi
 ])
 
-# Copyright (C) 2003, 2004, 2005, 2006, 2011 Free Software Foundation,
-# Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# serial 1
-
-# AM_PROG_MKDIR_P
-# ---------------
-# Check for `mkdir -p'.
-AC_DEFUN([AM_PROG_MKDIR_P],
-[AC_PREREQ([2.60])dnl
-AC_REQUIRE([AC_PROG_MKDIR_P])dnl
-dnl Automake 1.8 to 1.9.6 used to define mkdir_p.  We now use MKDIR_P,
-dnl while keeping a definition of mkdir_p for backward compatibility.
-dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
-dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
-dnl Makefile.ins that do not define MKDIR_P, so we do our own
-dnl adjustment using top_builddir (which is defined more often than
-dnl MKDIR_P).
-AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
-case $mkdir_p in
-  [[\\/$]]* | ?:[[\\/]]*) ;;
-  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
-esac
-])
-
 # Helper functions for option handling.                     -*- Autoconf -*-
 
-# Copyright (C) 2001, 2002, 2003, 2005, 2008, 2010 Free Software
-# Foundation, Inc.
+# Copyright (C) 2001-2013 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 5
-
 # _AM_MANGLE_OPTION(NAME)
 # -----------------------
 AC_DEFUN([_AM_MANGLE_OPTION],
@@ -819,7 +770,7 @@ AC_DEFUN([_AM_MANGLE_OPTION],
 # --------------------
 # Set option NAME.  Presently that only means defining a flag for this option.
 AC_DEFUN([_AM_SET_OPTION],
-[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
+[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
 
 # _AM_SET_OPTIONS(OPTIONS)
 # ------------------------
@@ -835,22 +786,16 @@ AC_DEFUN([_AM_IF_OPTION],
 
 # Check to make sure that the build environment is sane.    -*- Autoconf -*-
 
-# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008
-# Free Software Foundation, Inc.
+# Copyright (C) 1996-2013 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 5
-
 # AM_SANITY_CHECK
 # ---------------
 AC_DEFUN([AM_SANITY_CHECK],
 [AC_MSG_CHECKING([whether build environment is sane])
-# Just in case
-sleep 1
-echo timestamp > conftest.file
 # Reject unsafe characters in $srcdir or the absolute working directory
 # name.  Accept space and tab only in the latter.
 am_lf='
@@ -861,32 +806,40 @@ case `pwd` in
 esac
 case $srcdir in
   *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
-    AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);;
+    AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
 esac
 
-# Do `set' in a subshell so we don't clobber the current shell's
+# Do 'set' in a subshell so we don't clobber the current shell's
 # arguments.  Must try -L first in case configure is actually a
 # symlink; some systems play weird games with the mod time of symlinks
 # (eg FreeBSD returns the mod time of the symlink's containing
 # directory).
 if (
-   set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
-   if test "$[*]" = "X"; then
-      # -L didn't work.
-      set X `ls -t "$srcdir/configure" conftest.file`
-   fi
-   rm -f conftest.file
-   if test "$[*]" != "X $srcdir/configure conftest.file" \
-      && test "$[*]" != "X conftest.file $srcdir/configure"; then
-
-      # If neither matched, then we have a broken ls.  This can happen
-      # if, for instance, CONFIG_SHELL is bash and it inherits a
-      # broken ls alias from the environment.  This has actually
-      # happened.  Such a system could not be considered "sane".
-      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
-alias in your environment])
-   fi
-
+   am_has_slept=no
+   for am_try in 1 2; do
+     echo "timestamp, slept: $am_has_slept" > conftest.file
+     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
+     if test "$[*]" = "X"; then
+	# -L didn't work.
+	set X `ls -t "$srcdir/configure" conftest.file`
+     fi
+     if test "$[*]" != "X $srcdir/configure conftest.file" \
+	&& test "$[*]" != "X conftest.file $srcdir/configure"; then
+
+	# If neither matched, then we have a broken ls.  This can happen
+	# if, for instance, CONFIG_SHELL is bash and it inherits a
+	# broken ls alias from the environment.  This has actually
+	# happened.  Such a system could not be considered "sane".
+	AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
+  alias in your environment])
+     fi
+     if test "$[2]" = conftest.file || test $am_try -eq 2; then
+       break
+     fi
+     # Just in case.
+     sleep 1
+     am_has_slept=yes
+   done
    test "$[2]" = conftest.file
    )
 then
@@ -896,31 +849,50 @@ else
    AC_MSG_ERROR([newly created file is older than distributed files!
 Check your system clock])
 fi
-AC_MSG_RESULT(yes)])
+AC_MSG_RESULT([yes])
+# If we didn't sleep, we still need to ensure time stamps of config.status and
+# generated files are strictly newer.
+am_sleep_pid=
+if grep 'slept: no' conftest.file >/dev/null 2>&1; then
+  ( sleep 1 ) &
+  am_sleep_pid=$!
+fi
+AC_CONFIG_COMMANDS_PRE(
+  [AC_MSG_CHECKING([that generated files are newer than configure])
+   if test -n "$am_sleep_pid"; then
+     # Hide warnings about reused PIDs.
+     wait $am_sleep_pid 2>/dev/null
+   fi
+   AC_MSG_RESULT([done])])
+rm -f conftest.file
+])
 
-# Copyright (C) 2009, 2011  Free Software Foundation, Inc.
+# Copyright (C) 2009-2013 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 2
-
 # AM_SILENT_RULES([DEFAULT])
 # --------------------------
 # Enable less verbose build rules; with the default set to DEFAULT
-# (`yes' being less verbose, `no' or empty being verbose).
+# ("yes" being less verbose, "no" or empty being verbose).
 AC_DEFUN([AM_SILENT_RULES],
-[AC_ARG_ENABLE([silent-rules],
-[  --enable-silent-rules          less verbose build output (undo: `make V=1')
-  --disable-silent-rules         verbose build output (undo: `make V=0')])
-case $enable_silent_rules in
-yes) AM_DEFAULT_VERBOSITY=0;;
-no)  AM_DEFAULT_VERBOSITY=1;;
-*)   AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
+[AC_ARG_ENABLE([silent-rules], [dnl
+AS_HELP_STRING(
+  [--enable-silent-rules],
+  [less verbose build output (undo: "make V=1")])
+AS_HELP_STRING(
+  [--disable-silent-rules],
+  [verbose build output (undo: "make V=0")])dnl
+])
+case $enable_silent_rules in @%:@ (((
+  yes) AM_DEFAULT_VERBOSITY=0;;
+   no) AM_DEFAULT_VERBOSITY=1;;
+    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
 esac
 dnl
-dnl A few `make' implementations (e.g., NonStop OS and NextStep)
+dnl A few 'make' implementations (e.g., NonStop OS and NextStep)
 dnl do not support nested variable expansions.
 dnl See automake bug#9928 and bug#10237.
 am_make=${MAKE-make}
@@ -938,7 +910,7 @@ else
   am_cv_make_support_nested_variables=no
 fi])
 if test $am_cv_make_support_nested_variables = yes; then
-  dnl Using `$V' instead of `$(V)' breaks IRIX make.
+  dnl Using '$V' instead of '$(V)' breaks IRIX make.
   AM_V='$(V)'
   AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
 else
@@ -955,44 +927,40 @@ AC_SUBST([AM_BACKSLASH])dnl
 _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
 ])
 
-# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
+# Copyright (C) 2001-2013 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 1
-
 # AM_PROG_INSTALL_STRIP
 # ---------------------
-# One issue with vendor `install' (even GNU) is that you can't
+# One issue with vendor 'install' (even GNU) is that you can't
 # specify the program used to strip binaries.  This is especially
 # annoying in cross-compiling environments, where the build's strip
 # is unlikely to handle the host's binaries.
 # Fortunately install-sh will honor a STRIPPROG variable, so we
-# always use install-sh in `make install-strip', and initialize
+# always use install-sh in "make install-strip", and initialize
 # STRIPPROG with the value of the STRIP variable (set by the user).
 AC_DEFUN([AM_PROG_INSTALL_STRIP],
 [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
-# Installed binaries are usually stripped using `strip' when the user
-# run `make install-strip'.  However `strip' might not be the right
+# Installed binaries are usually stripped using 'strip' when the user
+# run "make install-strip".  However 'strip' might not be the right
 # tool to use in cross-compilation environments, therefore Automake
-# will honor the `STRIP' environment variable to overrule this program.
-dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
+# will honor the 'STRIP' environment variable to overrule this program.
+dnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
 if test "$cross_compiling" != no; then
   AC_CHECK_TOOL([STRIP], [strip], :)
 fi
 INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
 AC_SUBST([INSTALL_STRIP_PROGRAM])])
 
-# Copyright (C) 2006, 2008, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2006-2013 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 3
-
 # _AM_SUBST_NOTMAKE(VARIABLE)
 # ---------------------------
 # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
@@ -1006,18 +974,16 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
 
 # Check how to create a tarball.                            -*- Autoconf -*-
 
-# Copyright (C) 2004, 2005, 2012 Free Software Foundation, Inc.
+# Copyright (C) 2004-2013 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 2
-
 # _AM_PROG_TAR(FORMAT)
 # --------------------
 # Check how to create a tarball in format FORMAT.
-# FORMAT should be one of `v7', `ustar', or `pax'.
+# FORMAT should be one of 'v7', 'ustar', or 'pax'.
 #
 # Substitute a variable $(am__tar) that is a command
 # writing to stdout a FORMAT-tarball containing the directory
@@ -1027,76 +993,114 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
 # Substitute a variable $(am__untar) that extract such
 # a tarball read from stdin.
 #     $(am__untar) < result.tar
+#
 AC_DEFUN([_AM_PROG_TAR],
 [# Always define AMTAR for backward compatibility.  Yes, it's still used
 # in the wild :-(  We should find a proper way to deprecate it ...
 AC_SUBST([AMTAR], ['$${TAR-tar}'])
-m4_if([$1], [v7],
-     [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
-     [m4_case([$1], [ustar],, [pax],,
-              [m4_fatal([Unknown tar format])])
-AC_MSG_CHECKING([how to create a $1 tar archive])
-# Loop over all known methods to create a tar archive until one works.
+
+# We'll loop over all known methods to create a tar archive until one works.
 _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
-_am_tools=${am_cv_prog_tar_$1-$_am_tools}
-# Do not fold the above two line into one, because Tru64 sh and
-# Solaris sh will not grok spaces in the rhs of `-'.
-for _am_tool in $_am_tools
-do
-  case $_am_tool in
-  gnutar)
-    for _am_tar in tar gnutar gtar;
-    do
-      AM_RUN_LOG([$_am_tar --version]) && break
-    done
-    am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
-    am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
-    am__untar="$_am_tar -xf -"
-    ;;
-  plaintar)
-    # Must skip GNU tar: if it does not support --format= it doesn't create
-    # ustar tarball either.
-    (tar --version) >/dev/null 2>&1 && continue
-    am__tar='tar chf - "$$tardir"'
-    am__tar_='tar chf - "$tardir"'
-    am__untar='tar xf -'
-    ;;
-  pax)
-    am__tar='pax -L -x $1 -w "$$tardir"'
-    am__tar_='pax -L -x $1 -w "$tardir"'
-    am__untar='pax -r'
-    ;;
-  cpio)
-    am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
-    am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
-    am__untar='cpio -i -H $1 -d'
-    ;;
-  none)
-    am__tar=false
-    am__tar_=false
-    am__untar=false
-    ;;
-  esac
 
-  # If the value was cached, stop now.  We just wanted to have am__tar
-  # and am__untar set.
-  test -n "${am_cv_prog_tar_$1}" && break
+m4_if([$1], [v7],
+  [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
+
+  [m4_case([$1],
+    [ustar],
+     [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
+      # There is notably a 21 bits limit for the UID and the GID.  In fact,
+      # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
+      # and bug#13588).
+      am_max_uid=2097151 # 2^21 - 1
+      am_max_gid=$am_max_uid
+      # The $UID and $GID variables are not portable, so we need to resort
+      # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
+      # below are definitely unexpected, so allow the users to see them
+      # (that is, avoid stderr redirection).
+      am_uid=`id -u || echo unknown`
+      am_gid=`id -g || echo unknown`
+      AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
+      if test $am_uid -le $am_max_uid; then
+         AC_MSG_RESULT([yes])
+      else
+         AC_MSG_RESULT([no])
+         _am_tools=none
+      fi
+      AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
+      if test $am_gid -le $am_max_gid; then
+         AC_MSG_RESULT([yes])
+      else
+        AC_MSG_RESULT([no])
+        _am_tools=none
+      fi],
+
+  [pax],
+    [],
+
+  [m4_fatal([Unknown tar format])])
+
+  AC_MSG_CHECKING([how to create a $1 tar archive])
+
+  # Go ahead even if we have the value already cached.  We do so because we
+  # need to set the values for the 'am__tar' and 'am__untar' variables.
+  _am_tools=${am_cv_prog_tar_$1-$_am_tools}
+
+  for _am_tool in $_am_tools; do
+    case $_am_tool in
+    gnutar)
+      for _am_tar in tar gnutar gtar; do
+        AM_RUN_LOG([$_am_tar --version]) && break
+      done
+      am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
+      am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
+      am__untar="$_am_tar -xf -"
+      ;;
+    plaintar)
+      # Must skip GNU tar: if it does not support --format= it doesn't create
+      # ustar tarball either.
+      (tar --version) >/dev/null 2>&1 && continue
+      am__tar='tar chf - "$$tardir"'
+      am__tar_='tar chf - "$tardir"'
+      am__untar='tar xf -'
+      ;;
+    pax)
+      am__tar='pax -L -x $1 -w "$$tardir"'
+      am__tar_='pax -L -x $1 -w "$tardir"'
+      am__untar='pax -r'
+      ;;
+    cpio)
+      am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
+      am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
+      am__untar='cpio -i -H $1 -d'
+      ;;
+    none)
+      am__tar=false
+      am__tar_=false
+      am__untar=false
+      ;;
+    esac
 
-  # tar/untar a dummy directory, and stop if the command works
-  rm -rf conftest.dir
-  mkdir conftest.dir
-  echo GrepMe > conftest.dir/file
-  AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
+    # If the value was cached, stop now.  We just wanted to have am__tar
+    # and am__untar set.
+    test -n "${am_cv_prog_tar_$1}" && break
+
+    # tar/untar a dummy directory, and stop if the command works.
+    rm -rf conftest.dir
+    mkdir conftest.dir
+    echo GrepMe > conftest.dir/file
+    AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
+    rm -rf conftest.dir
+    if test -s conftest.tar; then
+      AM_RUN_LOG([$am__untar <conftest.tar])
+      AM_RUN_LOG([cat conftest.dir/file])
+      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
+    fi
+  done
   rm -rf conftest.dir
-  if test -s conftest.tar; then
-    AM_RUN_LOG([$am__untar <conftest.tar])
-    grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
-  fi
-done
-rm -rf conftest.dir
 
-AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
-AC_MSG_RESULT([$am_cv_prog_tar_$1])])
+  AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
+  AC_MSG_RESULT([$am_cv_prog_tar_$1])])
+
 AC_SUBST([am__tar])
 AC_SUBST([am__untar])
 ]) # _AM_PROG_TAR
diff --git a/checks/Makefile.am b/checks/Makefile.am
index 1c4f4f9..b14a61e 100644
--- a/checks/Makefile.am
+++ b/checks/Makefile.am
@@ -41,9 +41,8 @@ input_files = $(phenofiles) $(genofiles) run_diff.sh test_all.sh
 check_SCRIPTS =
 
 
-TESTS_ENVIRONMENT = bash
 if BUILD_palinear
-check_SCRIPTS += check_probabel.pl_chunk.sh check_dose_input.sh
+check_SCRIPTS += check_probabel_chunk.sh check_dose_input.sh
 check_SCRIPTS += test_qt.sh test_mms.sh
 endif
 if BUILD_palogist
@@ -53,13 +52,11 @@ if BUILD_pacoxph
 check_SCRIPTS +=  test_cox.sh
 endif
 
-
-
+AM_TESTS_ENVIRONMENT= \
+	PA_BINDIR=$(top_builddir)/src
 TESTS = $(check_SCRIPTS)
 
-testsdir = $(pkgdatadir)/tests
-dist_tests_DATA = $(verified_results) $(input_files)
-dist_tests_SCRIPTS = $(check_SCRIPTS)
+EXTRA_DIST = $(verified_results) $(input_files) $(check_SCRIPTS)
 
 
 ##################################################
@@ -73,46 +70,46 @@ logist_prob_fv_add.out.txt logist_prob_over_domin.out.txt	\
 logist_prob_domin.out.txt logist_prob_fv_recess.out.txt		\
 logist_prob_fv_over_domin.out.txt logist_prob_recess.out.txt
 
-cleanfiles_qt = height_base_add.out.txt height_base_fv_add.out.txt	\
-height_allcov_add.out.txt height_allcov_fv_add.out.txt			\
-height_int1_add.out.txt height_int1_fv_add.out.txt			\
-height_robust_add.out.txt height_robust_fv_add.out.txt			\
-height_robust_int1_add.out.txt height_robust_int1_fv_add.out.txt	\
-height_ngp2_add.out.txt height_ngp2_fv_add.out.txt			\
-height_ngp2_domin.out.txt height_ngp2_fv_domin.out.txt			\
-height_ngp2_over_domin.out.txt height_ngp2_fv_over_domin.out.txt	\
-height_ngp2_recess.out.txt height_ngp2_fv_recess.out.txt		\
-height_ngp2_2df.out.txt height_ngp2_fv_2df.out.txt			\
-height_ngp2_allcov_add.out.txt height_ngp2_allcov_fv_add.out.txt	\
-height_ngp2_allcov_domin.out.txt height_ngp2_allcov_fv_domin.out.txt	\
-height_ngp2_allcov_over_domin.out.txt					\
-height_ngp2_allcov_fv_over_domin.out.txt				\
-height_ngp2_allcov_recess.out.txt height_ngp2_allcov_fv_recess.out.txt	\
-height_ngp2_allcov_recess.out.txt height_ngp2_allcov_fv_recess.out.txt	\
-height_ngp2_int1_add.out.txt height_ngp2_int1_fv_add.out.txt		\
-height_ngp2_int1_domin.out.txt height_ngp2_int1_fv_domin.out.txt	\
-height_ngp2_int1_over_domin.out.txt					\
-height_ngp2_int1_fv_over_domin.out.txt height_ngp2_int1_recess.out.txt	\
-height_ngp2_int1_fv_recess.out.txt height_ngp2_int1_2df.out.txt		\
-height_ngp2_int1_fv_2df.out.txt height_ngp2_robust_add.out.txt		\
-height_ngp2_robust_fv_add.out.txt height_ngp2_robust_domin.out.txt	\
-height_ngp2_robust_fv_domin.out.txt					\
-height_ngp2_robust_over_domin.out.txt					\
-height_ngp2_robust_fv_over_domin.out.txt				\
-height_ngp2_robust_recess.out.txt height_ngp2_robust_fv_recess.out.txt	\
-height_ngp2_robust_2df.out.txt height_ngp2_robust_fv_2df.out.txt	\
-height_ngp2_robust_int1_add.out.txt					\
-height_ngp2_robust_int1_fv_add.out.txt					\
-height_ngp2_robust_int1_domin.out.txt					\
-height_ngp2_robust_int1_fv_domin.out.txt				\
-height_ngp2_robust_int1_over_domin.out.txt				\
-height_ngp2_robust_int1_fv_over_domin.out.txt				\
-height_ngp2_robust_int1_recess.out.txt					\
-height_ngp2_robust_int1_fv_recess.out.txt				\
-height_ngp2_robust_int1_2df.out.txt					\
-height_ngp2_robust_int1_fv_2df.out.txt					\
-height_ngp2_allcov_fv_2df.out.txt height_ngp2_robust_fv_add.out.txt	\
-height_ngp2_allcov_2df.out.txt
+cleanfiles_qt = linear_base_add.out.txt linear_base_fv_add.out.txt	\
+linear_allcov_add.out.txt linear_allcov_fv_add.out.txt			\
+linear_int1_add.out.txt linear_int1_fv_add.out.txt			\
+linear_robust_add.out.txt linear_robust_fv_add.out.txt			\
+linear_robust_int1_add.out.txt linear_robust_int1_fv_add.out.txt	\
+linear_ngp2_add.out.txt linear_ngp2_fv_add.out.txt			\
+linear_ngp2_domin.out.txt linear_ngp2_fv_domin.out.txt			\
+linear_ngp2_over_domin.out.txt linear_ngp2_fv_over_domin.out.txt	\
+linear_ngp2_recess.out.txt linear_ngp2_fv_recess.out.txt		\
+linear_ngp2_2df.out.txt linear_ngp2_fv_2df.out.txt			\
+linear_ngp2_allcov_add.out.txt linear_ngp2_allcov_fv_add.out.txt	\
+linear_ngp2_allcov_domin.out.txt linear_ngp2_allcov_fv_domin.out.txt	\
+linear_ngp2_allcov_over_domin.out.txt					\
+linear_ngp2_allcov_fv_over_domin.out.txt				\
+linear_ngp2_allcov_recess.out.txt linear_ngp2_allcov_fv_recess.out.txt	\
+linear_ngp2_allcov_recess.out.txt linear_ngp2_allcov_fv_recess.out.txt	\
+linear_ngp2_int1_add.out.txt linear_ngp2_int1_fv_add.out.txt		\
+linear_ngp2_int1_domin.out.txt linear_ngp2_int1_fv_domin.out.txt	\
+linear_ngp2_int1_over_domin.out.txt					\
+linear_ngp2_int1_fv_over_domin.out.txt linear_ngp2_int1_recess.out.txt	\
+linear_ngp2_int1_fv_recess.out.txt linear_ngp2_int1_2df.out.txt		\
+linear_ngp2_int1_fv_2df.out.txt linear_ngp2_robust_add.out.txt		\
+linear_ngp2_robust_fv_add.out.txt linear_ngp2_robust_domin.out.txt	\
+linear_ngp2_robust_fv_domin.out.txt					\
+linear_ngp2_robust_over_domin.out.txt					\
+linear_ngp2_robust_fv_over_domin.out.txt				\
+linear_ngp2_robust_recess.out.txt linear_ngp2_robust_fv_recess.out.txt	\
+linear_ngp2_robust_2df.out.txt linear_ngp2_robust_fv_2df.out.txt	\
+linear_ngp2_robust_int1_add.out.txt					\
+linear_ngp2_robust_int1_fv_add.out.txt					\
+linear_ngp2_robust_int1_domin.out.txt					\
+linear_ngp2_robust_int1_fv_domin.out.txt				\
+linear_ngp2_robust_int1_over_domin.out.txt				\
+linear_ngp2_robust_int1_fv_over_domin.out.txt				\
+linear_ngp2_robust_int1_recess.out.txt					\
+linear_ngp2_robust_int1_fv_recess.out.txt				\
+linear_ngp2_robust_int1_2df.out.txt					\
+linear_ngp2_robust_int1_fv_2df.out.txt					\
+linear_ngp2_allcov_fv_2df.out.txt linear_ngp2_robust_fv_add.out.txt	\
+linear_ngp2_allcov_2df.out.txt
 
 cleanfiles_mms = mmscore_dose_add.out.txt mmscore_dose_fv_add.out.txt	\
 mmscore_prob_fv_over_domin.out.txt mmscore_prob_fv_domin.out.txt	\
@@ -142,7 +139,7 @@ output_files = height_add.out.txt height_2df.out.txt			\
  height_ngp2_over_domin.out.txt height_ngp2_2df.out.txt			\
  height_ngp2_add.out.txt height_base_add.out.txt
 
-other_files = probabel.pl probabel_config.cfg
+other_files = probabel probabel_config.cfg
 
 cleanfiles_probabel_check = height.PHE $(dose_files) $(prob_files)	\
  $(map_files) $(info_files) $(output_files) $(other_files)
diff --git a/checks/Makefile.in b/checks/Makefile.in
index bed86f5..452d1dd 100644
--- a/checks/Makefile.in
+++ b/checks/Makefile.in
@@ -1,9 +1,8 @@
-# Makefile.in generated by automake 1.11.6 from Makefile.am.
+# Makefile.in generated by automake 1.13.3 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# Copyright (C) 1994-2013 Free Software Foundation, Inc.
+
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -14,26 +13,52 @@
 # PARTICULAR PURPOSE.
 
 @SET_MAKE@
-
-
 VPATH = @srcdir@
-am__make_dryrun = \
-  { \
-    am__dry=no; \
+am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
+am__make_running_with_option = \
+  case $${target_option-} in \
+      ?) ;; \
+      *) echo "am__make_running_with_option: internal error: invalid" \
+              "target option '$${target_option-}' specified" >&2; \
+         exit 1;; \
+  esac; \
+  has_opt=no; \
+  sane_makeflags=$$MAKEFLAGS; \
+  if $(am__is_gnu_make); then \
+    sane_makeflags=$$MFLAGS; \
+  else \
     case $$MAKEFLAGS in \
       *\\[\ \	]*) \
-        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
-          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
-      *) \
-        for am__flg in $$MAKEFLAGS; do \
-          case $$am__flg in \
-            *=*|--*) ;; \
-            *n*) am__dry=yes; break;; \
-          esac; \
-        done;; \
+        bs=\\; \
+        sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+          | sed "s/$$bs$$bs[$$bs $$bs	]*//g"`;; \
     esac; \
-    test $$am__dry = yes; \
-  }
+  fi; \
+  skip_next=no; \
+  strip_trailopt () \
+  { \
+    flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+  }; \
+  for flg in $$sane_makeflags; do \
+    test $$skip_next = yes && { skip_next=no; continue; }; \
+    case $$flg in \
+      *=*|--*) continue;; \
+        -*I) strip_trailopt 'I'; skip_next=yes;; \
+      -*I?*) strip_trailopt 'I';; \
+        -*O) strip_trailopt 'O'; skip_next=yes;; \
+      -*O?*) strip_trailopt 'O';; \
+        -*l) strip_trailopt 'l'; skip_next=yes;; \
+      -*l?*) strip_trailopt 'l';; \
+      -[dEDm]) skip_next=yes;; \
+      -[JT]) skip_next=yes;; \
+    esac; \
+    case $$flg in \
+      *$$target_option*) has_opt=yes; break;; \
+    esac; \
+  done; \
+  test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
 pkgdatadir = $(datadir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
@@ -50,14 +75,14 @@ POST_INSTALL = :
 NORMAL_UNINSTALL = :
 PRE_UNINSTALL = :
 POST_UNINSTALL = :
- at BUILD_palinear_TRUE@am__append_1 = check_probabel.pl_chunk.sh \
+ at BUILD_palinear_TRUE@am__append_1 = check_probabel_chunk.sh \
 @BUILD_palinear_TRUE@	check_dose_input.sh test_qt.sh \
 @BUILD_palinear_TRUE@	test_mms.sh
 @BUILD_palogist_TRUE at am__append_2 = test_bt.sh
 @BUILD_pacoxph_TRUE at am__append_3 = test_cox.sh
 subdir = checks
-DIST_COMMON = $(am__dist_tests_SCRIPTS_DIST) $(dist_tests_DATA) \
-	$(srcdir)/Makefile.am $(srcdir)/Makefile.in
+DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
+	$(top_srcdir)/test-driver
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
@@ -66,9 +91,48 @@ mkinstalldirs = $(install_sh) -d
 CONFIG_HEADER = $(top_builddir)/src/config.h
 CONFIG_CLEAN_FILES =
 CONFIG_CLEAN_VPATH_FILES =
-am__dist_tests_SCRIPTS_DIST = check_probabel.pl_chunk.sh \
-	check_dose_input.sh test_qt.sh test_mms.sh test_bt.sh \
-	test_cox.sh
+AM_V_P = $(am__v_P_ at AM_V@)
+am__v_P_ = $(am__v_P_ at AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_ at AM_V@)
+am__v_GEN_ = $(am__v_GEN_ at AM_DEFAULT_V@)
+am__v_GEN_0 = @echo "  GEN     " $@;
+am__v_GEN_1 = 
+AM_V_at = $(am__v_at_ at AM_V@)
+am__v_at_ = $(am__v_at_ at AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 = 
+SOURCES =
+DIST_SOURCES =
+am__can_run_installinfo = \
+  case $$AM_UPDATE_INFO_DIR in \
+    n|no|NO) false;; \
+    *) (install-info --version) >/dev/null 2>&1;; \
+  esac
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+am__tty_colors_dummy = \
+  mgn= red= grn= lgn= blu= brg= std=; \
+  am__color_tests=no
+am__tty_colors = { \
+  $(am__tty_colors_dummy); \
+  if test "X$(AM_COLOR_TESTS)" = Xno; then \
+    am__color_tests=no; \
+  elif test "X$(AM_COLOR_TESTS)" = Xalways; then \
+    am__color_tests=yes; \
+  elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \
+    am__color_tests=yes; \
+  fi; \
+  if test $$am__color_tests = yes; then \
+    red=''; \
+    grn=''; \
+    lgn=''; \
+    blu=''; \
+    mgn=''; \
+    brg=''; \
+    std=''; \
+  fi; \
+}
 am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
 am__vpath_adj = case $$p in \
     $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
@@ -96,37 +160,161 @@ am__uninstall_files_from_dir = { \
     || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
          $(am__cd) "$$dir" && rm -f $$files; }; \
   }
-am__installdirs = "$(DESTDIR)$(testsdir)" "$(DESTDIR)$(testsdir)"
-SCRIPTS = $(dist_tests_SCRIPTS)
-AM_V_GEN = $(am__v_GEN_ at AM_V@)
-am__v_GEN_ = $(am__v_GEN_ at AM_DEFAULT_V@)
-am__v_GEN_0 = @echo "  GEN   " $@;
-AM_V_at = $(am__v_at_ at AM_V@)
-am__v_at_ = $(am__v_at_ at AM_DEFAULT_V@)
-am__v_at_0 = @
-SOURCES =
-DIST_SOURCES =
-am__can_run_installinfo = \
-  case $$AM_UPDATE_INFO_DIR in \
-    n|no|NO) false;; \
-    *) (install-info --version) >/dev/null 2>&1;; \
+am__recheck_rx = ^[ 	]*:recheck:[ 	]*
+am__global_test_result_rx = ^[ 	]*:global-test-result:[ 	]*
+am__copy_in_global_log_rx = ^[ 	]*:copy-in-global-log:[ 	]*
+# A command that, given a newline-separated list of test names on the
+# standard input, print the name of the tests that are to be re-run
+# upon "make recheck".
+am__list_recheck_tests = $(AWK) '{ \
+  recheck = 1; \
+  while ((rc = (getline line < ($$0 ".trs"))) != 0) \
+    { \
+      if (rc < 0) \
+        { \
+          if ((getline line2 < ($$0 ".log")) < 0) \
+	    recheck = 0; \
+          break; \
+        } \
+      else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \
+        { \
+          recheck = 0; \
+          break; \
+        } \
+      else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \
+        { \
+          break; \
+        } \
+    }; \
+  if (recheck) \
+    print $$0; \
+  close ($$0 ".trs"); \
+  close ($$0 ".log"); \
+}'
+# A command that, given a newline-separated list of test names on the
+# standard input, create the global log from their .trs and .log files.
+am__create_global_log = $(AWK) ' \
+function fatal(msg) \
+{ \
+  print "fatal: making $@: " msg | "cat >&2"; \
+  exit 1; \
+} \
+function rst_section(header) \
+{ \
+  print header; \
+  len = length(header); \
+  for (i = 1; i <= len; i = i + 1) \
+    printf "="; \
+  printf "\n\n"; \
+} \
+{ \
+  copy_in_global_log = 1; \
+  global_test_result = "RUN"; \
+  while ((rc = (getline line < ($$0 ".trs"))) != 0) \
+    { \
+      if (rc < 0) \
+         fatal("failed to read from " $$0 ".trs"); \
+      if (line ~ /$(am__global_test_result_rx)/) \
+        { \
+          sub("$(am__global_test_result_rx)", "", line); \
+          sub("[ 	]*$$", "", line); \
+          global_test_result = line; \
+        } \
+      else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \
+        copy_in_global_log = 0; \
+    }; \
+  if (copy_in_global_log) \
+    { \
+      rst_section(global_test_result ": " $$0); \
+      while ((rc = (getline line < ($$0 ".log"))) != 0) \
+      { \
+        if (rc < 0) \
+          fatal("failed to read from " $$0 ".log"); \
+        print line; \
+      }; \
+      printf "\n"; \
+    }; \
+  close ($$0 ".trs"); \
+  close ($$0 ".log"); \
+}'
+# Restructured Text title.
+am__rst_title = { sed 's/.*/   &   /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; }
+# Solaris 10 'make', and several other traditional 'make' implementations,
+# pass "-e" to $(SHELL), and POSIX 2008 even requires this.  Work around it
+# by disabling -e (using the XSI extension "set +e") if it's set.
+am__sh_e_setup = case $$- in *e*) set +e;; esac
+# Default flags passed to test drivers.
+am__common_driver_flags = \
+  --color-tests "$$am__color_tests" \
+  --enable-hard-errors "$$am__enable_hard_errors" \
+  --expect-failure "$$am__expect_failure"
+# To be inserted before the command running the test.  Creates the
+# directory for the log if needed.  Stores in $dir the directory
+# containing $f, in $tst the test, in $log the log.  Executes the
+# developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and
+# passes TESTS_ENVIRONMENT.  Set up options for the wrapper that
+# will run the test scripts (or their associated LOG_COMPILER, if
+# thy have one).
+am__check_pre = \
+$(am__sh_e_setup);					\
+$(am__vpath_adj_setup) $(am__vpath_adj)			\
+$(am__tty_colors);					\
+srcdir=$(srcdir); export srcdir;			\
+case "$@" in						\
+  */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;;	\
+    *) am__odir=.;; 					\
+esac;							\
+test "x$$am__odir" = x"." || test -d "$$am__odir" 	\
+  || $(MKDIR_P) "$$am__odir" || exit $$?;		\
+if test -f "./$$f"; then dir=./;			\
+elif test -f "$$f"; then dir=;				\
+else dir="$(srcdir)/"; fi;				\
+tst=$$dir$$f; log='$@'; 				\
+if test -n '$(DISABLE_HARD_ERRORS)'; then		\
+  am__enable_hard_errors=no; 				\
+else							\
+  am__enable_hard_errors=yes; 				\
+fi; 							\
+case " $(XFAIL_TESTS) " in				\
+  *[\ \	]$$f[\ \	]* | *[\ \	]$$dir$$f[\ \	]*) \
+    am__expect_failure=yes;;				\
+  *)							\
+    am__expect_failure=no;;				\
+esac; 							\
+$(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT)
+# A shell command to get the names of the tests scripts with any registered
+# extension removed (i.e., equivalently, the names of the test logs, with
+# the '.log' extension removed).  The result is saved in the shell variable
+# '$bases'.  This honors runtime overriding of TESTS and TEST_LOGS.  Sadly,
+# we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)",
+# since that might cause problem with VPATH rewrites for suffix-less tests.
+# See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'.
+am__set_TESTS_bases = \
+  bases='$(TEST_LOGS)'; \
+  bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \
+  bases=`echo $$bases`
+RECHECK_LOGS = $(TEST_LOGS)
+AM_RECURSIVE_TARGETS = check recheck
+TEST_SUITE_LOG = test-suite.log
+TEST_EXTENSIONS = @EXEEXT@ .test
+LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver
+LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS)
+am__set_b = \
+  case '$@' in \
+    */*) \
+      case '$*' in \
+        */*) b='$*';; \
+          *) b=`echo '$@' | sed 's/\.log$$//'`; \
+       esac;; \
+    *) \
+      b='$*';; \
   esac
-DATA = $(dist_tests_DATA)
-# If stdout is a non-dumb tty, use colors.  If test -t is not supported,
-# then this fails; a conservative approach.  Of course do not redirect
-# stdout here, just stderr.
-am__tty_colors = \
-red=; grn=; lgn=; blu=; std=; \
-test "X$(AM_COLOR_TESTS)" != Xno \
-&& test "X$$TERM" != Xdumb \
-&& { test "X$(AM_COLOR_TESTS)" = Xalways || test -t 1 2>/dev/null; } \
-&& { \
-  red=''; \
-  grn=''; \
-  lgn=''; \
-  blu=''; \
-  std=''; \
-}
+am__test_logs1 = $(TESTS:=.log)
+am__test_logs2 = $(am__test_logs1:@EXEEXT at .log=.log)
+TEST_LOGS = $(am__test_logs2:.test.log=.log)
+TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver
+TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \
+	$(TEST_LOG_FLAGS)
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
 ALLOCA = @ALLOCA@
@@ -260,11 +448,11 @@ genofiles = $(input_files_dir)/test.mldose		\
 
 input_files = $(phenofiles) $(genofiles) run_diff.sh test_all.sh
 check_SCRIPTS = $(am__append_1) $(am__append_2) $(am__append_3)
-TESTS_ENVIRONMENT = bash
+AM_TESTS_ENVIRONMENT = \
+	PA_BINDIR=$(top_builddir)/src
+
 TESTS = $(check_SCRIPTS)
-testsdir = $(pkgdatadir)/tests
-dist_tests_DATA = $(verified_results) $(input_files)
-dist_tests_SCRIPTS = $(check_SCRIPTS)
+EXTRA_DIST = $(verified_results) $(input_files) $(check_SCRIPTS)
 
 ##################################################
 # Files that need to be cleaned up after testing
@@ -276,46 +464,46 @@ logist_prob_fv_add.out.txt logist_prob_over_domin.out.txt	\
 logist_prob_domin.out.txt logist_prob_fv_recess.out.txt		\
 logist_prob_fv_over_domin.out.txt logist_prob_recess.out.txt
 
-cleanfiles_qt = height_base_add.out.txt height_base_fv_add.out.txt	\
-height_allcov_add.out.txt height_allcov_fv_add.out.txt			\
-height_int1_add.out.txt height_int1_fv_add.out.txt			\
-height_robust_add.out.txt height_robust_fv_add.out.txt			\
-height_robust_int1_add.out.txt height_robust_int1_fv_add.out.txt	\
-height_ngp2_add.out.txt height_ngp2_fv_add.out.txt			\
-height_ngp2_domin.out.txt height_ngp2_fv_domin.out.txt			\
-height_ngp2_over_domin.out.txt height_ngp2_fv_over_domin.out.txt	\
-height_ngp2_recess.out.txt height_ngp2_fv_recess.out.txt		\
-height_ngp2_2df.out.txt height_ngp2_fv_2df.out.txt			\
-height_ngp2_allcov_add.out.txt height_ngp2_allcov_fv_add.out.txt	\
-height_ngp2_allcov_domin.out.txt height_ngp2_allcov_fv_domin.out.txt	\
-height_ngp2_allcov_over_domin.out.txt					\
-height_ngp2_allcov_fv_over_domin.out.txt				\
-height_ngp2_allcov_recess.out.txt height_ngp2_allcov_fv_recess.out.txt	\
-height_ngp2_allcov_recess.out.txt height_ngp2_allcov_fv_recess.out.txt	\
-height_ngp2_int1_add.out.txt height_ngp2_int1_fv_add.out.txt		\
-height_ngp2_int1_domin.out.txt height_ngp2_int1_fv_domin.out.txt	\
-height_ngp2_int1_over_domin.out.txt					\
-height_ngp2_int1_fv_over_domin.out.txt height_ngp2_int1_recess.out.txt	\
-height_ngp2_int1_fv_recess.out.txt height_ngp2_int1_2df.out.txt		\
-height_ngp2_int1_fv_2df.out.txt height_ngp2_robust_add.out.txt		\
-height_ngp2_robust_fv_add.out.txt height_ngp2_robust_domin.out.txt	\
-height_ngp2_robust_fv_domin.out.txt					\
-height_ngp2_robust_over_domin.out.txt					\
-height_ngp2_robust_fv_over_domin.out.txt				\
-height_ngp2_robust_recess.out.txt height_ngp2_robust_fv_recess.out.txt	\
-height_ngp2_robust_2df.out.txt height_ngp2_robust_fv_2df.out.txt	\
-height_ngp2_robust_int1_add.out.txt					\
-height_ngp2_robust_int1_fv_add.out.txt					\
-height_ngp2_robust_int1_domin.out.txt					\
-height_ngp2_robust_int1_fv_domin.out.txt				\
-height_ngp2_robust_int1_over_domin.out.txt				\
-height_ngp2_robust_int1_fv_over_domin.out.txt				\
-height_ngp2_robust_int1_recess.out.txt					\
-height_ngp2_robust_int1_fv_recess.out.txt				\
-height_ngp2_robust_int1_2df.out.txt					\
-height_ngp2_robust_int1_fv_2df.out.txt					\
-height_ngp2_allcov_fv_2df.out.txt height_ngp2_robust_fv_add.out.txt	\
-height_ngp2_allcov_2df.out.txt
+cleanfiles_qt = linear_base_add.out.txt linear_base_fv_add.out.txt	\
+linear_allcov_add.out.txt linear_allcov_fv_add.out.txt			\
+linear_int1_add.out.txt linear_int1_fv_add.out.txt			\
+linear_robust_add.out.txt linear_robust_fv_add.out.txt			\
+linear_robust_int1_add.out.txt linear_robust_int1_fv_add.out.txt	\
+linear_ngp2_add.out.txt linear_ngp2_fv_add.out.txt			\
+linear_ngp2_domin.out.txt linear_ngp2_fv_domin.out.txt			\
+linear_ngp2_over_domin.out.txt linear_ngp2_fv_over_domin.out.txt	\
+linear_ngp2_recess.out.txt linear_ngp2_fv_recess.out.txt		\
+linear_ngp2_2df.out.txt linear_ngp2_fv_2df.out.txt			\
+linear_ngp2_allcov_add.out.txt linear_ngp2_allcov_fv_add.out.txt	\
+linear_ngp2_allcov_domin.out.txt linear_ngp2_allcov_fv_domin.out.txt	\
+linear_ngp2_allcov_over_domin.out.txt					\
+linear_ngp2_allcov_fv_over_domin.out.txt				\
+linear_ngp2_allcov_recess.out.txt linear_ngp2_allcov_fv_recess.out.txt	\
+linear_ngp2_allcov_recess.out.txt linear_ngp2_allcov_fv_recess.out.txt	\
+linear_ngp2_int1_add.out.txt linear_ngp2_int1_fv_add.out.txt		\
+linear_ngp2_int1_domin.out.txt linear_ngp2_int1_fv_domin.out.txt	\
+linear_ngp2_int1_over_domin.out.txt					\
+linear_ngp2_int1_fv_over_domin.out.txt linear_ngp2_int1_recess.out.txt	\
+linear_ngp2_int1_fv_recess.out.txt linear_ngp2_int1_2df.out.txt		\
+linear_ngp2_int1_fv_2df.out.txt linear_ngp2_robust_add.out.txt		\
+linear_ngp2_robust_fv_add.out.txt linear_ngp2_robust_domin.out.txt	\
+linear_ngp2_robust_fv_domin.out.txt					\
+linear_ngp2_robust_over_domin.out.txt					\
+linear_ngp2_robust_fv_over_domin.out.txt				\
+linear_ngp2_robust_recess.out.txt linear_ngp2_robust_fv_recess.out.txt	\
+linear_ngp2_robust_2df.out.txt linear_ngp2_robust_fv_2df.out.txt	\
+linear_ngp2_robust_int1_add.out.txt					\
+linear_ngp2_robust_int1_fv_add.out.txt					\
+linear_ngp2_robust_int1_domin.out.txt					\
+linear_ngp2_robust_int1_fv_domin.out.txt				\
+linear_ngp2_robust_int1_over_domin.out.txt				\
+linear_ngp2_robust_int1_fv_over_domin.out.txt				\
+linear_ngp2_robust_int1_recess.out.txt					\
+linear_ngp2_robust_int1_fv_recess.out.txt				\
+linear_ngp2_robust_int1_2df.out.txt					\
+linear_ngp2_robust_int1_fv_2df.out.txt					\
+linear_ngp2_allcov_fv_2df.out.txt linear_ngp2_robust_fv_add.out.txt	\
+linear_ngp2_allcov_2df.out.txt
 
 cleanfiles_mms = mmscore_dose_add.out.txt mmscore_dose_fv_add.out.txt	\
 mmscore_prob_fv_over_domin.out.txt mmscore_prob_fv_domin.out.txt	\
@@ -343,7 +531,7 @@ output_files = height_add.out.txt height_2df.out.txt			\
  height_ngp2_over_domin.out.txt height_ngp2_2df.out.txt			\
  height_ngp2_add.out.txt height_base_add.out.txt
 
-other_files = probabel.pl probabel_config.cfg
+other_files = probabel probabel_config.cfg
 cleanfiles_probabel_check = height.PHE $(dose_files) $(prob_files)	\
  $(map_files) $(info_files) $(output_files) $(other_files)
 
@@ -354,6 +542,7 @@ CLEANFILES = $(cleanfiles_probabel_check) $(cleanfiles_dose_check)	\
 all: all-am
 
 .SUFFIXES:
+.SUFFIXES: .log .test .test$(EXEEXT) .trs
 $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
 	@for dep in $?; do \
 	  case '$(am__configure_deps)' in \
@@ -384,161 +573,210 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
 $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 $(am__aclocal_m4_deps):
-install-dist_testsSCRIPTS: $(dist_tests_SCRIPTS)
-	@$(NORMAL_INSTALL)
-	@list='$(dist_tests_SCRIPTS)'; test -n "$(testsdir)" || list=; \
-	if test -n "$$list"; then \
-	  echo " $(MKDIR_P) '$(DESTDIR)$(testsdir)'"; \
-	  $(MKDIR_P) "$(DESTDIR)$(testsdir)" || exit 1; \
+tags TAGS:
+
+ctags CTAGS:
+
+cscope cscopelist:
+
+
+# Recover from deleted '.trs' file; this should ensure that
+# "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create
+# both 'foo.log' and 'foo.trs'.  Break the recipe in two subshells
+# to avoid problems with "make -n".
+.log.trs:
+	rm -f $< $@
+	$(MAKE) $(AM_MAKEFLAGS) $<
+
+# Leading 'am--fnord' is there to ensure the list of targets does not
+# expand to empty, as could happen e.g. with make check TESTS=''.
+am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck)
+am--force-recheck:
+	@:
+
+$(TEST_SUITE_LOG): $(TEST_LOGS)
+	@$(am__set_TESTS_bases); \
+	am__f_ok () { test -f "$$1" && test -r "$$1"; }; \
+	redo_bases=`for i in $$bases; do \
+	              am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \
+	            done`; \
+	if test -n "$$redo_bases"; then \
+	  redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \
+	  redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \
+	  if $(am__make_dryrun); then :; else \
+	    rm -f $$redo_logs && rm -f $$redo_results || exit 1; \
+	  fi; \
 	fi; \
-	for p in $$list; do \
-	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
-	  if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \
-	done | \
-	sed -e 'p;s,.*/,,;n' \
-	    -e 'h;s|.*|.|' \
-	    -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \
-	$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \
-	  { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
-	    if ($$2 == $$4) { files[d] = files[d] " " $$1; \
-	      if (++n[d] == $(am__install_max)) { \
-		print "f", d, files[d]; n[d] = 0; files[d] = "" } } \
-	    else { print "f", d "/" $$4, $$1 } } \
-	  END { for (d in files) print "f", d, files[d] }' | \
-	while read type dir files; do \
-	     if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
-	     test -z "$$files" || { \
-	       echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(testsdir)$$dir'"; \
-	       $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(testsdir)$$dir" || exit $$?; \
-	     } \
-	; done
-
-uninstall-dist_testsSCRIPTS:
-	@$(NORMAL_UNINSTALL)
-	@list='$(dist_tests_SCRIPTS)'; test -n "$(testsdir)" || exit 0; \
-	files=`for p in $$list; do echo "$$p"; done | \
-	       sed -e 's,.*/,,;$(transform)'`; \
-	dir='$(DESTDIR)$(testsdir)'; $(am__uninstall_files_from_dir)
-install-dist_testsDATA: $(dist_tests_DATA)
-	@$(NORMAL_INSTALL)
-	@list='$(dist_tests_DATA)'; test -n "$(testsdir)" || list=; \
-	if test -n "$$list"; then \
-	  echo " $(MKDIR_P) '$(DESTDIR)$(testsdir)'"; \
-	  $(MKDIR_P) "$(DESTDIR)$(testsdir)" || exit 1; \
+	if test -n "$$am__remaking_logs"; then \
+	  echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \
+	       "recursion detected" >&2; \
+	else \
+	  am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \
 	fi; \
-	for p in $$list; do \
-	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
-	  echo "$$d$$p"; \
-	done | $(am__base_list) | \
-	while read files; do \
-	  echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(testsdir)'"; \
-	  $(INSTALL_DATA) $$files "$(DESTDIR)$(testsdir)" || exit $$?; \
-	done
-
-uninstall-dist_testsDATA:
-	@$(NORMAL_UNINSTALL)
-	@list='$(dist_tests_DATA)'; test -n "$(testsdir)" || list=; \
-	files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
-	dir='$(DESTDIR)$(testsdir)'; $(am__uninstall_files_from_dir)
-tags: TAGS
-TAGS:
-
-ctags: CTAGS
-CTAGS:
-
-
-check-TESTS: $(TESTS)
-	@failed=0; all=0; xfail=0; xpass=0; skip=0; \
-	srcdir=$(srcdir); export srcdir; \
-	list=' $(TESTS) '; \
-	$(am__tty_colors); \
-	if test -n "$$list"; then \
-	  for tst in $$list; do \
-	    if test -f ./$$tst; then dir=./; \
-	    elif test -f $$tst; then dir=; \
-	    else dir="$(srcdir)/"; fi; \
-	    if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \
-	      all=`expr $$all + 1`; \
-	      case " $(XFAIL_TESTS) " in \
-	      *[\ \	]$$tst[\ \	]*) \
-		xpass=`expr $$xpass + 1`; \
-		failed=`expr $$failed + 1`; \
-		col=$$red; res=XPASS; \
-	      ;; \
-	      *) \
-		col=$$grn; res=PASS; \
-	      ;; \
-	      esac; \
-	    elif test $$? -ne 77; then \
-	      all=`expr $$all + 1`; \
-	      case " $(XFAIL_TESTS) " in \
-	      *[\ \	]$$tst[\ \	]*) \
-		xfail=`expr $$xfail + 1`; \
-		col=$$lgn; res=XFAIL; \
-	      ;; \
-	      *) \
-		failed=`expr $$failed + 1`; \
-		col=$$red; res=FAIL; \
-	      ;; \
-	      esac; \
-	    else \
-	      skip=`expr $$skip + 1`; \
-	      col=$$blu; res=SKIP; \
-	    fi; \
-	    echo "$${col}$$res$${std}: $$tst"; \
+	if $(am__make_dryrun); then :; else \
+	  st=0;  \
+	  errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \
+	  for i in $$redo_bases; do \
+	    test -f $$i.trs && test -r $$i.trs \
+	      || { echo "$$errmsg $$i.trs" >&2; st=1; }; \
+	    test -f $$i.log && test -r $$i.log \
+	      || { echo "$$errmsg $$i.log" >&2; st=1; }; \
 	  done; \
-	  if test "$$all" -eq 1; then \
-	    tests="test"; \
-	    All=""; \
-	  else \
-	    tests="tests"; \
-	    All="All "; \
-	  fi; \
-	  if test "$$failed" -eq 0; then \
-	    if test "$$xfail" -eq 0; then \
-	      banner="$$All$$all $$tests passed"; \
+	  test $$st -eq 0 || exit 1; \
+	fi
+	@$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \
+	ws='[ 	]'; \
+	results=`for b in $$bases; do echo $$b.trs; done`; \
+	test -n "$$results" || results=/dev/null; \
+	all=`  grep "^$$ws*:test-result:"           $$results | wc -l`; \
+	pass=` grep "^$$ws*:test-result:$$ws*PASS"  $$results | wc -l`; \
+	fail=` grep "^$$ws*:test-result:$$ws*FAIL"  $$results | wc -l`; \
+	skip=` grep "^$$ws*:test-result:$$ws*SKIP"  $$results | wc -l`; \
+	xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \
+	xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \
+	error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \
+	if test `expr $$fail + $$xpass + $$error` -eq 0; then \
+	  success=true; \
+	else \
+	  success=false; \
+	fi; \
+	br='==================='; br=$$br$$br$$br$$br; \
+	result_count () \
+	{ \
+	    if test x"$$1" = x"--maybe-color"; then \
+	      maybe_colorize=yes; \
+	    elif test x"$$1" = x"--no-color"; then \
+	      maybe_colorize=no; \
 	    else \
-	      if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \
-	      banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \
+	      echo "$@: invalid 'result_count' usage" >&2; exit 4; \
 	    fi; \
-	  else \
-	    if test "$$xpass" -eq 0; then \
-	      banner="$$failed of $$all $$tests failed"; \
+	    shift; \
+	    desc=$$1 count=$$2; \
+	    if test $$maybe_colorize = yes && test $$count -gt 0; then \
+	      color_start=$$3 color_end=$$std; \
 	    else \
-	      if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \
-	      banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \
+	      color_start= color_end=; \
 	    fi; \
-	  fi; \
-	  dashes="$$banner"; \
-	  skipped=""; \
-	  if test "$$skip" -ne 0; then \
-	    if test "$$skip" -eq 1; then \
-	      skipped="($$skip test was not run)"; \
-	    else \
-	      skipped="($$skip tests were not run)"; \
-	    fi; \
-	    test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
-	      dashes="$$skipped"; \
-	  fi; \
-	  report=""; \
-	  if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
-	    report="Please report to $(PACKAGE_BUGREPORT)"; \
-	    test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
-	      dashes="$$report"; \
-	  fi; \
-	  dashes=`echo "$$dashes" | sed s/./=/g`; \
-	  if test "$$failed" -eq 0; then \
-	    col="$$grn"; \
-	  else \
-	    col="$$red"; \
-	  fi; \
-	  echo "$${col}$$dashes$${std}"; \
-	  echo "$${col}$$banner$${std}"; \
-	  test -z "$$skipped" || echo "$${col}$$skipped$${std}"; \
-	  test -z "$$report" || echo "$${col}$$report$${std}"; \
-	  echo "$${col}$$dashes$${std}"; \
-	  test "$$failed" -eq 0; \
-	else :; fi
+	    echo "$${color_start}# $$desc $$count$${color_end}"; \
+	}; \
+	create_testsuite_report () \
+	{ \
+	  result_count $$1 "TOTAL:" $$all   "$$brg"; \
+	  result_count $$1 "PASS: " $$pass  "$$grn"; \
+	  result_count $$1 "SKIP: " $$skip  "$$blu"; \
+	  result_count $$1 "XFAIL:" $$xfail "$$lgn"; \
+	  result_count $$1 "FAIL: " $$fail  "$$red"; \
+	  result_count $$1 "XPASS:" $$xpass "$$red"; \
+	  result_count $$1 "ERROR:" $$error "$$mgn"; \
+	}; \
+	{								\
+	  echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" |	\
+	    $(am__rst_title);						\
+	  create_testsuite_report --no-color;				\
+	  echo;								\
+	  echo ".. contents:: :depth: 2";				\
+	  echo;								\
+	  for b in $$bases; do echo $$b; done				\
+	    | $(am__create_global_log);					\
+	} >$(TEST_SUITE_LOG).tmp || exit 1;				\
+	mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG);			\
+	if $$success; then						\
+	  col="$$grn";							\
+	 else								\
+	  col="$$red";							\
+	  test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG);		\
+	fi;								\
+	echo "$${col}$$br$${std}"; 					\
+	echo "$${col}Testsuite summary for $(PACKAGE_STRING)$${std}";	\
+	echo "$${col}$$br$${std}"; 					\
+	create_testsuite_report --maybe-color;				\
+	echo "$$col$$br$$std";						\
+	if $$success; then :; else					\
+	  echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}";		\
+	  if test -n "$(PACKAGE_BUGREPORT)"; then			\
+	    echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}";	\
+	  fi;								\
+	  echo "$$col$$br$$std";					\
+	fi;								\
+	$$success || exit 1
+
+check-TESTS:
+	@list='$(RECHECK_LOGS)';           test -z "$$list" || rm -f $$list
+	@list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list
+	@test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
+	@set +e; $(am__set_TESTS_bases); \
+	log_list=`for i in $$bases; do echo $$i.log; done`; \
+	trs_list=`for i in $$bases; do echo $$i.trs; done`; \
+	log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \
+	$(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \
+	exit $$?;
+recheck: all $(check_SCRIPTS)
+	@test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
+	@set +e; $(am__set_TESTS_bases); \
+	bases=`for i in $$bases; do echo $$i; done \
+	         | $(am__list_recheck_tests)` || exit 1; \
+	log_list=`for i in $$bases; do echo $$i.log; done`; \
+	log_list=`echo $$log_list`; \
+	$(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \
+	        am__force_recheck=am--force-recheck \
+	        TEST_LOGS="$$log_list"; \
+	exit $$?
+check_probabel_chunk.sh.log: check_probabel_chunk.sh
+	@p='check_probabel_chunk.sh'; \
+	b='check_probabel_chunk.sh'; \
+	$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+	--log-file $$b.log --trs-file $$b.trs \
+	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+	"$$tst" $(AM_TESTS_FD_REDIRECT)
+check_dose_input.sh.log: check_dose_input.sh
+	@p='check_dose_input.sh'; \
+	b='check_dose_input.sh'; \
+	$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+	--log-file $$b.log --trs-file $$b.trs \
+	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+	"$$tst" $(AM_TESTS_FD_REDIRECT)
+test_qt.sh.log: test_qt.sh
+	@p='test_qt.sh'; \
+	b='test_qt.sh'; \
+	$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+	--log-file $$b.log --trs-file $$b.trs \
+	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+	"$$tst" $(AM_TESTS_FD_REDIRECT)
+test_mms.sh.log: test_mms.sh
+	@p='test_mms.sh'; \
+	b='test_mms.sh'; \
+	$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+	--log-file $$b.log --trs-file $$b.trs \
+	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+	"$$tst" $(AM_TESTS_FD_REDIRECT)
+test_bt.sh.log: test_bt.sh
+	@p='test_bt.sh'; \
+	b='test_bt.sh'; \
+	$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+	--log-file $$b.log --trs-file $$b.trs \
+	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+	"$$tst" $(AM_TESTS_FD_REDIRECT)
+test_cox.sh.log: test_cox.sh
+	@p='test_cox.sh'; \
+	b='test_cox.sh'; \
+	$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+	--log-file $$b.log --trs-file $$b.trs \
+	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+	"$$tst" $(AM_TESTS_FD_REDIRECT)
+.test.log:
+	@p='$<'; \
+	$(am__set_b); \
+	$(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \
+	--log-file $$b.log --trs-file $$b.trs \
+	$(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \
+	"$$tst" $(AM_TESTS_FD_REDIRECT)
+ at am__EXEEXT_TRUE@.test$(EXEEXT).log:
+ at am__EXEEXT_TRUE@	@p='$<'; \
+ at am__EXEEXT_TRUE@	$(am__set_b); \
+ at am__EXEEXT_TRUE@	$(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \
+ at am__EXEEXT_TRUE@	--log-file $$b.log --trs-file $$b.trs \
+ at am__EXEEXT_TRUE@	$(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \
+ at am__EXEEXT_TRUE@	"$$tst" $(AM_TESTS_FD_REDIRECT)
 
 distdir: $(DISTFILES)
 	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
@@ -574,11 +812,8 @@ check-am: all-am
 	$(MAKE) $(AM_MAKEFLAGS) $(check_SCRIPTS)
 	$(MAKE) $(AM_MAKEFLAGS) check-TESTS
 check: check-am
-all-am: Makefile $(SCRIPTS) $(DATA)
+all-am: Makefile
 installdirs:
-	for dir in "$(DESTDIR)$(testsdir)" "$(DESTDIR)$(testsdir)"; do \
-	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
-	done
 install: install-am
 install-exec: install-exec-am
 install-data: install-data-am
@@ -599,6 +834,9 @@ install-strip:
 	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
 	fi
 mostlyclean-generic:
+	-test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS)
+	-test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs)
+	-test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
 
 clean-generic:
 	-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
@@ -630,7 +868,7 @@ info: info-am
 
 info-am:
 
-install-data-am: install-dist_testsDATA install-dist_testsSCRIPTS
+install-data-am:
 
 install-dvi: install-dvi-am
 
@@ -674,21 +912,20 @@ ps: ps-am
 
 ps-am:
 
-uninstall-am: uninstall-dist_testsDATA uninstall-dist_testsSCRIPTS
+uninstall-am:
 
 .MAKE: check-am install-am install-strip
 
 .PHONY: all all-am check check-TESTS check-am clean clean-generic \
-	distclean distclean-generic distdir dvi dvi-am html html-am \
-	info info-am install install-am install-data install-data-am \
-	install-dist_testsDATA install-dist_testsSCRIPTS install-dvi \
-	install-dvi-am install-exec install-exec-am install-html \
-	install-html-am install-info install-info-am install-man \
-	install-pdf install-pdf-am install-ps install-ps-am \
-	install-strip installcheck installcheck-am installdirs \
-	maintainer-clean maintainer-clean-generic mostlyclean \
-	mostlyclean-generic pdf pdf-am ps ps-am uninstall uninstall-am \
-	uninstall-dist_testsDATA uninstall-dist_testsSCRIPTS
+	cscopelist-am ctags-am distclean distclean-generic distdir dvi \
+	dvi-am html html-am info info-am install install-am \
+	install-data install-data-am install-dvi install-dvi-am \
+	install-exec install-exec-am install-html install-html-am \
+	install-info install-info-am install-man install-pdf \
+	install-pdf-am install-ps install-ps-am install-strip \
+	installcheck installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-generic pdf \
+	pdf-am ps ps-am recheck tags-am uninstall uninstall-am
 
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
diff --git a/checks/R-tests/Makefile.am b/checks/R-tests/Makefile.am
new file mode 100644
index 0000000..91332df
--- /dev/null
+++ b/checks/R-tests/Makefile.am
@@ -0,0 +1,103 @@
+## Process this file with automake to produce Makefile.in
+
+AUTOMAKE_OPTIONS = foreign color-tests
+
+R_test_files = run_models_in_R_palinear.R run_model_linear.R	\
+ run_models_in_R_palogist.R run_model_logist.R			\
+ run_models_in_R_pacox.R run_model_coxph.R			\
+ initial_checks.R
+
+check_SCRIPTS =
+
+if HAVE_R
+if BUILD_palinear
+check_SCRIPTS += run_R_test_palinear.sh
+endif
+if BUILD_palogist
+check_SCRIPTS += run_R_test_palogist.sh
+endif
+if BUILD_pacoxph
+check_SCRIPTS += run_R_test_pacox.sh
+endif
+endif
+
+
+testsdir = $(pkgdatadir)/checks/R-tests
+AM_TESTS_ENVIRONMENT= \
+	PA_BINDIR=$(top_builddir)/src
+TESTS = $(check_SCRIPTS)
+
+## The palogist R test still doesn't run correctly.
+XFAIL_TESTS = run_R_test_palogist.sh
+
+EXTRA_DIST = $(check_SCRIPTS) $(R_test_files)
+
+
+##################################################
+# Files that need to be cleaned up after testing
+##################################################
+
+cleanfiles_bt = logist_add.out.txt logist_fv_add.out.txt	\
+logist_prob_2df.out.txt logist_prob_fv_2df.out.txt		\
+logist_prob_fv_domin.out.txt logist_prob_add.out.txt		\
+logist_prob_fv_add.out.txt logist_prob_over_domin.out.txt	\
+logist_prob_domin.out.txt logist_prob_fv_recess.out.txt		\
+logist_prob_fv_over_domin.out.txt logist_prob_recess.out.txt
+
+cleanfiles_qt = linear_base_add.out.txt linear_base_fv_add.out.txt	\
+linear_allcov_add.out.txt linear_allcov_fv_add.out.txt			\
+linear_int1_add.out.txt linear_int1_fv_add.out.txt			\
+linear_robust_add.out.txt linear_robust_fv_add.out.txt			\
+linear_robust_int1_add.out.txt linear_robust_int1_fv_add.out.txt	\
+linear_ngp2_add.out.txt linear_ngp2_fv_add.out.txt			\
+linear_ngp2_domin.out.txt linear_ngp2_fv_domin.out.txt			\
+linear_ngp2_over_domin.out.txt linear_ngp2_fv_over_domin.out.txt	\
+linear_ngp2_recess.out.txt linear_ngp2_fv_recess.out.txt		\
+linear_ngp2_2df.out.txt linear_ngp2_fv_2df.out.txt			\
+linear_ngp2_allcov_add.out.txt linear_ngp2_allcov_fv_add.out.txt	\
+linear_ngp2_allcov_domin.out.txt linear_ngp2_allcov_fv_domin.out.txt	\
+linear_ngp2_allcov_over_domin.out.txt					\
+linear_ngp2_allcov_fv_over_domin.out.txt				\
+linear_ngp2_allcov_recess.out.txt linear_ngp2_allcov_fv_recess.out.txt	\
+linear_ngp2_allcov_recess.out.txt linear_ngp2_allcov_fv_recess.out.txt	\
+linear_ngp2_int1_add.out.txt linear_ngp2_int1_fv_add.out.txt		\
+linear_ngp2_int1_domin.out.txt linear_ngp2_int1_fv_domin.out.txt	\
+linear_ngp2_int1_over_domin.out.txt					\
+linear_ngp2_int1_fv_over_domin.out.txt linear_ngp2_int1_recess.out.txt	\
+linear_ngp2_int1_fv_recess.out.txt linear_ngp2_int1_2df.out.txt		\
+linear_ngp2_int1_fv_2df.out.txt linear_ngp2_robust_add.out.txt		\
+linear_ngp2_robust_fv_add.out.txt linear_ngp2_robust_domin.out.txt	\
+linear_ngp2_robust_fv_domin.out.txt					\
+linear_ngp2_robust_over_domin.out.txt					\
+linear_ngp2_robust_fv_over_domin.out.txt				\
+linear_ngp2_robust_recess.out.txt linear_ngp2_robust_fv_recess.out.txt	\
+linear_ngp2_robust_2df.out.txt linear_ngp2_robust_fv_2df.out.txt	\
+linear_ngp2_robust_int1_add.out.txt					\
+linear_ngp2_robust_int1_fv_add.out.txt					\
+linear_ngp2_robust_int1_domin.out.txt					\
+linear_ngp2_robust_int1_fv_domin.out.txt				\
+linear_ngp2_robust_int1_over_domin.out.txt				\
+linear_ngp2_robust_int1_fv_over_domin.out.txt				\
+linear_ngp2_robust_int1_recess.out.txt					\
+linear_ngp2_robust_int1_fv_recess.out.txt				\
+linear_ngp2_robust_int1_2df.out.txt					\
+linear_ngp2_robust_int1_fv_2df.out.txt					\
+linear_ngp2_allcov_fv_2df.out.txt linear_ngp2_robust_fv_add.out.txt	\
+linear_ngp2_allcov_2df.out.txt
+
+cleanfiles_mms = mmscore_dose_add.out.txt mmscore_dose_fv_add.out.txt	\
+mmscore_prob_fv_over_domin.out.txt mmscore_prob_fv_domin.out.txt	\
+mmscore_prob_over_domin.out.txt mmscore_prob_fv_add.out.txt		\
+mmscore_prob_fv_recess.out.txt mmscore_prob_domin.out.txt		\
+mmscore_prob_recess.out.txt mmscore_prob_add.out.txt			\
+mmscore_prob_2df.out.txt mmscore_prob_fv_2df.out.txt
+
+cleanfiles_cox = coxph_dose_add.out.txt coxph_dose_fv_add.out.txt	\
+coxph_prob_fv_over_domin.out.txt coxph_prob_fv_domin.out.txt		\
+coxph_prob_over_domin.out.txt coxph_prob_fv_add.out.txt			\
+coxph_prob_fv_recess.out.txt coxph_prob_domin.out.txt			\
+coxph_prob_recess.out.txt coxph_prob_add.out.txt			\
+coxph_prob_2df.out.txt coxph_prob_fv_2df.out.txt
+
+CLEANFILES = $(cleanfiles_bt) $(cleanfiles_qt) $(cleanfiles_mms)	\
+ $(cleanfiles_cox)
diff --git a/checks/R-tests/Makefile.in b/checks/R-tests/Makefile.in
new file mode 100644
index 0000000..17e4000
--- /dev/null
+++ b/checks/R-tests/Makefile.in
@@ -0,0 +1,867 @@
+# Makefile.in generated by automake 1.13.3 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2013 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+VPATH = @srcdir@
+am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
+am__make_running_with_option = \
+  case $${target_option-} in \
+      ?) ;; \
+      *) echo "am__make_running_with_option: internal error: invalid" \
+              "target option '$${target_option-}' specified" >&2; \
+         exit 1;; \
+  esac; \
+  has_opt=no; \
+  sane_makeflags=$$MAKEFLAGS; \
+  if $(am__is_gnu_make); then \
+    sane_makeflags=$$MFLAGS; \
+  else \
+    case $$MAKEFLAGS in \
+      *\\[\ \	]*) \
+        bs=\\; \
+        sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+          | sed "s/$$bs$$bs[$$bs $$bs	]*//g"`;; \
+    esac; \
+  fi; \
+  skip_next=no; \
+  strip_trailopt () \
+  { \
+    flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+  }; \
+  for flg in $$sane_makeflags; do \
+    test $$skip_next = yes && { skip_next=no; continue; }; \
+    case $$flg in \
+      *=*|--*) continue;; \
+        -*I) strip_trailopt 'I'; skip_next=yes;; \
+      -*I?*) strip_trailopt 'I';; \
+        -*O) strip_trailopt 'O'; skip_next=yes;; \
+      -*O?*) strip_trailopt 'O';; \
+        -*l) strip_trailopt 'l'; skip_next=yes;; \
+      -*l?*) strip_trailopt 'l';; \
+      -[dEDm]) skip_next=yes;; \
+      -[JT]) skip_next=yes;; \
+    esac; \
+    case $$flg in \
+      *$$target_option*) has_opt=yes; break;; \
+    esac; \
+  done; \
+  test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+ at BUILD_palinear_TRUE@@HAVE_R_TRUE at am__append_1 = run_R_test_palinear.sh
+ at BUILD_palogist_TRUE@@HAVE_R_TRUE at am__append_2 = run_R_test_palogist.sh
+ at BUILD_pacoxph_TRUE@@HAVE_R_TRUE at am__append_3 = run_R_test_pacox.sh
+subdir = checks/R-tests
+DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
+	$(top_srcdir)/test-driver
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/src/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+AM_V_P = $(am__v_P_ at AM_V@)
+am__v_P_ = $(am__v_P_ at AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_ at AM_V@)
+am__v_GEN_ = $(am__v_GEN_ at AM_DEFAULT_V@)
+am__v_GEN_0 = @echo "  GEN     " $@;
+am__v_GEN_1 = 
+AM_V_at = $(am__v_at_ at AM_V@)
+am__v_at_ = $(am__v_at_ at AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 = 
+SOURCES =
+DIST_SOURCES =
+am__can_run_installinfo = \
+  case $$AM_UPDATE_INFO_DIR in \
+    n|no|NO) false;; \
+    *) (install-info --version) >/dev/null 2>&1;; \
+  esac
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+am__tty_colors_dummy = \
+  mgn= red= grn= lgn= blu= brg= std=; \
+  am__color_tests=no
+am__tty_colors = { \
+  $(am__tty_colors_dummy); \
+  if test "X$(AM_COLOR_TESTS)" = Xno; then \
+    am__color_tests=no; \
+  elif test "X$(AM_COLOR_TESTS)" = Xalways; then \
+    am__color_tests=yes; \
+  elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \
+    am__color_tests=yes; \
+  fi; \
+  if test $$am__color_tests = yes; then \
+    red=''; \
+    grn=''; \
+    lgn=''; \
+    blu=''; \
+    mgn=''; \
+    brg=''; \
+    std=''; \
+  fi; \
+}
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+    *) f=$$p;; \
+  esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+  srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+  for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+  for p in $$list; do echo "$$p $$p"; done | \
+  sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+  $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+    if (++n[$$2] == $(am__install_max)) \
+      { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+    END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+  sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+  test -z "$$files" \
+    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+         $(am__cd) "$$dir" && rm -f $$files; }; \
+  }
+am__recheck_rx = ^[ 	]*:recheck:[ 	]*
+am__global_test_result_rx = ^[ 	]*:global-test-result:[ 	]*
+am__copy_in_global_log_rx = ^[ 	]*:copy-in-global-log:[ 	]*
+# A command that, given a newline-separated list of test names on the
+# standard input, print the name of the tests that are to be re-run
+# upon "make recheck".
+am__list_recheck_tests = $(AWK) '{ \
+  recheck = 1; \
+  while ((rc = (getline line < ($$0 ".trs"))) != 0) \
+    { \
+      if (rc < 0) \
+        { \
+          if ((getline line2 < ($$0 ".log")) < 0) \
+	    recheck = 0; \
+          break; \
+        } \
+      else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \
+        { \
+          recheck = 0; \
+          break; \
+        } \
+      else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \
+        { \
+          break; \
+        } \
+    }; \
+  if (recheck) \
+    print $$0; \
+  close ($$0 ".trs"); \
+  close ($$0 ".log"); \
+}'
+# A command that, given a newline-separated list of test names on the
+# standard input, create the global log from their .trs and .log files.
+am__create_global_log = $(AWK) ' \
+function fatal(msg) \
+{ \
+  print "fatal: making $@: " msg | "cat >&2"; \
+  exit 1; \
+} \
+function rst_section(header) \
+{ \
+  print header; \
+  len = length(header); \
+  for (i = 1; i <= len; i = i + 1) \
+    printf "="; \
+  printf "\n\n"; \
+} \
+{ \
+  copy_in_global_log = 1; \
+  global_test_result = "RUN"; \
+  while ((rc = (getline line < ($$0 ".trs"))) != 0) \
+    { \
+      if (rc < 0) \
+         fatal("failed to read from " $$0 ".trs"); \
+      if (line ~ /$(am__global_test_result_rx)/) \
+        { \
+          sub("$(am__global_test_result_rx)", "", line); \
+          sub("[ 	]*$$", "", line); \
+          global_test_result = line; \
+        } \
+      else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \
+        copy_in_global_log = 0; \
+    }; \
+  if (copy_in_global_log) \
+    { \
+      rst_section(global_test_result ": " $$0); \
+      while ((rc = (getline line < ($$0 ".log"))) != 0) \
+      { \
+        if (rc < 0) \
+          fatal("failed to read from " $$0 ".log"); \
+        print line; \
+      }; \
+      printf "\n"; \
+    }; \
+  close ($$0 ".trs"); \
+  close ($$0 ".log"); \
+}'
+# Restructured Text title.
+am__rst_title = { sed 's/.*/   &   /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; }
+# Solaris 10 'make', and several other traditional 'make' implementations,
+# pass "-e" to $(SHELL), and POSIX 2008 even requires this.  Work around it
+# by disabling -e (using the XSI extension "set +e") if it's set.
+am__sh_e_setup = case $$- in *e*) set +e;; esac
+# Default flags passed to test drivers.
+am__common_driver_flags = \
+  --color-tests "$$am__color_tests" \
+  --enable-hard-errors "$$am__enable_hard_errors" \
+  --expect-failure "$$am__expect_failure"
+# To be inserted before the command running the test.  Creates the
+# directory for the log if needed.  Stores in $dir the directory
+# containing $f, in $tst the test, in $log the log.  Executes the
+# developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and
+# passes TESTS_ENVIRONMENT.  Set up options for the wrapper that
+# will run the test scripts (or their associated LOG_COMPILER, if
+# thy have one).
+am__check_pre = \
+$(am__sh_e_setup);					\
+$(am__vpath_adj_setup) $(am__vpath_adj)			\
+$(am__tty_colors);					\
+srcdir=$(srcdir); export srcdir;			\
+case "$@" in						\
+  */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;;	\
+    *) am__odir=.;; 					\
+esac;							\
+test "x$$am__odir" = x"." || test -d "$$am__odir" 	\
+  || $(MKDIR_P) "$$am__odir" || exit $$?;		\
+if test -f "./$$f"; then dir=./;			\
+elif test -f "$$f"; then dir=;				\
+else dir="$(srcdir)/"; fi;				\
+tst=$$dir$$f; log='$@'; 				\
+if test -n '$(DISABLE_HARD_ERRORS)'; then		\
+  am__enable_hard_errors=no; 				\
+else							\
+  am__enable_hard_errors=yes; 				\
+fi; 							\
+case " $(XFAIL_TESTS) " in				\
+  *[\ \	]$$f[\ \	]* | *[\ \	]$$dir$$f[\ \	]*) \
+    am__expect_failure=yes;;				\
+  *)							\
+    am__expect_failure=no;;				\
+esac; 							\
+$(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT)
+# A shell command to get the names of the tests scripts with any registered
+# extension removed (i.e., equivalently, the names of the test logs, with
+# the '.log' extension removed).  The result is saved in the shell variable
+# '$bases'.  This honors runtime overriding of TESTS and TEST_LOGS.  Sadly,
+# we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)",
+# since that might cause problem with VPATH rewrites for suffix-less tests.
+# See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'.
+am__set_TESTS_bases = \
+  bases='$(TEST_LOGS)'; \
+  bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \
+  bases=`echo $$bases`
+RECHECK_LOGS = $(TEST_LOGS)
+AM_RECURSIVE_TARGETS = check recheck
+TEST_SUITE_LOG = test-suite.log
+TEST_EXTENSIONS = @EXEEXT@ .test
+LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver
+LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS)
+am__set_b = \
+  case '$@' in \
+    */*) \
+      case '$*' in \
+        */*) b='$*';; \
+          *) b=`echo '$@' | sed 's/\.log$$//'`; \
+       esac;; \
+    *) \
+      b='$*';; \
+  esac
+am__test_logs1 = $(TESTS:=.log)
+am__test_logs2 = $(am__test_logs1:@EXEEXT at .log=.log)
+TEST_LOGS = $(am__test_logs2:.test.log=.log)
+TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver
+TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \
+	$(TEST_LOG_FLAGS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PDFLATEX = @PDFLATEX@
+R = @R@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build_alias = @build_alias@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host_alias = @host_alias@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+AUTOMAKE_OPTIONS = foreign color-tests
+R_test_files = run_models_in_R_palinear.R run_model_linear.R	\
+ run_models_in_R_palogist.R run_model_logist.R			\
+ run_models_in_R_pacox.R run_model_coxph.R			\
+ initial_checks.R
+
+check_SCRIPTS = $(am__append_1) $(am__append_2) $(am__append_3)
+testsdir = $(pkgdatadir)/checks/R-tests
+AM_TESTS_ENVIRONMENT = \
+	PA_BINDIR=$(top_builddir)/src
+
+TESTS = $(check_SCRIPTS)
+XFAIL_TESTS = run_R_test_palogist.sh
+EXTRA_DIST = $(check_SCRIPTS) $(R_test_files)
+
+##################################################
+# Files that need to be cleaned up after testing
+##################################################
+cleanfiles_bt = logist_add.out.txt logist_fv_add.out.txt	\
+logist_prob_2df.out.txt logist_prob_fv_2df.out.txt		\
+logist_prob_fv_domin.out.txt logist_prob_add.out.txt		\
+logist_prob_fv_add.out.txt logist_prob_over_domin.out.txt	\
+logist_prob_domin.out.txt logist_prob_fv_recess.out.txt		\
+logist_prob_fv_over_domin.out.txt logist_prob_recess.out.txt
+
+cleanfiles_qt = linear_base_add.out.txt linear_base_fv_add.out.txt	\
+linear_allcov_add.out.txt linear_allcov_fv_add.out.txt			\
+linear_int1_add.out.txt linear_int1_fv_add.out.txt			\
+linear_robust_add.out.txt linear_robust_fv_add.out.txt			\
+linear_robust_int1_add.out.txt linear_robust_int1_fv_add.out.txt	\
+linear_ngp2_add.out.txt linear_ngp2_fv_add.out.txt			\
+linear_ngp2_domin.out.txt linear_ngp2_fv_domin.out.txt			\
+linear_ngp2_over_domin.out.txt linear_ngp2_fv_over_domin.out.txt	\
+linear_ngp2_recess.out.txt linear_ngp2_fv_recess.out.txt		\
+linear_ngp2_2df.out.txt linear_ngp2_fv_2df.out.txt			\
+linear_ngp2_allcov_add.out.txt linear_ngp2_allcov_fv_add.out.txt	\
+linear_ngp2_allcov_domin.out.txt linear_ngp2_allcov_fv_domin.out.txt	\
+linear_ngp2_allcov_over_domin.out.txt					\
+linear_ngp2_allcov_fv_over_domin.out.txt				\
+linear_ngp2_allcov_recess.out.txt linear_ngp2_allcov_fv_recess.out.txt	\
+linear_ngp2_allcov_recess.out.txt linear_ngp2_allcov_fv_recess.out.txt	\
+linear_ngp2_int1_add.out.txt linear_ngp2_int1_fv_add.out.txt		\
+linear_ngp2_int1_domin.out.txt linear_ngp2_int1_fv_domin.out.txt	\
+linear_ngp2_int1_over_domin.out.txt					\
+linear_ngp2_int1_fv_over_domin.out.txt linear_ngp2_int1_recess.out.txt	\
+linear_ngp2_int1_fv_recess.out.txt linear_ngp2_int1_2df.out.txt		\
+linear_ngp2_int1_fv_2df.out.txt linear_ngp2_robust_add.out.txt		\
+linear_ngp2_robust_fv_add.out.txt linear_ngp2_robust_domin.out.txt	\
+linear_ngp2_robust_fv_domin.out.txt					\
+linear_ngp2_robust_over_domin.out.txt					\
+linear_ngp2_robust_fv_over_domin.out.txt				\
+linear_ngp2_robust_recess.out.txt linear_ngp2_robust_fv_recess.out.txt	\
+linear_ngp2_robust_2df.out.txt linear_ngp2_robust_fv_2df.out.txt	\
+linear_ngp2_robust_int1_add.out.txt					\
+linear_ngp2_robust_int1_fv_add.out.txt					\
+linear_ngp2_robust_int1_domin.out.txt					\
+linear_ngp2_robust_int1_fv_domin.out.txt				\
+linear_ngp2_robust_int1_over_domin.out.txt				\
+linear_ngp2_robust_int1_fv_over_domin.out.txt				\
+linear_ngp2_robust_int1_recess.out.txt					\
+linear_ngp2_robust_int1_fv_recess.out.txt				\
+linear_ngp2_robust_int1_2df.out.txt					\
+linear_ngp2_robust_int1_fv_2df.out.txt					\
+linear_ngp2_allcov_fv_2df.out.txt linear_ngp2_robust_fv_add.out.txt	\
+linear_ngp2_allcov_2df.out.txt
+
+cleanfiles_mms = mmscore_dose_add.out.txt mmscore_dose_fv_add.out.txt	\
+mmscore_prob_fv_over_domin.out.txt mmscore_prob_fv_domin.out.txt	\
+mmscore_prob_over_domin.out.txt mmscore_prob_fv_add.out.txt		\
+mmscore_prob_fv_recess.out.txt mmscore_prob_domin.out.txt		\
+mmscore_prob_recess.out.txt mmscore_prob_add.out.txt			\
+mmscore_prob_2df.out.txt mmscore_prob_fv_2df.out.txt
+
+cleanfiles_cox = coxph_dose_add.out.txt coxph_dose_fv_add.out.txt	\
+coxph_prob_fv_over_domin.out.txt coxph_prob_fv_domin.out.txt		\
+coxph_prob_over_domin.out.txt coxph_prob_fv_add.out.txt			\
+coxph_prob_fv_recess.out.txt coxph_prob_domin.out.txt			\
+coxph_prob_recess.out.txt coxph_prob_add.out.txt			\
+coxph_prob_2df.out.txt coxph_prob_fv_2df.out.txt
+
+CLEANFILES = $(cleanfiles_bt) $(cleanfiles_qt) $(cleanfiles_mms)	\
+ $(cleanfiles_cox)
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .log .test .test$(EXEEXT) .trs
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+	        && { if test -f $@; then exit 0; else break; fi; }; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign checks/R-tests/Makefile'; \
+	$(am__cd) $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign checks/R-tests/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+tags TAGS:
+
+ctags CTAGS:
+
+cscope cscopelist:
+
+
+# Recover from deleted '.trs' file; this should ensure that
+# "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create
+# both 'foo.log' and 'foo.trs'.  Break the recipe in two subshells
+# to avoid problems with "make -n".
+.log.trs:
+	rm -f $< $@
+	$(MAKE) $(AM_MAKEFLAGS) $<
+
+# Leading 'am--fnord' is there to ensure the list of targets does not
+# expand to empty, as could happen e.g. with make check TESTS=''.
+am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck)
+am--force-recheck:
+	@:
+
+$(TEST_SUITE_LOG): $(TEST_LOGS)
+	@$(am__set_TESTS_bases); \
+	am__f_ok () { test -f "$$1" && test -r "$$1"; }; \
+	redo_bases=`for i in $$bases; do \
+	              am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \
+	            done`; \
+	if test -n "$$redo_bases"; then \
+	  redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \
+	  redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \
+	  if $(am__make_dryrun); then :; else \
+	    rm -f $$redo_logs && rm -f $$redo_results || exit 1; \
+	  fi; \
+	fi; \
+	if test -n "$$am__remaking_logs"; then \
+	  echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \
+	       "recursion detected" >&2; \
+	else \
+	  am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \
+	fi; \
+	if $(am__make_dryrun); then :; else \
+	  st=0;  \
+	  errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \
+	  for i in $$redo_bases; do \
+	    test -f $$i.trs && test -r $$i.trs \
+	      || { echo "$$errmsg $$i.trs" >&2; st=1; }; \
+	    test -f $$i.log && test -r $$i.log \
+	      || { echo "$$errmsg $$i.log" >&2; st=1; }; \
+	  done; \
+	  test $$st -eq 0 || exit 1; \
+	fi
+	@$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \
+	ws='[ 	]'; \
+	results=`for b in $$bases; do echo $$b.trs; done`; \
+	test -n "$$results" || results=/dev/null; \
+	all=`  grep "^$$ws*:test-result:"           $$results | wc -l`; \
+	pass=` grep "^$$ws*:test-result:$$ws*PASS"  $$results | wc -l`; \
+	fail=` grep "^$$ws*:test-result:$$ws*FAIL"  $$results | wc -l`; \
+	skip=` grep "^$$ws*:test-result:$$ws*SKIP"  $$results | wc -l`; \
+	xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \
+	xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \
+	error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \
+	if test `expr $$fail + $$xpass + $$error` -eq 0; then \
+	  success=true; \
+	else \
+	  success=false; \
+	fi; \
+	br='==================='; br=$$br$$br$$br$$br; \
+	result_count () \
+	{ \
+	    if test x"$$1" = x"--maybe-color"; then \
+	      maybe_colorize=yes; \
+	    elif test x"$$1" = x"--no-color"; then \
+	      maybe_colorize=no; \
+	    else \
+	      echo "$@: invalid 'result_count' usage" >&2; exit 4; \
+	    fi; \
+	    shift; \
+	    desc=$$1 count=$$2; \
+	    if test $$maybe_colorize = yes && test $$count -gt 0; then \
+	      color_start=$$3 color_end=$$std; \
+	    else \
+	      color_start= color_end=; \
+	    fi; \
+	    echo "$${color_start}# $$desc $$count$${color_end}"; \
+	}; \
+	create_testsuite_report () \
+	{ \
+	  result_count $$1 "TOTAL:" $$all   "$$brg"; \
+	  result_count $$1 "PASS: " $$pass  "$$grn"; \
+	  result_count $$1 "SKIP: " $$skip  "$$blu"; \
+	  result_count $$1 "XFAIL:" $$xfail "$$lgn"; \
+	  result_count $$1 "FAIL: " $$fail  "$$red"; \
+	  result_count $$1 "XPASS:" $$xpass "$$red"; \
+	  result_count $$1 "ERROR:" $$error "$$mgn"; \
+	}; \
+	{								\
+	  echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" |	\
+	    $(am__rst_title);						\
+	  create_testsuite_report --no-color;				\
+	  echo;								\
+	  echo ".. contents:: :depth: 2";				\
+	  echo;								\
+	  for b in $$bases; do echo $$b; done				\
+	    | $(am__create_global_log);					\
+	} >$(TEST_SUITE_LOG).tmp || exit 1;				\
+	mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG);			\
+	if $$success; then						\
+	  col="$$grn";							\
+	 else								\
+	  col="$$red";							\
+	  test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG);		\
+	fi;								\
+	echo "$${col}$$br$${std}"; 					\
+	echo "$${col}Testsuite summary for $(PACKAGE_STRING)$${std}";	\
+	echo "$${col}$$br$${std}"; 					\
+	create_testsuite_report --maybe-color;				\
+	echo "$$col$$br$$std";						\
+	if $$success; then :; else					\
+	  echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}";		\
+	  if test -n "$(PACKAGE_BUGREPORT)"; then			\
+	    echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}";	\
+	  fi;								\
+	  echo "$$col$$br$$std";					\
+	fi;								\
+	$$success || exit 1
+
+check-TESTS:
+	@list='$(RECHECK_LOGS)';           test -z "$$list" || rm -f $$list
+	@list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list
+	@test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
+	@set +e; $(am__set_TESTS_bases); \
+	log_list=`for i in $$bases; do echo $$i.log; done`; \
+	trs_list=`for i in $$bases; do echo $$i.trs; done`; \
+	log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \
+	$(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \
+	exit $$?;
+recheck: all $(check_SCRIPTS)
+	@test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
+	@set +e; $(am__set_TESTS_bases); \
+	bases=`for i in $$bases; do echo $$i; done \
+	         | $(am__list_recheck_tests)` || exit 1; \
+	log_list=`for i in $$bases; do echo $$i.log; done`; \
+	log_list=`echo $$log_list`; \
+	$(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \
+	        am__force_recheck=am--force-recheck \
+	        TEST_LOGS="$$log_list"; \
+	exit $$?
+run_R_test_palinear.sh.log: run_R_test_palinear.sh
+	@p='run_R_test_palinear.sh'; \
+	b='run_R_test_palinear.sh'; \
+	$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+	--log-file $$b.log --trs-file $$b.trs \
+	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+	"$$tst" $(AM_TESTS_FD_REDIRECT)
+run_R_test_palogist.sh.log: run_R_test_palogist.sh
+	@p='run_R_test_palogist.sh'; \
+	b='run_R_test_palogist.sh'; \
+	$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+	--log-file $$b.log --trs-file $$b.trs \
+	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+	"$$tst" $(AM_TESTS_FD_REDIRECT)
+run_R_test_pacox.sh.log: run_R_test_pacox.sh
+	@p='run_R_test_pacox.sh'; \
+	b='run_R_test_pacox.sh'; \
+	$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+	--log-file $$b.log --trs-file $$b.trs \
+	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+	"$$tst" $(AM_TESTS_FD_REDIRECT)
+.test.log:
+	@p='$<'; \
+	$(am__set_b); \
+	$(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \
+	--log-file $$b.log --trs-file $$b.trs \
+	$(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \
+	"$$tst" $(AM_TESTS_FD_REDIRECT)
+ at am__EXEEXT_TRUE@.test$(EXEEXT).log:
+ at am__EXEEXT_TRUE@	@p='$<'; \
+ at am__EXEEXT_TRUE@	$(am__set_b); \
+ at am__EXEEXT_TRUE@	$(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \
+ at am__EXEEXT_TRUE@	--log-file $$b.log --trs-file $$b.trs \
+ at am__EXEEXT_TRUE@	$(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \
+ at am__EXEEXT_TRUE@	"$$tst" $(AM_TESTS_FD_REDIRECT)
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	list='$(DISTFILES)'; \
+	  dist_files=`for file in $$list; do echo $$file; done | \
+	  sed -e "s|^$$srcdirstrip/||;t" \
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+	case $$dist_files in \
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+			   sort -u` ;; \
+	esac; \
+	for file in $$dist_files; do \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  if test -d $$d/$$file; then \
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d "$(distdir)/$$file"; then \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
+	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+	  else \
+	    test -f "$(distdir)/$$file" \
+	    || cp -p $$d/$$file "$(distdir)/$$file" \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+	$(MAKE) $(AM_MAKEFLAGS) $(check_SCRIPTS)
+	$(MAKE) $(AM_MAKEFLAGS) check-TESTS
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	if test -z '$(STRIP)'; then \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	      install; \
+	else \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+	fi
+mostlyclean-generic:
+	-test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS)
+	-test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs)
+	-test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
+
+clean-generic:
+	-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic mostlyclean-am
+
+distclean: distclean-am
+	-rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: check-am install-am install-strip
+
+.PHONY: all all-am check check-TESTS check-am clean clean-generic \
+	cscopelist-am ctags-am distclean distclean-generic distdir dvi \
+	dvi-am html html-am info info-am install install-am \
+	install-data install-data-am install-dvi install-dvi-am \
+	install-exec install-exec-am install-html install-html-am \
+	install-info install-info-am install-man install-pdf \
+	install-pdf-am install-ps install-ps-am install-strip \
+	installcheck installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-generic pdf \
+	pdf-am ps ps-am recheck tags-am uninstall uninstall-am
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/checks/R-tests/initial_checks.R b/checks/R-tests/initial_checks.R
new file mode 100644
index 0000000..1e71560
--- /dev/null
+++ b/checks/R-tests/initial_checks.R
@@ -0,0 +1,93 @@
+## This file contains the parts of the R code that are shared by the
+## three R-based checks for palinear, palogist and pacoxph,
+## respectively.
+
+## Set tolerance for comparing various outputs
+tol <- 1e-5
+
+## R^2 threshold from the mlinfo file. If R^2 smaller than this
+## threshold, beta, se_beta and chi^2 are set to NaN.
+## Check this value against the one in the ProbABEL code (main.cpp),
+## look for the variables freq and poly.
+rsq.thresh <- 1e-16
+
+####
+## load the data
+####
+inputfiles.path <- paste0(srcdir, "../inputfiles/")
+tests.path      <- paste0(srcdir, "../")
+
+## load phenotypic data
+pheno <- read.table(paste0(inputfiles.path, pheno.file),
+                    head=TRUE, string=FALSE)
+
+## load genetic DOSE data
+dose <- read.table(paste0(inputfiles.path, "test.mldose"),
+                   head=FALSE, string=FALSE)
+## remove "1->" from the names of dose-IDs
+idNames   <- dose[, 1]
+idNames   <- sub("[0-9]+->", "", idNames)
+dose[, 1] <- idNames
+cat("Dose: check consistency of names\t\t")
+stopifnot( all.equal(dose[, 1], pheno[, 1], tol) )
+cat("OK\n")
+
+## load genetic PROB data
+prob <- read.table(paste0(inputfiles.path, "test.mlprob"),
+                   header=FALSE, stringsAsFactors=FALSE)
+## remove "1->" from the names of prob-IDs
+idNames   <- prob[, 1]
+idNames   <- sub("[0-9]+->", "", idNames)
+prob[, 1] <- idNames
+cat("Prob: check consistency of names\t\t")
+stopifnot( all.equal(prob[, 1], pheno[, 1], tol) )
+cat("OK\n")
+
+## check consistency DOSE <-> PROB
+doseFromProb <- matrix(NA, ncol=dim(dose)[2], nrow=dim(dose)[1])
+for (i in 3:dim(dose)[2]) {
+        indexHom <- 3 + ( i - 3 ) * 2
+        indexHet <- indexHom + 1
+        doseFromProb[, i] <- prob[, indexHom] * 2 + prob[, indexHet]
+}
+cat("Check consistency dose <-> prob gtdata\t\t")
+stopifnot( all.equal(dose[, 3:ncol(dose)],
+                     as.data.frame(doseFromProb)[,3:ncol(doseFromProb)],
+                     tol=tol )
+          )
+cat("OK\n")
+
+
+## Read the imputed Rsq from the info file
+Rsq <- read.table(paste0(inputfiles.path, "test.mlinfo"),
+                  header=TRUE,
+                  stringsAsFactors=FALSE)[, c("Rsq")]
+
+
+## Define column names of the various ProbABEL output file headers
+colsAddDose <- c("Rsq",
+                 "beta_SNP_add",
+                 "sebeta_SNP_add",
+                 "chi2_SNP")
+colsAddProb <- c("Rsq",
+                 "beta_SNP_addA1",
+                 "sebeta_SNP_addA1",
+                 "chi2_SNP_A1")
+colsDom <- c("Rsq",
+             "beta_SNP_domA1",
+             "sebeta_SNP_domA1",
+             "chi2_SNP_domA1")
+colsRec <- c("Rsq",
+             "beta_SNP_recA1",
+             "sebeta_SNP_recA1",
+             "chi2_SNP_recA1")
+colsOdom <-c("Rsq",
+             "beta_SNP_odomA1",
+             "sebeta_SNP_odomA1",
+             "chi2_SNP_odomA1")
+cols2df <- c("Rsq",
+             "beta_SNP_A1A2",
+             "sebeta_SNP_A1A2",
+             "beta_SNP_A1A1",
+             "sebeta_SNP_A1A1",
+             "chi2_SNP_2df")
diff --git a/checks/R-tests/run_R_test_pacox.sh b/checks/R-tests/run_R_test_pacox.sh
new file mode 100755
index 0000000..053d901
--- /dev/null
+++ b/checks/R-tests/run_R_test_pacox.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+#
+# This script runs the R-based tests for Cox PH regression
+
+Rcommand="R --vanilla --slave --quiet"
+
+if [ -z ${srcdir} ]; then
+    srcdir="."
+fi
+
+$Rcommand -f ${srcdir}/run_models_in_R_pacox.R --args ${srcdir}/
diff --git a/checks/R-tests/run_R_test_palinear.sh b/checks/R-tests/run_R_test_palinear.sh
new file mode 100755
index 0000000..a0f3d36
--- /dev/null
+++ b/checks/R-tests/run_R_test_palinear.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+#
+# This script runs the R-based tests for linear regression
+
+Rcommand="R --vanilla --slave"
+
+if [ -z ${srcdir} ]; then
+    srcdir="."
+fi
+
+$Rcommand -f ${srcdir}/run_models_in_R_palinear.R --args ${srcdir}/
diff --git a/checks/R-tests/run_R_test_palogist.sh b/checks/R-tests/run_R_test_palogist.sh
new file mode 100755
index 0000000..0dca0f0
--- /dev/null
+++ b/checks/R-tests/run_R_test_palogist.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+#
+# This script runs the R-based tests for logistic regression
+
+Rcommand="R --vanilla --slave"
+
+if [ -z ${srcdir} ]; then
+    srcdir="."
+fi
+
+$Rcommand -f ${srcdir}/run_models_in_R_palogist.R --args ${srcdir}/
diff --git a/checks/R-tests/run_model_coxph.R b/checks/R-tests/run_model_coxph.R
new file mode 100644
index 0000000..1454953
--- /dev/null
+++ b/checks/R-tests/run_model_coxph.R
@@ -0,0 +1,98 @@
+##' This function runs the actual models for Cox regression. It is
+##' called by run_models_in_R_pacox.R
+##'
+##'
+##' @title run.model
+##' @param model0.txt String containing the null model (without SNP term)
+##' @param model.txt String containing the alternative model (with SNP
+##' term)
+##' @param snpcomponent1 String telling how the SNP term is defined
+##' @param snpcomponent2 String telling how the second SNP term is
+##' defined (only used in the 2 df model). By default this term is
+##' constant ("1")
+##' @return A data frame containing the coefficients from the
+##' regression analysis and some other variables, such that this
+##' output can be compared to the ProbABEL output.
+##' @author L.C. Larsen
+run.model <- function(model0.txt, model.txt,
+                      snpcomponent1, snpcomponent2="1") {
+
+    if (snpcomponent2 != "1") {
+        ## SNP component 2 is not constant: assume we run the 2df
+        ## model.
+        twoDF = TRUE
+    } else {
+        twoDF = FALSE
+    }
+
+    resultR <- data.frame()
+
+    for (i in 3:dim(dose)[2]) {
+        indexHom <- 3 + ( i - 3 ) * 2
+        indexHet <- indexHom + 1
+        snp1     <- eval(parse(text=snpcomponent1))
+        snp2     <- eval(parse(text=snpcomponent2))
+        snp      <- snp1 + snp2
+
+        noNA    <- which( !is.na(snp) )
+        model.0 <- eval(parse(text=model0.txt))
+
+        ## Evaluate the model. The whole tryCatch is needed to catch
+        ## problems with non-converging regression.
+        model = tryCatch({
+            list(
+                eval(parse(text=model.txt)),
+                list(message="no warnings")
+                )
+        }, warning = function(war) {
+            return(list(
+                eval(parse(text=model.txt)),
+                war)
+                   )
+        })
+
+        if ( grepl("infinite", model[[2]]$message) |
+             grepl("singular", model[[2]]$message) ) {
+            ## The model did not converge, fill the coefficients with
+            ## NaNs
+            if (twoDF) {
+                smA1A2  <- c(NaN, NaN)
+                smA1A1  <- c(NaN, NaN)
+            } else {
+                sm      <- c(NaN, NaN)
+            }
+            lrt <- NaN
+        } else {
+            ## No convergence problems, we can trust the
+            ## coefficients.
+            coeff <- summary(model[[1]])$coefficients
+            if (twoDF) {
+                smA1A2 <- coeff[4, c("coef", "se(coef)")]
+                smA1A1 <- coeff[5, c("coef", "se(coef)")]
+            } else {
+                sm     <- coeff[4, c("coef", "se(coef)")]
+            }
+            lrt   <- 2 * ( model[[1]]$loglik[2] - model.0$loglik[2] )
+        }
+
+        ## Check the imputation R^2, if below threshold ProbABEL will
+        ## set the coefficients to NaN.
+        rsq <- Rsq[i-2]
+        if (twoDF) {
+            if( rsq < rsq.thresh ) {
+                row <- c(rsq, NaN, NaN, NaN, NaN, NaN)
+            } else {
+                row <- c(rsq, smA1A2[1], smA1A2[2], smA1A1[1], smA1A1[2], lrt)
+            }
+        } else {
+            if( rsq < rsq.thresh ) {
+                row <- c(rsq, NaN, NaN, NaN)
+            } else {
+                row <- c(rsq, sm[1], sm[2], lrt)
+            }
+        }
+
+        resultR <- rbind(resultR, row)
+    }
+    return(resultR)
+}
diff --git a/checks/R-tests/run_model_linear.R b/checks/R-tests/run_model_linear.R
new file mode 100644
index 0000000..5f79e12
--- /dev/null
+++ b/checks/R-tests/run_model_linear.R
@@ -0,0 +1,29 @@
+run.model <- function(model0.txt, model.txt, snpdata) {
+    resultR <- data.frame()
+    for (i in 3:dim(dose)[2]) {
+        indexHom <- 3 + ( i - 3 ) * 2
+        indexHet <- indexHom + 1
+        snp      <- eval(parse(text=snpdata))
+
+        noNA    <- which( !is.na(snp) )
+        model.0 <- eval(parse(text=model0.txt))
+        model   <- eval(parse(text=model.txt))
+
+        coeff   <- summary(model)$coefficients
+        if ( dim(coeff)[1] != 4 ) {
+            sm <- c(NaN, NaN)
+        } else {
+            sm <- coeff[4, c("Estimate", "Std. Error")]
+        }
+
+        lrt <- 2 * ( logLik( model ) - logLik( model.0 ) )
+        rsq <- Rsq[i-2]
+        if( rsq < rsq.thresh) {
+            row <- c(rsq, NaN, NaN, NaN)
+        } else {
+            row <- c(rsq, sm[1], sm[2], lrt)
+        }
+        resultR <- rbind(resultR, row)
+    }
+    return(resultR)
+}
diff --git a/checks/R-tests/run_model_logist.R b/checks/R-tests/run_model_logist.R
new file mode 100644
index 0000000..bc5f3c8
--- /dev/null
+++ b/checks/R-tests/run_model_logist.R
@@ -0,0 +1,23 @@
+run.model <- function(model0.txt, model.txt, snpdata) {
+    resultR <- data.frame()
+    for (i in 3:dim(dose)[2]) {
+        indexHom <- 3 + ( i - 3 ) * 2
+        indexHet <- indexHom + 1
+        snp      <- eval(parse(text=snpdata))
+
+        noNA    <- which( !is.na(snp) )
+        model.0 <- eval(parse(text=model0.txt))
+        model   <- eval(parse(text=model.txt))
+        sm      <- summary(model)$coef[5, 1:2]
+        lrt     <- 2 * ( logLik( model ) - logLik( model.0 ) )
+
+        rsq <- Rsq[i-2]
+        if( rsq < rsq.thresh) {
+            row <- c(rsq, NaN, NaN, NaN)
+        } else {
+            row <- c(rsq, sm[1], sm[2], lrt)
+        }
+        resultR <- rbind(resultR, row)
+    }
+    return(resultR)
+}
diff --git a/checks/R-tests/run_models_in_R_pacox.R b/checks/R-tests/run_models_in_R_pacox.R
new file mode 100644
index 0000000..d1cfa0e
--- /dev/null
+++ b/checks/R-tests/run_models_in_R_pacox.R
@@ -0,0 +1,109 @@
+cat("Checking Cox PH regression...\n")
+library(survival)
+
+args <- commandArgs(TRUE)
+srcdir <- args[1]
+
+if (is.na(srcdir)) {
+    srcdir <- "./"
+} else {
+    ## Apparently we are running R from the command line. Disable
+    ## warnings so that they don't clutter the screen when running
+    ## this script.
+    old.warn <- options()$warn
+    options(warn=-1)
+}
+
+
+pheno.file <- "coxph_data.txt"
+
+source(paste0(srcdir, "initial_checks.R"))
+
+####
+## Run ProbABEL to get the output data we want to compare/verify
+####
+cat("Running ProbABEL...\t\t\t\t")
+tmp <- system(paste0("bash ", tests.path, "test_cox.sh 2> /dev/null"),
+              intern=TRUE)
+cat("OK\n")
+
+dose.add.PA <- read.table("coxph_dose_add.out.txt",
+                          head=TRUE)[, colsAddDose]
+prob.add.PA <- read.table("coxph_prob_add.out.txt",
+                          head=TRUE)[, colsAddProb]
+prob.dom.PA <- read.table("coxph_prob_domin.out.txt",
+                          head=TRUE)[, colsDom]
+prob.rec.PA <- read.table("coxph_prob_recess.out.txt",
+                          head=TRUE)[, colsRec]
+prob.odom.PA <- read.table("coxph_prob_over_domin.out.txt",
+                           head=TRUE)[, colsOdom]
+prob.2df.PA <- read.table("coxph_prob_2df.out.txt",
+                          head=TRUE)[, cols2df]
+
+####
+## run analysis in R
+####
+attach(pheno)
+
+cat("Comparing R output with ProbABEL output\t\t")
+
+source(paste0(srcdir, "run_model_coxph.R"))
+
+model.fn.0 <-
+    "coxph( Surv(fupt_chd, chd)[noNA] ~ sex[noNA] + age[noNA] + othercov[noNA] )"
+model.fn <- "coxph( Surv(fupt_chd, chd) ~ sex + age + othercov + snp1 )"
+
+## Additive model, dosages
+snpdose <- "dose[, i]"
+dose.add.R <- run.model(model.fn.0, model.fn, snpdose)
+colnames(dose.add.R) <- colsAddDose
+rownames(dose.add.R) <- NULL
+stopifnot( all.equal(dose.add.PA, dose.add.R, tol=tol) )
+cat("additive ")
+
+
+## Additive model, probabilities
+snpprob <- "doseFromProb[, i]"
+prob.add.R <- run.model(model.fn.0, model.fn, snpprob)
+colnames(prob.add.R) <- colsAddProb
+rownames(prob.add.R) <- NULL
+stopifnot( all.equal(prob.add.PA, prob.add.R, tol=tol) )
+cat("additive ")
+
+## dominant model
+snpprob <- "prob[, indexHom] + prob[, indexHet]"
+prob.dom.R <- run.model(model.fn.0, model.fn, snpprob)
+colnames(prob.dom.R) <- colsDom
+rownames(prob.dom.R) <- NULL
+stopifnot( all.equal(prob.dom.PA, prob.dom.R, tol=tol) )
+cat("dominant ")
+
+## recessive model
+snpprob <- "prob[, indexHom]"
+prob.rec.R <- run.model(model.fn.0, model.fn, snpprob)
+colnames(prob.rec.R) <- colsRec
+rownames(prob.rec.R) <- NULL
+stopifnot( all.equal(prob.rec.PA, prob.rec.R, tol=tol) )
+cat("recessive ")
+
+## over-dominant model
+snpprob <- "prob[, indexHet]"
+prob.odom.R <- run.model(model.fn.0, model.fn, snpprob)
+colnames(prob.odom.R) <- colsOdom
+rownames(prob.odom.R) <- NULL
+stopifnot( all.equal(prob.odom.PA, prob.odom.R, tol=tol) )
+cat("overdominant ")
+
+
+## 2df model
+model.fn <-
+    "coxph( Surv(fupt_chd, chd) ~ sex + age + othercov + snp1 + snp2 )"
+snpd1 <- "prob[, indexHet]"
+snpd2 <- "prob[, indexHom]"
+prob.2df.R <- run.model(model.fn.0, model.fn, snpd1, snpd2)
+colnames(prob.2df.R) <- cols2df
+rownames(prob.2df.R) <- NULL
+stopifnot( all.equal(prob.2df.PA, prob.2df.R, tol=tol) )
+cat("2df\n")
+
+cat("\t\t\t\t\t\tOK\n")
diff --git a/checks/R-tests/run_models_in_R_palinear.R b/checks/R-tests/run_models_in_R_palinear.R
new file mode 100644
index 0000000..e493597
--- /dev/null
+++ b/checks/R-tests/run_models_in_R_palinear.R
@@ -0,0 +1,129 @@
+cat("Checking linear regression...\n")
+
+args <- commandArgs(TRUE)
+srcdir <- args[1]
+
+if (is.na(srcdir)) {
+    srcdir <- "./"
+}
+
+pheno.file <- "height.txt"
+
+source(paste0(srcdir, "initial_checks.R"))
+
+####
+## Run ProbABEL to get the output data we want to compare/verify
+####
+cat("Running ProbABEL...\t\t\t\t")
+tmp <- system(paste0("bash ", tests.path, "test_qt.sh"),
+              intern=TRUE)
+cat("OK\n")
+
+dose.add.PA <- read.table("linear_base_add.out.txt",
+                          head=TRUE)[, colsAddDose]
+prob.add.PA <- read.table("linear_ngp2_add.out.txt",
+                          head=TRUE)[, colsAddProb]
+prob.dom.PA <- read.table("linear_ngp2_domin.out.txt",
+                          head=TRUE)[, colsDom]
+prob.rec.PA <- read.table("linear_ngp2_recess.out.txt",
+                          head=TRUE)[, colsRec]
+prob.odom.PA <- read.table("linear_ngp2_over_domin.out.txt",
+                           head=TRUE)[, colsOdom]
+prob.2df.PA <- read.table("linear_ngp2_2df.out.txt",
+                          head=TRUE)[, cols2df]
+
+## Fix betas, sebetas, chi^2 for the case that there is no variation
+## (SNP 6 in the info file). ProbABEL lists them all as 0.0, R lists
+## them as:
+prob.dom.PA[6, 2:4] <- c(NaN, NaN, 0.0)
+prob.2df.PA[6, 4:5] <- c(NA, NA)
+
+####
+## run analysis in R
+####
+attach(pheno)
+
+cat("Comparing R output with ProbABEL output\t\t")
+
+source(paste0(srcdir, "run_model_linear.R"))
+
+model.fn.0 <- "lm( height[noNA] ~ sex[noNA] + age[noNA] )"
+model.fn   <- "lm( height ~ sex + age + snp )"
+
+## Additive model, dosages
+snpdose <- "dose[, i]"
+dose.add.R <- run.model(model.fn.0, model.fn, snpdose)
+colnames(dose.add.R) <- colsAddDose
+rownames(dose.add.R) <- NULL
+stopifnot( all.equal(dose.add.PA, dose.add.R, tol=tol) )
+cat("additive ")
+
+
+## Additive model, probabilities
+snpprob <- "doseFromProb[, i]"
+prob.add.R <- run.model(model.fn.0, model.fn, snpprob)
+colnames(prob.add.R) <- colsAddProb
+rownames(prob.add.R) <- NULL
+stopifnot( all.equal(prob.add.PA, prob.add.R, tol=tol) )
+cat("additive ")
+
+## dominant model
+snpprob <- "prob[, indexHom] + prob[, indexHet]"
+prob.dom.R <- run.model(model.fn.0, model.fn, snpprob)
+colnames(prob.dom.R) <- colsDom
+rownames(prob.dom.R) <- NULL
+stopifnot( all.equal(prob.dom.PA, prob.dom.R, tol=tol) )
+cat("dominant ")
+
+## recessive model
+snpprob <- "prob[, indexHom]"
+prob.rec.R <- run.model(model.fn.0, model.fn, snpprob)
+colnames(prob.rec.R) <- colsRec
+rownames(prob.rec.R) <- NULL
+stopifnot( all.equal(prob.rec.PA, prob.rec.R, tol=tol) )
+cat("recessive ")
+
+## over-dominant model
+snpprob <- "prob[, indexHet]"
+prob.odom.R <- run.model(model.fn.0, model.fn, snpprob)
+colnames(prob.odom.R) <- colsOdom
+rownames(prob.odom.R) <- NULL
+stopifnot( all.equal(prob.odom.PA, prob.odom.R, tol=tol) )
+cat("overdominant ")
+
+## 2df model
+prob.2df.R <- data.frame()
+for (i in 3:dim(dose)[2]) {
+        indexHom <- 3 + ( i - 3 ) * 2
+        indexHet <- indexHom + 1
+        regProb <- prob[, indexHet]
+
+        noNA    <- which( !is.na(regProb) )
+        model.0 <- lm( height[noNA] ~ sex[noNA] + age[noNA] )
+        model   <- lm( height ~ sex + age + prob[, indexHet] + prob[, indexHom] )
+        smA1A2  <- summary(model)$coef[4, 1:2]
+
+        ## When all coefficients are NA, they don't show up in $coeff
+        if ( nrow(summary(model)$coeff) > 4 ) {
+            smA1A1 <- summary(model)$coef[5, 1:2]
+        } else {
+            smA1A1 <- c(NA, NA)
+        }
+
+        lrt     <- 2 * ( logLik( model ) - logLik( model.0 ) )
+
+        rsq <- prob.2df.PA[i-2, "Rsq"]
+        if( rsq < rsq.thresh) {
+            row <- c(rsq, NaN, NaN, NaN, NaN, NaN)
+        } else {
+            row <- c(rsq, smA1A2[1], smA1A2[2], smA1A1[1], smA1A1[2], lrt)
+
+        }
+        prob.2df.R <- rbind(prob.2df.R, row)
+}
+colnames(prob.2df.R) <- cols2df
+rownames(prob.2df.R) <- NULL
+stopifnot( all.equal(prob.2df.PA, prob.2df.R, tol=tol) )
+cat("2df\n")
+
+cat("\t\t\t\t\t\tOK\n")
diff --git a/checks/R-tests/run_models_in_R_palogist.R b/checks/R-tests/run_models_in_R_palogist.R
new file mode 100644
index 0000000..54fd515
--- /dev/null
+++ b/checks/R-tests/run_models_in_R_palogist.R
@@ -0,0 +1,129 @@
+cat("Checking logistic regression...\n")
+
+args <- commandArgs(TRUE)
+srcdir <- args[1]
+
+if (is.na(srcdir)) {
+    srcdir <- "./"
+}
+
+pheno.file <- "logist_data.txt"
+
+source(paste0(srcdir, "initial_checks.R"))
+
+####
+## Run ProbABEL to get the output data we want to compare/verify
+####
+cat("Running ProbABEL...\t\t\t\t")
+tmp <- system(paste0("bash ", tests.path, "test_bt.sh"),
+              intern=TRUE)
+cat("OK\n")
+
+dose.add.PA <- read.table("logist_add.out.txt",
+                          head=TRUE)[, colsAddDose]
+prob.add.PA <- read.table("logist_prob_add.out.txt",
+                          head=TRUE)[, colsAddProb]
+prob.dom.PA <- read.table("logist_prob_domin.out.txt",
+                          head=TRUE)[, colsDom]
+prob.rec.PA <- read.table("logist_prob_recess.out.txt",
+                          head=TRUE)[, colsRec]
+prob.odom.PA <- read.table("logist_prob_over_domin.out.txt",
+                           head=TRUE)[, colsOdom]
+prob.2df.PA <- read.table("logist_prob_2df.out.txt",
+                          head=TRUE)[, cols2df]
+
+## Fix chi^2 for the case that there is no variation (SNP 6 in the
+## info file). ProbABEL lists it as NaN, R lists it as:
+prob.dom.PA[6, 4] <- 0.0
+
+####
+## run analysis in R
+####
+attach(pheno)
+
+cat("Comparing R output with ProbABEL output\t\t")
+
+source(paste0(srcdir, "run_model_logist.R"))
+
+model.fn.0 <-
+    "glm( chd[noNA] ~ sex[noNA] + age[noNA] + othercov[noNA], family=binomial)"
+model.fn  <- "glm( chd ~ sex + age + othercov + snp, family=binomial )"
+
+## Additive model, dosages
+snpdose <- "dose[, i]"
+dose.add.R <- run.model(model.fn.0, model.fn, snpdose)
+colnames(dose.add.R) <- colsAddDose
+rownames(dose.add.R) <- NULL
+stopifnot( all.equal(dose.add.PA, dose.add.R, tol=tol) )
+cat("additive ")
+
+## Additive model, probabilities
+snpprob <- "doseFromProb[, i]"
+prob.add.R <- run.model(model.fn.0, model.fn, snpprob)
+colnames(prob.add.R) <- colsAddProb
+rownames(prob.add.R) <- NULL
+stopifnot( all.equal(prob.add.PA, prob.add.R, tol=tol) )
+cat("additive ")
+
+## dominant model
+snpprob <- "prob[, indexHom] + prob[, indexHet]"
+prob.dom.R <- run.model(model.fn.0, model.fn, snpprob)
+colnames(prob.dom.R) <- colsDom
+rownames(prob.dom.R) <- NULL
+stopifnot( all.equal(prob.dom.PA, prob.dom.R, tol=tol) )
+cat("dominant ")
+
+## recessive model
+snpprob <- "prob[, indexHom]"
+prob.rec.R <- run.model(model.fn.0, model.fn, snpprob)
+colnames(prob.rec.R) <- colsRec
+rownames(prob.rec.R) <- NULL
+stopifnot( all.equal(prob.rec.PA, prob.rec.R, tol=tol) )
+cat("recessive ")
+
+## over-dominant model
+snpprob <- "prob[, indexHet]"
+prob.odom.R <- run.model(model.fn.0, model.fn, snpprob)
+colnames(prob.odom.R) <- colsOdom
+rownames(prob.odom.R) <- NULL
+stopifnot( all.equal(prob.odom.PA, prob.odom.R, tol=tol) )
+cat("overdominant ")
+
+
+## 2df model
+prob.2df.R <- data.frame()
+for (i in 3:dim(dose)[2]) {
+        indexHom <- 3 + ( i - 3 ) * 2
+        indexHet <- indexHom + 1
+        regProb <- prob[, indexHet]
+
+        noNA    <- which( !is.na(regProb) )
+        model.0 <- glm( chd[noNA] ~ sex[noNA] + age[noNA] + othercov[noNA],
+                       family=binomial )
+        model   <- glm( chd ~ sex + age + othercov + prob[, indexHet] +
+                       prob[, indexHom], family=binomial )
+        smA1A2  <- summary(model)$coef[5, 1:2]
+
+        if ( nrow(summary(model)$coeff) > 5 ) {
+            smA1A1 <- summary(model)$coef[6, 1:2]
+        } else {
+            smA1A1 <- c(NaN, NaN)
+        }
+
+        lrt     <- 2 * ( logLik( model ) - logLik( model.0 ) )
+
+        rsq <- prob.2df.PA[i-2, "Rsq"]
+        if( rsq < rsq.thresh) {
+            row <- c(rsq, NaN, NaN, NaN, NaN, NaN)
+        } else {
+            row <- c(rsq, smA1A2[1], smA1A2[2], smA1A1[1], smA1A1[2], lrt)
+
+        }
+        prob.2df.R <- rbind(prob.2df.R, row)
+}
+colnames(prob.2df.R) <- cols2df
+rownames(prob.2df.R) <- NULL
+stopifnot( all.equal(prob.2df.PA, prob.2df.R, tol=tol) )
+cat("2df\n")
+
+cat("\t\t\t\t\t\tOK\n")
diff --git a/checks/check_dose_input.sh b/checks/check_dose_input.sh
index 583f918..a785931 100755
--- a/checks/check_dose_input.sh
+++ b/checks/check_dose_input.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 #
 # This script tests whether dose data without a MaCH/minimac-style
 # arrow is read correctly by palinear (and by palogist, since reading
diff --git a/checks/check_probabel.pl_chunk.sh b/checks/check_probabel_chunk.sh
similarity index 91%
rename from checks/check_probabel.pl_chunk.sh
rename to checks/check_probabel_chunk.sh
index b4be59c..561aee6 100755
--- a/checks/check_probabel.pl_chunk.sh
+++ b/checks/check_probabel_chunk.sh
@@ -1,9 +1,9 @@
 #!/bin/bash
 # L.C. Karssen
-# This script is used to test whether probabel.pl works correctly when
-# input is cut up in chunks
+# This script is used to test whether the probabel script works
+# correctly when input is cut up in chunks
 
-echo "Testing probabel.pl..."
+echo "Testing probabel..."
 
 # Exit with error when one of the steps in the script fails
 set -e
@@ -22,14 +22,14 @@ infofile="$inputdir/test.mlinfo"
 mapfile="$inputdir/test.map"
 phenofile="$inputdir/height.txt"
 
-probabel="${padir}/probabel.pl"
+probabel="${padir}/probabel"
 probabelcfg="${padir}/probabel_config.cfg.example"
 chunksep="_._chunk_._"
 chrsep="_._chr_._"
 
-# ------ Prepare probabel.pl and the config file ------
-sed 's;"./";"../src/";g' $probabel > probabel.pl
-chmod a+x probabel.pl
+# ------ Prepare probabel and the config file ------
+sed 's;"./";"../src/";g' $probabel > probabel
+chmod a+x probabel
 cp $probabelcfg probabel_config.cfg
 chmod +w probabel_config.cfg # Need this for make distcheck to work
 cp $phenofile height.PHE
@@ -111,7 +111,7 @@ run_test ()
     outfile="height_add.out.txt"
 
     echo "Checking output using dosages $WithOrWithout chunks..."
-    ./probabel.pl 1 2 linear $1 --additive height > /dev/null
+    ./probabel 1 2 linear $1 --additive height > /dev/null
 
     blanks="                                                          "
     echo -n "  Verifying "
@@ -128,7 +128,7 @@ run_test ()
     height_ngp2_add.out.txt"
 
     echo "Checking output using probabilities $WithOrWithout chunks..."
-    ./probabel.pl 1 2 linear $1 --allmodels height -o height_ngp2 > /dev/null
+    ./probabel 1 2 linear $1 --allmodels height -o height_ngp2 > /dev/null
     for file in $outfilelist; do
         echo -n "  Verifying "
         if diff $file $results/$file; then
diff --git a/checks/inputfiles/test.dose.fvd b/checks/inputfiles/test.dose.fvd
index 531d0bd..0238e96 100644
Binary files a/checks/inputfiles/test.dose.fvd and b/checks/inputfiles/test.dose.fvd differ
diff --git a/checks/inputfiles/test.dose.fvi b/checks/inputfiles/test.dose.fvi
index 1937e3f..62b867b 100644
Binary files a/checks/inputfiles/test.dose.fvi and b/checks/inputfiles/test.dose.fvi differ
diff --git a/checks/inputfiles/test.map b/checks/inputfiles/test.map
index d640156..8b63bf7 100644
--- a/checks/inputfiles/test.map
+++ b/checks/inputfiles/test.map
@@ -4,3 +4,4 @@ rs8102643	207859	C	T
 rs8102615	211970	A	T
 rs8105536	212033	A	G
 rs2312724	217034	C	T
+rs3174230       7845238 G       C
diff --git a/checks/inputfiles/test.mldose b/checks/inputfiles/test.mldose
index a2f10e4..317ae63 100644
--- a/checks/inputfiles/test.mldose
+++ b/checks/inputfiles/test.mldose
@@ -1,200 +1,200 @@
-1->id636728 MLDOSE 0.678 1.622 1.732 1.585 1.867
-2->id890314 MLDOSE 0.66 1.621 1.737 1.59 1.869
-3->id102874 MLDOSE 0.684 1.623 1.731 1.585 1.866
-4->id200949 MLDOSE 0.667 NaN 1.728 1.576 1.866
-5->id336491 MLDOSE 0.66 1.609 1.737 1.577 1.869
-6->id988766 MLDOSE 0.687 1.622 1.738 1.59 1.868
-7->id21999 MLDOSE 0.67 1.62 1.735 1.588 1.867
-8->id433893 MLDOSE 0.663 1.615 1.734 1.572 1.869
-9->id688932 MLDOSE 0.672 1.619 1.729 1.585 1.862
-10->id394203 MLDOSE 0.666 1.619 1.729 1.58 1.863
-11->id995678 MLDOSE 0.672 1.619 1.733 1.583 1.867
-12->id694339 MLDOSE 0.666 1.615 1.733 1.59 1.869
-13->id256455 MLDOSE 0.673 1.617 1.737 1.584 1.869
-14->id14836 MLDOSE 0.672 1.62 1.737 1.582 1.869
-15->id817128 MLDOSE 0.666 1.609 1.735 1.589 1.868
-16->id803325 MLDOSE 0.678 1.62 1.73 1.591 1.868
-17->id521287 MLDOSE 0.661 1.618 1.736 1.585 1.87
-18->id701472 MLDOSE 0.666 1.621 1.731 1.585 1.867
-19->id850010 MLDOSE 0.669 1.615 1.736 1.581 1.868
-20->id268483 MLDOSE 0.669 1.618 1.732 1.582 1.865
-21->id738781 MLDOSE 0.666 1.611 1.73 1.59 1.862
-22->id28411 MLDOSE 0.66 1.62 1.735 1.57 1.869
-23->id541635 MLDOSE 0.669 1.622 1.725 1.558 1.868
-24->id751101 MLDOSE 0.669 1.624 1.738 1.589 1.869
-25->id826300 MLDOSE 0.666 1.605 1.736 1.586 1.869
-26->id884387 MLDOSE 0.661 1.604 1.734 1.587 1.868
-27->id492414 MLDOSE 0.666 1.619 1.733 1.583 1.866
-28->id268871 MLDOSE 0.669 1.621 1.731 1.576 1.869
-29->id627354 MLDOSE 0.666 1.615 1.735 1.59 1.869
-30->id503932 MLDOSE 0.66 1.62 1.735 1.586 1.867
-31->id163442 MLDOSE 0.675 1.621 1.737 1.586 1.869
-32->id317797 MLDOSE 0.654 1.625 1.739 1.57 1.87
-33->id687857 MLDOSE 0.667 1.621 1.734 1.586 1.869
-34->id871570 MLDOSE 0.666 1.61 1.731 1.576 1.864
-35->id724067 MLDOSE 0.666 1.619 1.736 1.583 1.868
-36->id874076 MLDOSE 0.676 1.617 1.738 1.585 1.869
-37->id927863 MLDOSE 0.67 1.62 1.734 1.586 1.865
-38->id369805 MLDOSE 0.663 1.616 1.73 1.583 1.867
-39->id668376 MLDOSE 0.675 1.617 1.736 1.582 1.869
-40->id717362 MLDOSE 0.66 1.62 1.736 1.59 1.869
-41->id665504 MLDOSE 0.669 1.618 1.732 1.578 1.867
-42->id336637 MLDOSE 0.661 1.618 1.734 1.576 1.865
-43->id60633 MLDOSE 0.669 1.619 1.731 1.579 1.866
-44->id848600 MLDOSE 0.664 1.615 1.737 1.576 1.869
-45->id169514 MLDOSE 0.664 1.615 1.737 1.583 1.869
-46->id690732 MLDOSE 0.663 1.619 1.737 1.586 1.868
-47->id684760 MLDOSE 0.667 1.62 1.734 1.578 1.866
-48->id553502 MLDOSE 0.672 1.608 1.732 1.59 1.869
-49->id214917 MLDOSE 0.669 1.618 1.727 1.588 1.865
-50->id849169 MLDOSE 0.664 1.624 1.733 1.588 1.867
-51->id941921 MLDOSE 0.667 1.619 1.731 1.588 1.862
-52->id784646 MLDOSE 0.663 1.603 1.739 1.584 1.87
-53->id520954 MLDOSE 0.664 1.619 1.732 1.581 1.864
-54->id996355 MLDOSE 0.66 1.605 1.736 1.586 1.865
-55->id96730 MLDOSE 0.664 1.619 1.736 1.573 1.868
-56->id673442 MLDOSE 0.666 1.609 1.735 1.575 1.867
-57->id68305 MLDOSE 0.672 1.618 1.735 1.585 1.866
-58->id653025 MLDOSE 0.678 1.617 1.738 1.585 1.868
-59->id208543 MLDOSE 0.664 1.618 1.734 1.58 1.868
-60->id335725 MLDOSE 0.666 1.616 1.714 1.593 1.845
-61->id980400 MLDOSE 0.663 1.607 1.733 1.588 1.867
-62->id869939 MLDOSE 0.667 1.619 1.733 1.588 1.865
-63->id297563 MLDOSE 0.673 1.614 1.72 1.585 1.866
-64->id852663 MLDOSE 0.666 1.603 1.729 1.585 1.87
-65->id162070 MLDOSE 0.666 1.619 1.728 1.572 1.868
-66->id272875 MLDOSE 0.66 1.605 1.737 1.584 1.869
-67->id163787 MLDOSE 0.661 1.616 1.723 1.584 1.87
-68->id422204 MLDOSE 0.663 1.615 1.734 1.576 1.867
-69->id120197 MLDOSE 0.66 1.62 1.731 1.588 1.87
-70->id33660 MLDOSE 0.658 1.62 1.736 1.571 1.869
-71->id803855 MLDOSE 0.669 1.616 1.732 1.586 1.865
-72->id255048 MLDOSE 0.675 1.616 1.726 1.582 1.866
-73->id690936 MLDOSE 0.657 1.588 1.738 1.59 1.87
-74->id126807 MLDOSE 0.667 1.612 1.731 1.589 1.864
-75->id99016 MLDOSE 0.667 1.612 1.734 1.59 1.864
-76->id883847 MLDOSE 0.666 1.611 1.736 1.587 1.869
-77->id354523 MLDOSE 0.669 1.62 1.734 1.584 1.868
-78->id737255 MLDOSE 0.666 1.623 1.733 1.569 1.867
-79->id990941 MLDOSE 0.675 1.62 1.734 1.585 1.869
-80->id25464 MLDOSE 0.673 1.62 1.737 1.579 1.868
-81->id918375 MLDOSE 0.672 1.621 1.737 1.58 1.869
-82->id537828 MLDOSE 0.666 1.613 1.729 1.585 1.869
-83->id682778 MLDOSE 0.658 1.621 1.737 1.573 1.869
-84->id587547 MLDOSE 0.669 1.62 1.738 1.585 1.868
-85->id670874 MLDOSE 0.666 1.618 1.734 1.58 1.867
-86->id444459 MLDOSE 0.66 1.617 1.734 1.577 1.87
-87->id777456 MLDOSE 0.663 1.615 1.732 1.581 1.865
-88->id452384 MLDOSE 0.666 1.625 1.738 1.588 1.869
-89->id826975 MLDOSE 0.669 1.619 1.731 1.582 1.865
-90->id519567 MLDOSE 0.66 1.621 1.732 1.586 1.869
-91->id84292 MLDOSE 0.663 1.618 1.737 1.582 1.868
-92->id124432 MLDOSE 0.684 1.621 1.736 1.591 1.867
-93->id800145 MLDOSE 0.681 1.621 1.737 1.587 1.869
-94->id153857 MLDOSE 0.661 1.617 1.739 1.585 1.87
-95->id587157 MLDOSE 0.663 1.619 1.736 1.584 1.866
-96->id506262 MLDOSE 0.664 1.613 1.719 1.592 1.855
-97->id634462 MLDOSE 0.673 1.623 1.737 1.585 1.869
-98->id687592 MLDOSE 0.664 1.615 1.726 1.584 1.869
-99->id955526 MLDOSE 0.663 1.621 1.737 1.566 1.869
-100->id181850 MLDOSE 0.66 1.603 1.736 1.586 1.869
-101->id159506 MLDOSE 0.667 1.621 1.735 1.585 1.868
-102->id609051 MLDOSE 0.675 1.618 1.73 1.59 1.86
-103->id963886 MLDOSE 0.663 1.612 1.739 1.581 1.87
-104->id405792 MLDOSE 0.682 1.621 1.737 1.589 1.869
-105->id494172 MLDOSE 0.66 1.607 1.736 1.58 1.868
-106->id964637 MLDOSE 0.663 1.616 1.73 1.59 1.861
-107->id799355 MLDOSE 0.669 1.62 1.735 1.585 1.868
-108->id157111 MLDOSE 0.658 1.601 1.731 1.588 1.87
-109->id114524 MLDOSE 0.666 1.603 1.729 1.585 1.87
-110->id954931 MLDOSE 0.676 1.62 1.733 1.585 1.868
-111->id827034 MLDOSE 0.664 1.613 1.737 1.579 1.869
-112->id689645 MLDOSE 0.657 1.611 1.736 1.59 1.868
-113->id281585 MLDOSE 0.673 1.621 1.736 1.584 1.869
-114->id885624 MLDOSE 0.672 1.619 1.734 1.585 1.869
-115->id577871 MLDOSE 0.67 1.616 1.731 1.585 1.864
-116->id238796 MLDOSE 0.667 1.62 1.734 1.585 1.867
-117->id481035 MLDOSE 0.664 1.62 1.737 1.588 1.867
-118->id972713 MLDOSE 0.666 1.611 1.73 1.589 1.869
-119->id905484 MLDOSE 0.66 1.62 1.728 1.572 1.869
-120->id713511 MLDOSE 0.664 1.605 1.733 1.585 1.866
-121->id512328 MLDOSE 0.67 1.616 1.737 1.584 1.869
-122->id703534 MLDOSE 0.67 1.615 1.731 1.59 1.862
-123->id409904 MLDOSE 0.678 1.622 1.734 1.585 1.868
-124->id577169 MLDOSE 0.669 1.616 1.734 1.582 1.867
-125->id813971 MLDOSE 0.657 1.606 1.72 1.591 1.85
-126->id558483 MLDOSE 0.669 1.62 1.737 1.59 1.868
-127->id892784 MLDOSE 0.669 1.621 1.733 1.586 1.866
-128->id611178 MLDOSE 0.666 1.611 1.735 1.582 1.866
-129->id192732 MLDOSE 0.666 1.618 1.735 1.59 1.868
-130->id917280 MLDOSE 0.66 1.602 1.736 1.567 1.869
-131->id435876 MLDOSE 0.678 1.619 1.739 1.586 1.87
-132->id980722 MLDOSE 0.663 1.62 1.735 1.572 1.869
-133->id308273 MLDOSE 0.661 1.617 1.737 1.582 1.868
-134->id476685 MLDOSE 0.675 1.618 1.733 1.584 1.867
-135->id315883 MLDOSE 0.669 1.612 1.736 1.573 1.869
-136->id935945 MLDOSE 0.663 1.614 1.733 1.58 1.865
-137->id991781 MLDOSE 0.664 1.614 1.731 1.586 1.864
-138->id65199 MLDOSE 0.661 1.619 1.731 1.575 1.869
-139->id226233 MLDOSE 0.661 1.618 1.724 1.59 1.854
-140->id860183 MLDOSE 0.66 1.609 1.734 1.577 1.866
-141->id295209 MLDOSE 0.669 1.614 1.735 1.585 1.867
-142->id544964 MLDOSE 0.669 1.619 1.732 1.582 1.868
-143->id648663 MLDOSE 0.666 1.617 1.734 1.585 1.868
-144->id710165 MLDOSE 0.666 1.615 1.728 1.585 1.869
-145->id392593 MLDOSE 0.666 1.621 1.738 1.569 1.868
-146->id129945 MLDOSE 0.66 1.62 1.733 1.587 1.869
-147->id382621 MLDOSE 0.684 1.621 1.736 1.591 1.867
-148->id901440 MLDOSE 0.661 1.615 1.718 1.59 1.852
-149->id39847 MLDOSE 0.669 1.619 1.729 1.58 1.863
-150->id526460 MLDOSE 0.664 1.614 1.731 1.586 1.863
-151->id477473 MLDOSE 0.672 1.619 1.73 1.589 1.862
-152->id448194 MLDOSE 0.669 1.614 1.737 1.586 1.868
-153->id904184 MLDOSE 0.67 1.618 1.73 1.577 1.868
-154->id747852 MLDOSE 0.664 1.615 1.73 1.578 1.869
-155->id711012 MLDOSE 0.672 1.605 1.736 1.575 1.868
-156->id683879 MLDOSE 0.672 1.619 1.734 1.588 1.867
-157->id789575 MLDOSE 0.658 1.618 1.733 1.591 1.863
-158->id650729 MLDOSE 0.676 1.615 1.733 1.589 1.867
-159->id934302 MLDOSE 0.66 1.62 1.733 1.581 1.866
-160->id555013 MLDOSE 0.667 1.622 1.731 1.574 1.865
-161->id82779 MLDOSE 0.675 1.618 1.73 1.585 1.867
-162->id771444 MLDOSE 0.669 1.616 1.718 1.592 1.856
-163->id821562 MLDOSE 0.675 1.625 1.739 1.58 1.87
-164->id292809 MLDOSE 0.66 1.614 1.731 1.58 1.869
-165->id645690 MLDOSE 0.684 1.624 1.733 1.586 1.867
-166->id223901 MLDOSE 0.666 1.615 1.733 1.576 1.868
-167->id41320 MLDOSE 0.661 1.617 1.732 1.576 1.869
-168->id96181 MLDOSE 0.684 1.621 1.716 1.593 1.867
-169->id147900 MLDOSE 0.658 1.603 1.738 1.577 1.868
-170->id702917 MLDOSE 0.669 1.614 1.731 1.59 1.864
-171->id150640 MLDOSE 0.669 1.621 1.734 1.583 1.868
-172->id518391 MLDOSE 0.66 1.62 1.736 1.589 1.869
-173->id879076 MLDOSE 0.661 1.613 1.738 1.573 1.868
-174->id952031 MLDOSE 0.66 1.621 1.734 1.58 1.866
-175->id10055 MLDOSE 0.67 1.611 1.732 1.589 1.866
-176->id727213 MLDOSE 0.664 1.622 1.733 1.583 1.869
-177->id41961 MLDOSE 0.66 1.62 1.737 1.572 1.867
-178->id257209 MLDOSE 0.673 1.616 1.736 1.588 1.869
-179->id995361 MLDOSE 0.661 1.62 1.723 1.571 1.868
-180->id957918 MLDOSE 0.663 1.618 1.726 1.581 1.869
-181->id975370 MLDOSE 0.67 1.614 1.738 1.583 1.87
-182->id889896 MLDOSE 0.679 1.618 1.733 1.589 1.869
-183->id978164 MLDOSE 0.669 1.62 1.735 1.586 1.868
-184->id90359 MLDOSE 0.675 1.621 1.737 1.58 1.869
-185->id307158 MLDOSE 0.675 1.615 1.71 1.591 1.86
-186->id755940 MLDOSE 0.669 1.618 1.734 1.577 1.869
-187->id995582 MLDOSE 0.666 1.615 1.724 1.591 1.853
-188->id363965 MLDOSE 0.663 1.619 1.736 1.574 1.868
-189->id729124 MLDOSE 0.666 1.611 1.73 1.587 1.86
-190->id871963 MLDOSE 0.67 1.62 1.737 1.585 1.868
-191->id475172 MLDOSE 0.663 1.621 1.737 1.579 1.869
-192->id804699 MLDOSE 0.663 1.619 1.731 1.581 1.868
-193->id625843 MLDOSE 0.667 1.622 1.738 1.583 1.87
-194->id595713 MLDOSE 0.657 1.599 1.736 1.588 1.869
-195->id462604 MLDOSE 0.663 1.616 1.731 1.584 1.867
-196->id106141 MLDOSE 0.672 1.612 1.732 1.589 1.864
-197->id689349 MLDOSE 0.666 1.609 1.738 1.583 1.869
-198->id639003 MLDOSE 0.672 1.618 1.728 1.58 1.863
-199->id393896 MLDOSE 0.663 1.617 1.73 1.579 1.868
-200->id450307 MLDOSE 0.663 1.622 1.739 1.588 1.87
+1->id636728 MLDOSE 0.678 1.622 1.732 1.585 1.867 1.000
+2->id890314 MLDOSE 0.66 1.621 1.737 1.59 1.869 2.000
+3->id102874 MLDOSE 0.684 1.623 1.731 1.585 1.866 2.000
+4->id200949 MLDOSE 0.667 NaN 1.728 1.576 1.866 2.000
+5->id336491 MLDOSE 0.66 1.609 1.737 1.577 1.869 2.000
+6->id988766 MLDOSE 0.687 1.622 1.738 1.59 1.868 2.000
+7->id21999 MLDOSE 0.67 1.62 1.735 1.588 1.867 2.000
+8->id433893 MLDOSE 0.663 1.615 1.734 1.572 1.869 2.000
+9->id688932 MLDOSE 0.672 1.619 1.729 1.585 1.862 2.000
+10->id394203 MLDOSE 0.666 1.619 1.729 1.58 1.863 2.000
+11->id995678 MLDOSE 0.672 1.619 1.733 1.583 1.867 2.000
+12->id694339 MLDOSE 0.666 1.615 1.733 1.59 1.869 2.000
+13->id256455 MLDOSE 0.673 1.617 1.737 1.584 1.869 2.000
+14->id14836 MLDOSE 0.672 1.62 1.737 1.582 1.869 2.000
+15->id817128 MLDOSE 0.666 1.609 1.735 1.589 1.868 2.000
+16->id803325 MLDOSE 0.678 1.62 1.73 1.591 1.868 2.000
+17->id521287 MLDOSE 0.661 1.618 1.736 1.585 1.87 2.000
+18->id701472 MLDOSE 0.666 1.621 1.731 1.585 1.867 2.000
+19->id850010 MLDOSE 0.669 1.615 1.736 1.581 1.868 2.000
+20->id268483 MLDOSE 0.669 1.618 1.732 1.582 1.865 2.000
+21->id738781 MLDOSE 0.666 1.611 1.73 1.59 1.862 2.000
+22->id28411 MLDOSE 0.66 1.62 1.735 1.57 1.869 2.000
+23->id541635 MLDOSE 0.669 1.622 1.725 1.558 1.868 2.000
+24->id751101 MLDOSE 0.669 1.624 1.738 1.589 1.869 2.000
+25->id826300 MLDOSE 0.666 1.605 1.736 1.586 1.869 2.000
+26->id884387 MLDOSE 0.661 1.604 1.734 1.587 1.868 2.000
+27->id492414 MLDOSE 0.666 1.619 1.733 1.583 1.866 2.000
+28->id268871 MLDOSE 0.669 1.621 1.731 1.576 1.869 2.000
+29->id627354 MLDOSE 0.666 1.615 1.735 1.59 1.869 2.000
+30->id503932 MLDOSE 0.66 1.62 1.735 1.586 1.867 2.000
+31->id163442 MLDOSE 0.675 1.621 1.737 1.586 1.869 2.000
+32->id317797 MLDOSE 0.654 1.625 1.739 1.57 1.87 2.000
+33->id687857 MLDOSE 0.667 1.621 1.734 1.586 1.869 2.000
+34->id871570 MLDOSE 0.666 1.61 1.731 1.576 1.864 2.000
+35->id724067 MLDOSE 0.666 1.619 1.736 1.583 1.868 2.000
+36->id874076 MLDOSE 0.676 1.617 1.738 1.585 1.869 2.000
+37->id927863 MLDOSE 0.67 1.62 1.734 1.586 1.865 2.000
+38->id369805 MLDOSE 0.663 1.616 1.73 1.583 1.867 2.000
+39->id668376 MLDOSE 0.675 1.617 1.736 1.582 1.869 2.000
+40->id717362 MLDOSE 0.66 1.62 1.736 1.59 1.869 2.000
+41->id665504 MLDOSE 0.669 1.618 1.732 1.578 1.867 2.000
+42->id336637 MLDOSE 0.661 1.618 1.734 1.576 1.865 2.000
+43->id60633 MLDOSE 0.669 1.619 1.731 1.579 1.866 2.000
+44->id848600 MLDOSE 0.664 1.615 1.737 1.576 1.869 2.000
+45->id169514 MLDOSE 0.664 1.615 1.737 1.583 1.869 2.000
+46->id690732 MLDOSE 0.663 1.619 1.737 1.586 1.868 2.000
+47->id684760 MLDOSE 0.667 1.62 1.734 1.578 1.866 2.000
+48->id553502 MLDOSE 0.672 1.608 1.732 1.59 1.869 2.000
+49->id214917 MLDOSE 0.669 1.618 1.727 1.588 1.865 2.000
+50->id849169 MLDOSE 0.664 1.624 1.733 1.588 1.867 2.000
+51->id941921 MLDOSE 0.667 1.619 1.731 1.588 1.862 2.000
+52->id784646 MLDOSE 0.663 1.603 1.739 1.584 1.87 2.000
+53->id520954 MLDOSE 0.664 1.619 1.732 1.581 1.864 2.000
+54->id996355 MLDOSE 0.66 1.605 1.736 1.586 1.865 2.000
+55->id96730 MLDOSE 0.664 1.619 1.736 1.573 1.868 2.000
+56->id673442 MLDOSE 0.666 1.609 1.735 1.575 1.867 2.000
+57->id68305 MLDOSE 0.672 1.618 1.735 1.585 1.866 2.000
+58->id653025 MLDOSE 0.678 1.617 1.738 1.585 1.868 2.000
+59->id208543 MLDOSE 0.664 1.618 1.734 1.58 1.868 2.000
+60->id335725 MLDOSE 0.666 1.616 1.714 1.593 1.845 2.000
+61->id980400 MLDOSE 0.663 1.607 1.733 1.588 1.867 2.000
+62->id869939 MLDOSE 0.667 1.619 1.733 1.588 1.865 2.000
+63->id297563 MLDOSE 0.673 1.614 1.72 1.585 1.866 2.000
+64->id852663 MLDOSE 0.666 1.603 1.729 1.585 1.87 2.000
+65->id162070 MLDOSE 0.666 1.619 1.728 1.572 1.868 2.000
+66->id272875 MLDOSE 0.66 1.605 1.737 1.584 1.869 2.000
+67->id163787 MLDOSE 0.661 1.616 1.723 1.584 1.87 2.000
+68->id422204 MLDOSE 0.663 1.615 1.734 1.576 1.867 2.000
+69->id120197 MLDOSE 0.66 1.62 1.731 1.588 1.87 2.000
+70->id33660 MLDOSE 0.658 1.62 1.736 1.571 1.869 2.000
+71->id803855 MLDOSE 0.669 1.616 1.732 1.586 1.865 2.000
+72->id255048 MLDOSE 0.675 1.616 1.726 1.582 1.866 2.000
+73->id690936 MLDOSE 0.657 1.588 1.738 1.59 1.87 2.000
+74->id126807 MLDOSE 0.667 1.612 1.731 1.589 1.864 2.000
+75->id99016 MLDOSE 0.667 1.612 1.734 1.59 1.864 2.000
+76->id883847 MLDOSE 0.666 1.611 1.736 1.587 1.869 2.000
+77->id354523 MLDOSE 0.669 1.62 1.734 1.584 1.868 2.000
+78->id737255 MLDOSE 0.666 1.623 1.733 1.569 1.867 2.000
+79->id990941 MLDOSE 0.675 1.62 1.734 1.585 1.869 2.000
+80->id25464 MLDOSE 0.673 1.62 1.737 1.579 1.868 2.000
+81->id918375 MLDOSE 0.672 1.621 1.737 1.58 1.869 2.000
+82->id537828 MLDOSE 0.666 1.613 1.729 1.585 1.869 2.000
+83->id682778 MLDOSE 0.658 1.621 1.737 1.573 1.869 2.000
+84->id587547 MLDOSE 0.669 1.62 1.738 1.585 1.868 2.000
+85->id670874 MLDOSE 0.666 1.618 1.734 1.58 1.867 2.000
+86->id444459 MLDOSE 0.66 1.617 1.734 1.577 1.87 2.000
+87->id777456 MLDOSE 0.663 1.615 1.732 1.581 1.865 2.000
+88->id452384 MLDOSE 0.666 1.625 1.738 1.588 1.869 2.000
+89->id826975 MLDOSE 0.669 1.619 1.731 1.582 1.865 2.000
+90->id519567 MLDOSE 0.66 1.621 1.732 1.586 1.869 2.000
+91->id84292 MLDOSE 0.663 1.618 1.737 1.582 1.868 2.000
+92->id124432 MLDOSE 0.684 1.621 1.736 1.591 1.867 2.000
+93->id800145 MLDOSE 0.681 1.621 1.737 1.587 1.869 2.000
+94->id153857 MLDOSE 0.661 1.617 1.739 1.585 1.87 2.000
+95->id587157 MLDOSE 0.663 1.619 1.736 1.584 1.866 2.000
+96->id506262 MLDOSE 0.664 1.613 1.719 1.592 1.855 2.000
+97->id634462 MLDOSE 0.673 1.623 1.737 1.585 1.869 2.000
+98->id687592 MLDOSE 0.664 1.615 1.726 1.584 1.869 2.000
+99->id955526 MLDOSE 0.663 1.621 1.737 1.566 1.869 2.000
+100->id181850 MLDOSE 0.66 1.603 1.736 1.586 1.869 2.000
+101->id159506 MLDOSE 0.667 1.621 1.735 1.585 1.868 2.000
+102->id609051 MLDOSE 0.675 1.618 1.73 1.59 1.86 2.000
+103->id963886 MLDOSE 0.663 1.612 1.739 1.581 1.87 2.000
+104->id405792 MLDOSE 0.682 1.621 1.737 1.589 1.869 2.000
+105->id494172 MLDOSE 0.66 1.607 1.736 1.58 1.868 2.000
+106->id964637 MLDOSE 0.663 1.616 1.73 1.59 1.861 2.000
+107->id799355 MLDOSE 0.669 1.62 1.735 1.585 1.868 2.000
+108->id157111 MLDOSE 0.658 1.601 1.731 1.588 1.87 2.000
+109->id114524 MLDOSE 0.666 1.603 1.729 1.585 1.87 2.000
+110->id954931 MLDOSE 0.676 1.62 1.733 1.585 1.868 2.000
+111->id827034 MLDOSE 0.664 1.613 1.737 1.579 1.869 2.000
+112->id689645 MLDOSE 0.657 1.611 1.736 1.59 1.868 2.000
+113->id281585 MLDOSE 0.673 1.621 1.736 1.584 1.869 2.000
+114->id885624 MLDOSE 0.672 1.619 1.734 1.585 1.869 2.000
+115->id577871 MLDOSE 0.67 1.616 1.731 1.585 1.864 2.000
+116->id238796 MLDOSE 0.667 1.62 1.734 1.585 1.867 2.000
+117->id481035 MLDOSE 0.664 1.62 1.737 1.588 1.867 2.000
+118->id972713 MLDOSE 0.666 1.611 1.73 1.589 1.869 2.000
+119->id905484 MLDOSE 0.66 1.62 1.728 1.572 1.869 2.000
+120->id713511 MLDOSE 0.664 1.605 1.733 1.585 1.866 2.000
+121->id512328 MLDOSE 0.67 1.616 1.737 1.584 1.869 2.000
+122->id703534 MLDOSE 0.67 1.615 1.731 1.59 1.862 2.000
+123->id409904 MLDOSE 0.678 1.622 1.734 1.585 1.868 2.000
+124->id577169 MLDOSE 0.669 1.616 1.734 1.582 1.867 2.000
+125->id813971 MLDOSE 0.657 1.606 1.72 1.591 1.85 2.000
+126->id558483 MLDOSE 0.669 1.62 1.737 1.59 1.868 2.000
+127->id892784 MLDOSE 0.669 1.621 1.733 1.586 1.866 2.000
+128->id611178 MLDOSE 0.666 1.611 1.735 1.582 1.866 2.000
+129->id192732 MLDOSE 0.666 1.618 1.735 1.59 1.868 2.000
+130->id917280 MLDOSE 0.66 1.602 1.736 1.567 1.869 2.000
+131->id435876 MLDOSE 0.678 1.619 1.739 1.586 1.87 2.000
+132->id980722 MLDOSE 0.663 1.62 1.735 1.572 1.869 2.000
+133->id308273 MLDOSE 0.661 1.617 1.737 1.582 1.868 2.000
+134->id476685 MLDOSE 0.675 1.618 1.733 1.584 1.867 2.000
+135->id315883 MLDOSE 0.669 1.612 1.736 1.573 1.869 2.000
+136->id935945 MLDOSE 0.663 1.614 1.733 1.58 1.865 2.000
+137->id991781 MLDOSE 0.664 1.614 1.731 1.586 1.864 2.000
+138->id65199 MLDOSE 0.661 1.619 1.731 1.575 1.869 2.000
+139->id226233 MLDOSE 0.661 1.618 1.724 1.59 1.854 2.000
+140->id860183 MLDOSE 0.66 1.609 1.734 1.577 1.866 2.000
+141->id295209 MLDOSE 0.669 1.614 1.735 1.585 1.867 2.000
+142->id544964 MLDOSE 0.669 1.619 1.732 1.582 1.868 2.000
+143->id648663 MLDOSE 0.666 1.617 1.734 1.585 1.868 2.000
+144->id710165 MLDOSE 0.666 1.615 1.728 1.585 1.869 2.000
+145->id392593 MLDOSE 0.666 1.621 1.738 1.569 1.868 2.000
+146->id129945 MLDOSE 0.66 1.62 1.733 1.587 1.869 2.000
+147->id382621 MLDOSE 0.684 1.621 1.736 1.591 1.867 2.000
+148->id901440 MLDOSE 0.661 1.615 1.718 1.59 1.852 2.000
+149->id39847 MLDOSE 0.669 1.619 1.729 1.58 1.863 2.000
+150->id526460 MLDOSE 0.664 1.614 1.731 1.586 1.863 2.000
+151->id477473 MLDOSE 0.672 1.619 1.73 1.589 1.862 2.000
+152->id448194 MLDOSE 0.669 1.614 1.737 1.586 1.868 2.000
+153->id904184 MLDOSE 0.67 1.618 1.73 1.577 1.868 2.000
+154->id747852 MLDOSE 0.664 1.615 1.73 1.578 1.869 2.000
+155->id711012 MLDOSE 0.672 1.605 1.736 1.575 1.868 2.000
+156->id683879 MLDOSE 0.672 1.619 1.734 1.588 1.867 2.000
+157->id789575 MLDOSE 0.658 1.618 1.733 1.591 1.863 2.000
+158->id650729 MLDOSE 0.676 1.615 1.733 1.589 1.867 2.000
+159->id934302 MLDOSE 0.66 1.62 1.733 1.581 1.866 2.000
+160->id555013 MLDOSE 0.667 1.622 1.731 1.574 1.865 2.000
+161->id82779 MLDOSE 0.675 1.618 1.73 1.585 1.867 2.000
+162->id771444 MLDOSE 0.669 1.616 1.718 1.592 1.856 2.000
+163->id821562 MLDOSE 0.675 1.625 1.739 1.58 1.87 2.000
+164->id292809 MLDOSE 0.66 1.614 1.731 1.58 1.869 2.000
+165->id645690 MLDOSE 0.684 1.624 1.733 1.586 1.867 2.000
+166->id223901 MLDOSE 0.666 1.615 1.733 1.576 1.868 2.000
+167->id41320 MLDOSE 0.661 1.617 1.732 1.576 1.869 2.000
+168->id96181 MLDOSE 0.684 1.621 1.716 1.593 1.867 2.000
+169->id147900 MLDOSE 0.658 1.603 1.738 1.577 1.868 2.000
+170->id702917 MLDOSE 0.669 1.614 1.731 1.59 1.864 2.000
+171->id150640 MLDOSE 0.669 1.621 1.734 1.583 1.868 2.000
+172->id518391 MLDOSE 0.66 1.62 1.736 1.589 1.869 2.000
+173->id879076 MLDOSE 0.661 1.613 1.738 1.573 1.868 2.000
+174->id952031 MLDOSE 0.66 1.621 1.734 1.58 1.866 2.000
+175->id10055 MLDOSE 0.67 1.611 1.732 1.589 1.866 2.000
+176->id727213 MLDOSE 0.664 1.622 1.733 1.583 1.869 2.000
+177->id41961 MLDOSE 0.66 1.62 1.737 1.572 1.867 2.000
+178->id257209 MLDOSE 0.673 1.616 1.736 1.588 1.869 2.000
+179->id995361 MLDOSE 0.661 1.62 1.723 1.571 1.868 2.000
+180->id957918 MLDOSE 0.663 1.618 1.726 1.581 1.869 2.000
+181->id975370 MLDOSE 0.67 1.614 1.738 1.583 1.87 2.000
+182->id889896 MLDOSE 0.679 1.618 1.733 1.589 1.869 2.000
+183->id978164 MLDOSE 0.669 1.62 1.735 1.586 1.868 2.000
+184->id90359 MLDOSE 0.675 1.621 1.737 1.58 1.869 2.000
+185->id307158 MLDOSE 0.675 1.615 1.71 1.591 1.86 2.000
+186->id755940 MLDOSE 0.669 1.618 1.734 1.577 1.869 2.000
+187->id995582 MLDOSE 0.666 1.615 1.724 1.591 1.853 2.000
+188->id363965 MLDOSE 0.663 1.619 1.736 1.574 1.868 2.000
+189->id729124 MLDOSE 0.666 1.611 1.73 1.587 1.86 2.000
+190->id871963 MLDOSE 0.67 1.62 1.737 1.585 1.868 2.000
+191->id475172 MLDOSE 0.663 1.621 1.737 1.579 1.869 2.000
+192->id804699 MLDOSE 0.663 1.619 1.731 1.581 1.868 2.000
+193->id625843 MLDOSE 0.667 1.622 1.738 1.583 1.87 2.000
+194->id595713 MLDOSE 0.657 1.599 1.736 1.588 1.869 2.000
+195->id462604 MLDOSE 0.663 1.616 1.731 1.584 1.867 2.000
+196->id106141 MLDOSE 0.672 1.612 1.732 1.589 1.864 2.000
+197->id689349 MLDOSE 0.666 1.609 1.738 1.583 1.869 2.000
+198->id639003 MLDOSE 0.672 1.618 1.728 1.58 1.863 2.000
+199->id393896 MLDOSE 0.663 1.617 1.73 1.579 1.868 2.000
+200->id450307 MLDOSE 0.663 1.622 1.739 1.588 1.87 2.000
diff --git a/checks/inputfiles/test.mlinfo b/checks/inputfiles/test.mlinfo
index 4afccee..395a47e 100644
--- a/checks/inputfiles/test.mlinfo
+++ b/checks/inputfiles/test.mlinfo
@@ -4,3 +4,4 @@ rs8102643	C	TGGT	0.5847	0.4150	0.9308	0.8685
 rs8102615	T	A	0.5006	0.4702	0.9375	0.8932
 rs8105536	G	A	0.5783	0.4213	0.9353	0.8832
 rs2312724	T	C	0.9122	0.0877	0.9841	1.3e-17
+rs3174230	G	C	0.8123	1.2e-5	0.9991	0.0185
diff --git a/checks/inputfiles/test.mlprob b/checks/inputfiles/test.mlprob
index 27305a5..e02c749 100644
--- a/checks/inputfiles/test.mlprob
+++ b/checks/inputfiles/test.mlprob
@@ -1,200 +1,200 @@
-1->id636728 ML_PROB 0.115 0.448 0.658 0.306 0.75 0.232 0.628 0.329 0.871 0.125
-2->id890314 ML_PROB 0.109 0.442 0.657 0.307 0.754 0.229 0.632 0.326 0.873 0.123
-3->id102874 ML_PROB 0.117 0.45 0.659 0.305 0.749 0.233 0.628 0.329 0.87 0.126
-4->id200949 ML_PROB 0.111 0.445 NaN   NaN   0.747 0.234 0.621 0.334 0.871 0.124
-5->id336491 ML_PROB 0.109 0.442 0.647 0.315 0.754 0.229 0.622 0.333 0.873 0.123
-6->id988766 ML_PROB 0.118 0.451 0.658 0.306 0.755 0.228 0.632 0.326 0.873 0.122
-7->id21999 ML_PROB 0.112 0.446 0.656 0.308 0.753 0.229 0.63 0.328 0.872 0.123
-8->id433893 ML_PROB 0.11 0.443 0.652 0.311 0.752 0.23 0.618 0.336 0.873 0.123
-9->id688932 ML_PROB 0.113 0.446 0.655 0.309 0.747 0.235 0.628 0.329 0.867 0.128
-10->id394203 ML_PROB 0.111 0.444 0.655 0.309 0.748 0.233 0.624 0.332 0.868 0.127
-11->id995678 ML_PROB 0.113 0.446 0.655 0.309 0.751 0.231 0.626 0.331 0.871 0.125
-12->id694339 ML_PROB 0.111 0.444 0.652 0.311 0.751 0.231 0.632 0.326 0.873 0.123
-13->id256455 ML_PROB 0.113 0.447 0.654 0.309 0.754 0.229 0.627 0.33 0.873 0.123
-14->id14836 ML_PROB 0.113 0.446 0.656 0.308 0.754 0.229 0.626 0.33 0.873 0.123
-15->id817128 ML_PROB 0.111 0.444 0.647 0.315 0.753 0.229 0.631 0.327 0.872 0.124
-16->id803325 ML_PROB 0.115 0.448 0.656 0.308 0.748 0.234 0.633 0.325 0.873 0.122
-17->id521287 ML_PROB 0.109 0.443 0.654 0.31 0.754 0.228 0.628 0.329 0.874 0.122
-18->id701472 ML_PROB 0.111 0.444 0.657 0.307 0.749 0.233 0.628 0.329 0.871 0.125
-19->id850010 ML_PROB 0.112 0.445 0.652 0.311 0.753 0.23 0.625 0.331 0.872 0.124
-20->id268483 ML_PROB 0.112 0.445 0.654 0.31 0.75 0.232 0.626 0.33 0.869 0.127
-21->id738781 ML_PROB 0.111 0.444 0.649 0.313 0.748 0.234 0.632 0.326 0.867 0.128
-22->id28411 ML_PROB 0.109 0.442 0.656 0.308 0.752 0.231 0.616 0.338 0.873 0.123
-23->id541635 ML_PROB 0.112 0.445 0.658 0.306 0.744 0.237 0.607 0.344 0.873 0.122
-24->id751101 ML_PROB 0.112 0.445 0.659 0.306 0.755 0.228 0.631 0.327 0.873 0.123
-25->id826300 ML_PROB 0.111 0.444 0.644 0.317 0.753 0.23 0.629 0.328 0.873 0.123
-26->id884387 ML_PROB 0.109 0.443 0.643 0.318 0.752 0.23 0.63 0.327 0.872 0.124
-27->id492414 ML_PROB 0.111 0.444 0.655 0.309 0.751 0.231 0.627 0.329 0.871 0.124
-28->id268871 ML_PROB 0.112 0.445 0.657 0.307 0.749 0.233 0.621 0.334 0.873 0.123
-29->id627354 ML_PROB 0.111 0.444 0.652 0.311 0.752 0.231 0.632 0.326 0.873 0.123
-30->id503932 ML_PROB 0.109 0.442 0.656 0.308 0.753 0.229 0.629 0.328 0.872 0.123
-31->id163442 ML_PROB 0.114 0.447 0.657 0.307 0.754 0.229 0.629 0.328 0.873 0.123
-32->id317797 ML_PROB 0.107 0.44 0.66 0.305 0.756 0.227 0.616 0.338 0.874 0.122
-33->id687857 ML_PROB 0.111 0.445 0.657 0.307 0.752 0.23 0.629 0.328 0.873 0.123
-34->id871570 ML_PROB 0.111 0.444 0.648 0.314 0.749 0.233 0.621 0.334 0.869 0.126
-35->id724067 ML_PROB 0.111 0.444 0.655 0.309 0.753 0.23 0.626 0.331 0.872 0.124
-36->id874076 ML_PROB 0.114 0.448 0.654 0.309 0.755 0.228 0.628 0.329 0.873 0.123
-37->id927863 ML_PROB 0.112 0.446 0.656 0.308 0.752 0.23 0.629 0.328 0.87 0.125
-38->id369805 ML_PROB 0.11 0.443 0.653 0.31 0.748 0.234 0.627 0.329 0.871 0.125
-39->id668376 ML_PROB 0.114 0.447 0.654 0.309 0.754 0.228 0.626 0.33 0.873 0.123
-40->id717362 ML_PROB 0.109 0.442 0.656 0.308 0.753 0.23 0.632 0.326 0.873 0.123
-41->id665504 ML_PROB 0.112 0.445 0.654 0.31 0.75 0.232 0.622 0.334 0.871 0.125
-42->id336637 ML_PROB 0.109 0.443 0.655 0.308 0.752 0.23 0.621 0.334 0.87 0.125
-43->id60633 ML_PROB 0.112 0.445 0.655 0.309 0.749 0.233 0.623 0.333 0.871 0.124
-44->id848600 ML_PROB 0.11 0.444 0.652 0.311 0.754 0.229 0.621 0.334 0.873 0.123
-45->id169514 ML_PROB 0.11 0.444 0.652 0.311 0.754 0.229 0.627 0.329 0.873 0.123
-46->id690732 ML_PROB 0.11 0.443 0.655 0.309 0.754 0.229 0.629 0.328 0.872 0.124
-47->id684760 ML_PROB 0.111 0.445 0.656 0.308 0.752 0.23 0.622 0.334 0.87 0.126
-48->id553502 ML_PROB 0.113 0.446 0.647 0.314 0.75 0.232 0.632 0.326 0.873 0.123
-49->id214917 ML_PROB 0.112 0.445 0.654 0.31 0.746 0.235 0.63 0.328 0.87 0.125
-50->id849169 ML_PROB 0.11 0.444 0.659 0.306 0.751 0.231 0.63 0.328 0.871 0.125
-51->id941921 ML_PROB 0.111 0.445 0.655 0.309 0.749 0.233 0.63 0.328 0.867 0.128
-52->id784646 ML_PROB 0.11 0.443 0.642 0.319 0.756 0.227 0.627 0.33 0.874 0.122
-53->id520954 ML_PROB 0.11 0.444 0.655 0.309 0.75 0.232 0.625 0.331 0.869 0.126
-54->id996355 ML_PROB 0.109 0.442 0.644 0.317 0.753 0.23 0.629 0.328 0.87 0.125
-55->id96730 ML_PROB 0.11 0.444 0.655 0.309 0.754 0.228 0.619 0.335 0.873 0.122
-56->id673442 ML_PROB 0.111 0.444 0.647 0.315 0.753 0.229 0.62 0.335 0.872 0.123
-57->id68305 ML_PROB 0.113 0.446 0.655 0.308 0.752 0.231 0.628 0.329 0.871 0.124
-58->id653025 ML_PROB 0.115 0.448 0.654 0.309 0.755 0.228 0.628 0.329 0.873 0.122
-59->id208543 ML_PROB 0.11 0.444 0.655 0.308 0.752 0.23 0.624 0.332 0.872 0.124
-60->id335725 ML_PROB 0.111 0.444 0.653 0.31 0.735 0.244 0.634 0.325 0.851 0.143
-61->id980400 ML_PROB 0.11 0.443 0.646 0.315 0.751 0.231 0.63 0.328 0.872 0.123
-62->id869939 ML_PROB 0.111 0.445 0.655 0.309 0.751 0.231 0.631 0.326 0.87 0.125
-63->id297563 ML_PROB 0.113 0.447 0.651 0.312 0.74 0.24 0.628 0.329 0.87 0.126
-64->id852663 ML_PROB 0.111 0.444 0.643 0.317 0.748 0.233 0.628 0.329 0.874 0.122
-65->id162070 ML_PROB 0.111 0.444 0.655 0.309 0.746 0.236 0.618 0.336 0.872 0.124
-66->id272875 ML_PROB 0.109 0.442 0.644 0.317 0.754 0.229 0.627 0.33 0.873 0.123
-67->id163787 ML_PROB 0.109 0.443 0.653 0.31 0.742 0.239 0.627 0.33 0.874 0.122
-68->id422204 ML_PROB 0.11 0.443 0.652 0.311 0.752 0.23 0.621 0.334 0.871 0.125
-69->id120197 ML_PROB 0.109 0.442 0.656 0.308 0.749 0.233 0.63 0.328 0.874 0.122
-70->id33660 ML_PROB 0.108 0.442 0.656 0.308 0.754 0.228 0.617 0.337 0.873 0.123
-71->id803855 ML_PROB 0.112 0.445 0.653 0.31 0.75 0.232 0.629 0.328 0.869 0.127
-72->id255048 ML_PROB 0.114 0.447 0.653 0.31 0.745 0.236 0.626 0.33 0.87 0.126
-73->id690936 ML_PROB 0.108 0.441 0.631 0.326 0.755 0.228 0.632 0.326 0.874 0.122
-74->id126807 ML_PROB 0.111 0.445 0.649 0.314 0.749 0.233 0.631 0.327 0.868 0.128
-75->id99016 ML_PROB 0.111 0.445 0.65 0.312 0.751 0.232 0.632 0.326 0.869 0.126
-76->id883847 ML_PROB 0.111 0.444 0.649 0.313 0.753 0.23 0.63 0.327 0.873 0.123
-77->id354523 ML_PROB 0.112 0.445 0.656 0.308 0.752 0.23 0.627 0.33 0.872 0.124
-78->id737255 ML_PROB 0.111 0.444 0.658 0.307 0.751 0.231 0.616 0.337 0.871 0.125
-79->id990941 ML_PROB 0.114 0.447 0.656 0.308 0.752 0.23 0.628 0.329 0.873 0.123
-80->id25464 ML_PROB 0.113 0.447 0.656 0.308 0.755 0.227 0.623 0.333 0.873 0.122
-81->id918375 ML_PROB 0.113 0.446 0.657 0.307 0.754 0.229 0.624 0.332 0.873 0.123
-82->id537828 ML_PROB 0.111 0.444 0.651 0.311 0.747 0.235 0.628 0.329 0.873 0.123
-83->id682778 ML_PROB 0.108 0.442 0.657 0.307 0.754 0.229 0.619 0.335 0.873 0.123
-84->id587547 ML_PROB 0.112 0.445 0.656 0.308 0.755 0.228 0.628 0.329 0.873 0.122
-85->id670874 ML_PROB 0.111 0.444 0.654 0.31 0.752 0.23 0.624 0.332 0.871 0.125
-86->id444459 ML_PROB 0.109 0.442 0.654 0.309 0.752 0.23 0.622 0.333 0.874 0.122
-87->id777456 ML_PROB 0.11 0.443 0.652 0.311 0.75 0.232 0.625 0.331 0.87 0.125
-88->id452384 ML_PROB 0.111 0.444 0.66 0.305 0.755 0.228 0.63 0.328 0.873 0.123
-89->id826975 ML_PROB 0.112 0.445 0.655 0.309 0.749 0.233 0.626 0.33 0.87 0.125
-90->id519567 ML_PROB 0.109 0.442 0.657 0.307 0.75 0.232 0.629 0.328 0.873 0.123
-91->id84292 ML_PROB 0.11 0.443 0.654 0.31 0.754 0.229 0.626 0.33 0.872 0.124
-92->id124432 ML_PROB 0.117 0.45 0.657 0.307 0.753 0.23 0.633 0.325 0.871 0.125
-93->id800145 ML_PROB 0.116 0.449 0.657 0.307 0.754 0.229 0.63 0.327 0.873 0.123
-94->id153857 ML_PROB 0.109 0.443 0.654 0.309 0.756 0.227 0.628 0.329 0.874 0.122
-95->id587157 ML_PROB 0.11 0.443 0.655 0.309 0.753 0.23 0.627 0.33 0.871 0.124
-96->id506262 ML_PROB 0.11 0.444 0.651 0.311 0.739 0.241 0.633 0.326 0.86 0.135
-97->id634462 ML_PROB 0.113 0.447 0.658 0.307 0.754 0.229 0.628 0.329 0.873 0.123
-98->id687592 ML_PROB 0.11 0.444 0.652 0.311 0.745 0.236 0.627 0.33 0.873 0.123
-99->id955526 ML_PROB 0.11 0.443 0.657 0.307 0.754 0.229 0.613 0.34 0.873 0.123
-100->id181850 ML_PROB 0.109 0.442 0.642 0.319 0.754 0.228 0.629 0.328 0.873 0.123
-101->id159506 ML_PROB 0.111 0.445 0.657 0.307 0.753 0.229 0.628 0.329 0.872 0.124
-102->id609051 ML_PROB 0.114 0.447 0.655 0.308 0.748 0.234 0.632 0.326 0.865 0.13
-103->id963886 ML_PROB 0.11 0.443 0.65 0.312 0.756 0.227 0.625 0.331 0.874 0.122
-104->id405792 ML_PROB 0.116 0.45 0.657 0.307 0.754 0.229 0.631 0.327 0.873 0.123
-105->id494172 ML_PROB 0.109 0.442 0.646 0.315 0.754 0.228 0.624 0.332 0.873 0.122
-106->id964637 ML_PROB 0.11 0.443 0.653 0.31 0.748 0.234 0.632 0.326 0.866 0.129
-107->id799355 ML_PROB 0.112 0.445 0.656 0.308 0.753 0.229 0.628 0.329 0.873 0.122
-108->id157111 ML_PROB 0.108 0.442 0.641 0.319 0.749 0.233 0.63 0.328 0.874 0.122
-109->id114524 ML_PROB 0.111 0.444 0.643 0.317 0.748 0.233 0.628 0.329 0.874 0.122
-110->id954931 ML_PROB 0.114 0.448 0.656 0.308 0.751 0.231 0.628 0.329 0.872 0.124
-111->id827034 ML_PROB 0.11 0.444 0.65 0.313 0.754 0.229 0.623 0.333 0.873 0.123
-112->id689645 ML_PROB 0.108 0.441 0.649 0.313 0.754 0.228 0.632 0.326 0.873 0.122
-113->id281585 ML_PROB 0.113 0.447 0.657 0.307 0.754 0.228 0.627 0.33 0.873 0.123
-114->id885624 ML_PROB 0.113 0.446 0.655 0.309 0.752 0.23 0.628 0.329 0.873 0.123
-115->id577871 ML_PROB 0.112 0.446 0.653 0.31 0.749 0.233 0.628 0.329 0.868 0.128
-116->id238796 ML_PROB 0.111 0.445 0.656 0.308 0.752 0.23 0.628 0.329 0.871 0.125
-117->id481035 ML_PROB 0.11 0.444 0.656 0.308 0.754 0.229 0.63 0.328 0.872 0.123
-118->id972713 ML_PROB 0.111 0.444 0.649 0.313 0.748 0.234 0.631 0.327 0.873 0.123
-119->id905484 ML_PROB 0.109 0.442 0.656 0.308 0.747 0.234 0.618 0.336 0.873 0.123
-120->id713511 ML_PROB 0.11 0.444 0.644 0.317 0.751 0.231 0.628 0.329 0.87 0.126
-121->id512328 ML_PROB 0.112 0.446 0.653 0.31 0.754 0.229 0.627 0.33 0.873 0.123
-122->id703534 ML_PROB 0.112 0.446 0.652 0.311 0.749 0.233 0.632 0.326 0.867 0.128
-123->id409904 ML_PROB 0.115 0.448 0.658 0.306 0.752 0.23 0.628 0.329 0.872 0.124
-124->id577169 ML_PROB 0.112 0.445 0.653 0.31 0.752 0.23 0.626 0.33 0.871 0.125
-125->id813971 ML_PROB 0.108 0.441 0.645 0.316 0.74 0.24 0.633 0.325 0.856 0.138
-126->id558483 ML_PROB 0.112 0.445 0.656 0.308 0.754 0.229 0.632 0.326 0.873 0.122
-127->id892784 ML_PROB 0.112 0.445 0.657 0.307 0.751 0.231 0.629 0.328 0.871 0.124
-128->id611178 ML_PROB 0.111 0.444 0.649 0.313 0.752 0.231 0.626 0.33 0.871 0.124
-129->id192732 ML_PROB 0.111 0.444 0.654 0.31 0.753 0.229 0.632 0.326 0.873 0.122
-130->id917280 ML_PROB 0.109 0.442 0.642 0.318 0.753 0.23 0.614 0.339 0.873 0.123
-131->id435876 ML_PROB 0.115 0.448 0.655 0.309 0.756 0.227 0.629 0.328 0.874 0.122
-132->id980722 ML_PROB 0.11 0.443 0.656 0.308 0.753 0.229 0.618 0.336 0.873 0.123
-133->id308273 ML_PROB 0.109 0.443 0.654 0.309 0.754 0.229 0.626 0.33 0.873 0.122
-134->id476685 ML_PROB 0.114 0.447 0.655 0.308 0.751 0.231 0.627 0.33 0.871 0.125
-135->id315883 ML_PROB 0.112 0.445 0.65 0.312 0.754 0.228 0.619 0.335 0.873 0.123
-136->id935945 ML_PROB 0.11 0.443 0.651 0.312 0.751 0.231 0.624 0.332 0.87 0.125
-137->id991781 ML_PROB 0.11 0.444 0.651 0.312 0.749 0.233 0.629 0.328 0.869 0.126
-138->id65199 ML_PROB 0.109 0.443 0.655 0.309 0.749 0.233 0.62 0.335 0.873 0.123
-139->id226233 ML_PROB 0.109 0.443 0.654 0.31 0.743 0.238 0.632 0.326 0.86 0.134
-140->id860183 ML_PROB 0.109 0.442 0.647 0.315 0.752 0.23 0.622 0.333 0.871 0.124
-141->id295209 ML_PROB 0.112 0.445 0.651 0.312 0.752 0.231 0.628 0.329 0.872 0.123
-142->id544964 ML_PROB 0.112 0.445 0.655 0.309 0.75 0.232 0.626 0.33 0.872 0.124
-143->id648663 ML_PROB 0.111 0.444 0.654 0.309 0.752 0.23 0.628 0.329 0.872 0.124
-144->id710165 ML_PROB 0.111 0.444 0.652 0.311 0.747 0.234 0.628 0.329 0.873 0.123
-145->id392593 ML_PROB 0.111 0.444 0.657 0.307 0.755 0.228 0.616 0.337 0.873 0.122
-146->id129945 ML_PROB 0.109 0.442 0.656 0.308 0.751 0.231 0.629 0.329 0.873 0.123
-147->id382621 ML_PROB 0.117 0.45 0.657 0.307 0.753 0.23 0.633 0.325 0.871 0.125
-148->id901440 ML_PROB 0.109 0.443 0.652 0.311 0.738 0.242 0.632 0.326 0.858 0.136
-149->id39847 ML_PROB 0.112 0.445 0.655 0.309 0.747 0.235 0.624 0.332 0.868 0.127
-150->id526460 ML_PROB 0.11 0.444 0.651 0.312 0.749 0.233 0.629 0.328 0.868 0.127
-151->id477473 ML_PROB 0.113 0.446 0.655 0.309 0.748 0.234 0.631 0.327 0.867 0.128
-152->id448194 ML_PROB 0.112 0.445 0.651 0.312 0.754 0.229 0.629 0.328 0.873 0.122
-153->id904184 ML_PROB 0.112 0.446 0.655 0.308 0.748 0.234 0.622 0.333 0.872 0.124
-154->id747852 ML_PROB 0.11 0.444 0.652 0.311 0.748 0.234 0.623 0.332 0.873 0.123
-155->id711012 ML_PROB 0.113 0.446 0.644 0.317 0.754 0.228 0.62 0.335 0.873 0.122
-156->id683879 ML_PROB 0.113 0.446 0.655 0.309 0.752 0.23 0.63 0.328 0.872 0.123
-157->id789575 ML_PROB 0.108 0.442 0.655 0.308 0.751 0.231 0.633 0.325 0.868 0.127
-158->id650729 ML_PROB 0.114 0.448 0.652 0.311 0.751 0.231 0.631 0.327 0.872 0.123
-159->id934302 ML_PROB 0.109 0.442 0.656 0.308 0.751 0.231 0.625 0.331 0.87 0.126
-160->id555013 ML_PROB 0.111 0.445 0.658 0.306 0.749 0.233 0.619 0.336 0.87 0.125
-161->id82779 ML_PROB 0.114 0.447 0.654 0.31 0.748 0.234 0.628 0.329 0.871 0.125
-162->id771444 ML_PROB 0.112 0.445 0.653 0.31 0.738 0.242 0.633 0.326 0.861 0.134
-163->id821562 ML_PROB 0.114 0.447 0.66 0.305 0.756 0.227 0.624 0.332 0.874 0.122
-164->id292809 ML_PROB 0.109 0.442 0.651 0.312 0.749 0.233 0.624 0.332 0.873 0.123
-165->id645690 ML_PROB 0.117 0.45 0.659 0.306 0.751 0.231 0.629 0.328 0.871 0.125
-166->id223901 ML_PROB 0.111 0.444 0.652 0.311 0.751 0.231 0.621 0.334 0.872 0.124
-167->id41320 ML_PROB 0.109 0.443 0.654 0.309 0.75 0.232 0.621 0.334 0.873 0.123
-168->id96181 ML_PROB 0.117 0.45 0.657 0.307 0.736 0.244 0.634 0.325 0.871 0.125
-169->id147900 ML_PROB 0.108 0.442 0.642 0.319 0.755 0.228 0.622 0.333 0.873 0.122
-170->id702917 ML_PROB 0.112 0.445 0.651 0.312 0.749 0.233 0.632 0.326 0.869 0.126
-171->id150640 ML_PROB 0.112 0.445 0.657 0.307 0.752 0.23 0.627 0.329 0.872 0.124
-172->id518391 ML_PROB 0.109 0.442 0.656 0.308 0.753 0.23 0.631 0.327 0.873 0.123
-173->id879076 ML_PROB 0.109 0.443 0.65 0.313 0.755 0.228 0.619 0.335 0.873 0.122
-174->id952031 ML_PROB 0.109 0.442 0.657 0.307 0.752 0.23 0.624 0.332 0.871 0.124
-175->id10055 ML_PROB 0.112 0.446 0.649 0.313 0.75 0.232 0.631 0.327 0.87 0.126
-176->id727213 ML_PROB 0.11 0.444 0.658 0.306 0.751 0.231 0.626 0.331 0.873 0.123
-177->id41961 ML_PROB 0.109 0.442 0.656 0.308 0.754 0.229 0.618 0.336 0.872 0.123
-178->id257209 ML_PROB 0.113 0.447 0.653 0.31 0.753 0.23 0.631 0.326 0.873 0.123
-179->id995361 ML_PROB 0.109 0.443 0.656 0.308 0.742 0.239 0.617 0.337 0.873 0.122
-180->id957918 ML_PROB 0.11 0.443 0.655 0.308 0.745 0.236 0.625 0.331 0.873 0.123
-181->id975370 ML_PROB 0.112 0.446 0.651 0.312 0.755 0.228 0.627 0.329 0.874 0.122
-182->id889896 ML_PROB 0.115 0.449 0.654 0.31 0.751 0.231 0.631 0.327 0.873 0.123
-183->id978164 ML_PROB 0.112 0.445 0.656 0.308 0.752 0.231 0.629 0.328 0.872 0.124
-184->id90359 ML_PROB 0.114 0.447 0.657 0.307 0.754 0.229 0.624 0.332 0.873 0.123
-185->id307158 ML_PROB 0.114 0.447 0.652 0.311 0.731 0.248 0.633 0.325 0.865 0.13
-186->id755940 ML_PROB 0.112 0.445 0.655 0.308 0.751 0.232 0.622 0.333 0.873 0.123
-187->id995582 ML_PROB 0.111 0.444 0.652 0.311 0.743 0.238 0.633 0.325 0.859 0.135
-188->id363965 ML_PROB 0.11 0.443 0.655 0.309 0.754 0.228 0.619 0.336 0.873 0.122
-189->id729124 ML_PROB 0.111 0.444 0.649 0.313 0.748 0.234 0.63 0.327 0.865 0.13
-190->id871963 ML_PROB 0.112 0.446 0.656 0.308 0.754 0.229 0.628 0.329 0.873 0.122
-191->id475172 ML_PROB 0.11 0.443 0.657 0.307 0.754 0.229 0.623 0.333 0.873 0.123
-192->id804699 ML_PROB 0.11 0.443 0.655 0.309 0.749 0.233 0.625 0.331 0.873 0.122
-193->id625843 ML_PROB 0.111 0.445 0.658 0.306 0.755 0.228 0.626 0.331 0.874 0.122
-194->id595713 ML_PROB 0.108 0.441 0.639 0.321 0.753 0.23 0.63 0.328 0.873 0.123
-195->id462604 ML_PROB 0.11 0.443 0.653 0.31 0.749 0.233 0.627 0.33 0.871 0.125
-196->id106141 ML_PROB 0.113 0.446 0.65 0.312 0.75 0.232 0.631 0.327 0.869 0.126
-197->id689349 ML_PROB 0.111 0.444 0.647 0.315 0.755 0.228 0.626 0.331 0.873 0.123
-198->id639003 ML_PROB 0.113 0.446 0.654 0.31 0.746 0.236 0.624 0.332 0.868 0.127
-199->id393896 ML_PROB 0.11 0.443 0.654 0.309 0.748 0.234 0.623 0.333 0.873 0.122
-200->id450307 ML_PROB 0.11 0.443 0.658 0.306 0.756 0.227 0.63 0.328 0.874 0.122
+1->id636728 ML_PROB 0.115 0.448 0.658 0.306 0.75 0.232 0.628 0.329 0.871 0.125 0.000 1.000
+2->id890314 ML_PROB 0.109 0.442 0.657 0.307 0.754 0.229 0.632 0.326 0.873 0.123 1.000 0.000
+3->id102874 ML_PROB 0.117 0.45 0.659 0.305 0.749 0.233 0.628 0.329 0.87 0.126 1.000 0.000
+4->id200949 ML_PROB 0.111 0.445 NaN   NaN   0.747 0.234 0.621 0.334 0.871 0.124 1.000 0.000
+5->id336491 ML_PROB 0.109 0.442 0.647 0.315 0.754 0.229 0.622 0.333 0.873 0.123 1.000 0.000
+6->id988766 ML_PROB 0.118 0.451 0.658 0.306 0.755 0.228 0.632 0.326 0.873 0.122 1.000 0.000
+7->id21999 ML_PROB 0.112 0.446 0.656 0.308 0.753 0.229 0.63 0.328 0.872 0.123 1.000 0.000
+8->id433893 ML_PROB 0.11 0.443 0.652 0.311 0.752 0.23 0.618 0.336 0.873 0.123 1.000 0.000
+9->id688932 ML_PROB 0.113 0.446 0.655 0.309 0.747 0.235 0.628 0.329 0.867 0.128 1.000 0.000
+10->id394203 ML_PROB 0.111 0.444 0.655 0.309 0.748 0.233 0.624 0.332 0.868 0.127 1.000 0.000
+11->id995678 ML_PROB 0.113 0.446 0.655 0.309 0.751 0.231 0.626 0.331 0.871 0.125 1.000 0.000
+12->id694339 ML_PROB 0.111 0.444 0.652 0.311 0.751 0.231 0.632 0.326 0.873 0.123 1.000 0.000
+13->id256455 ML_PROB 0.113 0.447 0.654 0.309 0.754 0.229 0.627 0.33 0.873 0.123 1.000 0.000
+14->id14836 ML_PROB 0.113 0.446 0.656 0.308 0.754 0.229 0.626 0.33 0.873 0.123 1.000 0.000
+15->id817128 ML_PROB 0.111 0.444 0.647 0.315 0.753 0.229 0.631 0.327 0.872 0.124 1.000 0.000
+16->id803325 ML_PROB 0.115 0.448 0.656 0.308 0.748 0.234 0.633 0.325 0.873 0.122 1.000 0.000
+17->id521287 ML_PROB 0.109 0.443 0.654 0.31 0.754 0.228 0.628 0.329 0.874 0.122 1.000 0.000
+18->id701472 ML_PROB 0.111 0.444 0.657 0.307 0.749 0.233 0.628 0.329 0.871 0.125 1.000 0.000
+19->id850010 ML_PROB 0.112 0.445 0.652 0.311 0.753 0.23 0.625 0.331 0.872 0.124 1.000 0.000
+20->id268483 ML_PROB 0.112 0.445 0.654 0.31 0.75 0.232 0.626 0.33 0.869 0.127 1.000 0.000
+21->id738781 ML_PROB 0.111 0.444 0.649 0.313 0.748 0.234 0.632 0.326 0.867 0.128 1.000 0.000
+22->id28411 ML_PROB 0.109 0.442 0.656 0.308 0.752 0.231 0.616 0.338 0.873 0.123 1.000 0.000
+23->id541635 ML_PROB 0.112 0.445 0.658 0.306 0.744 0.237 0.607 0.344 0.873 0.122 1.000 0.000
+24->id751101 ML_PROB 0.112 0.445 0.659 0.306 0.755 0.228 0.631 0.327 0.873 0.123 1.000 0.000
+25->id826300 ML_PROB 0.111 0.444 0.644 0.317 0.753 0.23 0.629 0.328 0.873 0.123 1.000 0.000
+26->id884387 ML_PROB 0.109 0.443 0.643 0.318 0.752 0.23 0.63 0.327 0.872 0.124 1.000 0.000
+27->id492414 ML_PROB 0.111 0.444 0.655 0.309 0.751 0.231 0.627 0.329 0.871 0.124 1.000 0.000
+28->id268871 ML_PROB 0.112 0.445 0.657 0.307 0.749 0.233 0.621 0.334 0.873 0.123 1.000 0.000
+29->id627354 ML_PROB 0.111 0.444 0.652 0.311 0.752 0.231 0.632 0.326 0.873 0.123 1.000 0.000
+30->id503932 ML_PROB 0.109 0.442 0.656 0.308 0.753 0.229 0.629 0.328 0.872 0.123 1.000 0.000
+31->id163442 ML_PROB 0.114 0.447 0.657 0.307 0.754 0.229 0.629 0.328 0.873 0.123 1.000 0.000
+32->id317797 ML_PROB 0.107 0.44 0.66 0.305 0.756 0.227 0.616 0.338 0.874 0.122 1.000 0.000
+33->id687857 ML_PROB 0.111 0.445 0.657 0.307 0.752 0.23 0.629 0.328 0.873 0.123 1.000 0.000
+34->id871570 ML_PROB 0.111 0.444 0.648 0.314 0.749 0.233 0.621 0.334 0.869 0.126 1.000 0.000
+35->id724067 ML_PROB 0.111 0.444 0.655 0.309 0.753 0.23 0.626 0.331 0.872 0.124 1.000 0.000
+36->id874076 ML_PROB 0.114 0.448 0.654 0.309 0.755 0.228 0.628 0.329 0.873 0.123 1.000 0.000
+37->id927863 ML_PROB 0.112 0.446 0.656 0.308 0.752 0.23 0.629 0.328 0.87 0.125 1.000 0.000
+38->id369805 ML_PROB 0.11 0.443 0.653 0.31 0.748 0.234 0.627 0.329 0.871 0.125 1.000 0.000
+39->id668376 ML_PROB 0.114 0.447 0.654 0.309 0.754 0.228 0.626 0.33 0.873 0.123 1.000 0.000
+40->id717362 ML_PROB 0.109 0.442 0.656 0.308 0.753 0.23 0.632 0.326 0.873 0.123 1.000 0.000
+41->id665504 ML_PROB 0.112 0.445 0.654 0.31 0.75 0.232 0.622 0.334 0.871 0.125 1.000 0.000
+42->id336637 ML_PROB 0.109 0.443 0.655 0.308 0.752 0.23 0.621 0.334 0.87 0.125 1.000 0.000
+43->id60633 ML_PROB 0.112 0.445 0.655 0.309 0.749 0.233 0.623 0.333 0.871 0.124 1.000 0.000
+44->id848600 ML_PROB 0.11 0.444 0.652 0.311 0.754 0.229 0.621 0.334 0.873 0.123 1.000 0.000
+45->id169514 ML_PROB 0.11 0.444 0.652 0.311 0.754 0.229 0.627 0.329 0.873 0.123 1.000 0.000
+46->id690732 ML_PROB 0.11 0.443 0.655 0.309 0.754 0.229 0.629 0.328 0.872 0.124 1.000 0.000
+47->id684760 ML_PROB 0.111 0.445 0.656 0.308 0.752 0.23 0.622 0.334 0.87 0.126 1.000 0.000
+48->id553502 ML_PROB 0.113 0.446 0.647 0.314 0.75 0.232 0.632 0.326 0.873 0.123 1.000 0.000
+49->id214917 ML_PROB 0.112 0.445 0.654 0.31 0.746 0.235 0.63 0.328 0.87 0.125 1.000 0.000
+50->id849169 ML_PROB 0.11 0.444 0.659 0.306 0.751 0.231 0.63 0.328 0.871 0.125 1.000 0.000
+51->id941921 ML_PROB 0.111 0.445 0.655 0.309 0.749 0.233 0.63 0.328 0.867 0.128 1.000 0.000
+52->id784646 ML_PROB 0.11 0.443 0.642 0.319 0.756 0.227 0.627 0.33 0.874 0.122 1.000 0.000
+53->id520954 ML_PROB 0.11 0.444 0.655 0.309 0.75 0.232 0.625 0.331 0.869 0.126 1.000 0.000
+54->id996355 ML_PROB 0.109 0.442 0.644 0.317 0.753 0.23 0.629 0.328 0.87 0.125 1.000 0.000
+55->id96730 ML_PROB 0.11 0.444 0.655 0.309 0.754 0.228 0.619 0.335 0.873 0.122 1.000 0.000
+56->id673442 ML_PROB 0.111 0.444 0.647 0.315 0.753 0.229 0.62 0.335 0.872 0.123 1.000 0.000
+57->id68305 ML_PROB 0.113 0.446 0.655 0.308 0.752 0.231 0.628 0.329 0.871 0.124 1.000 0.000
+58->id653025 ML_PROB 0.115 0.448 0.654 0.309 0.755 0.228 0.628 0.329 0.873 0.122 1.000 0.000
+59->id208543 ML_PROB 0.11 0.444 0.655 0.308 0.752 0.23 0.624 0.332 0.872 0.124 1.000 0.000
+60->id335725 ML_PROB 0.111 0.444 0.653 0.31 0.735 0.244 0.634 0.325 0.851 0.143 1.000 0.000
+61->id980400 ML_PROB 0.11 0.443 0.646 0.315 0.751 0.231 0.63 0.328 0.872 0.123 1.000 0.000
+62->id869939 ML_PROB 0.111 0.445 0.655 0.309 0.751 0.231 0.631 0.326 0.87 0.125 1.000 0.000
+63->id297563 ML_PROB 0.113 0.447 0.651 0.312 0.74 0.24 0.628 0.329 0.87 0.126 1.000 0.000
+64->id852663 ML_PROB 0.111 0.444 0.643 0.317 0.748 0.233 0.628 0.329 0.874 0.122 1.000 0.000
+65->id162070 ML_PROB 0.111 0.444 0.655 0.309 0.746 0.236 0.618 0.336 0.872 0.124 1.000 0.000
+66->id272875 ML_PROB 0.109 0.442 0.644 0.317 0.754 0.229 0.627 0.33 0.873 0.123 1.000 0.000
+67->id163787 ML_PROB 0.109 0.443 0.653 0.31 0.742 0.239 0.627 0.33 0.874 0.122 1.000 0.000
+68->id422204 ML_PROB 0.11 0.443 0.652 0.311 0.752 0.23 0.621 0.334 0.871 0.125 1.000 0.000
+69->id120197 ML_PROB 0.109 0.442 0.656 0.308 0.749 0.233 0.63 0.328 0.874 0.122 1.000 0.000
+70->id33660 ML_PROB 0.108 0.442 0.656 0.308 0.754 0.228 0.617 0.337 0.873 0.123 1.000 0.000
+71->id803855 ML_PROB 0.112 0.445 0.653 0.31 0.75 0.232 0.629 0.328 0.869 0.127 1.000 0.000
+72->id255048 ML_PROB 0.114 0.447 0.653 0.31 0.745 0.236 0.626 0.33 0.87 0.126 1.000 0.000
+73->id690936 ML_PROB 0.108 0.441 0.631 0.326 0.755 0.228 0.632 0.326 0.874 0.122 1.000 0.000
+74->id126807 ML_PROB 0.111 0.445 0.649 0.314 0.749 0.233 0.631 0.327 0.868 0.128 1.000 0.000
+75->id99016 ML_PROB 0.111 0.445 0.65 0.312 0.751 0.232 0.632 0.326 0.869 0.126 1.000 0.000
+76->id883847 ML_PROB 0.111 0.444 0.649 0.313 0.753 0.23 0.63 0.327 0.873 0.123 1.000 0.000
+77->id354523 ML_PROB 0.112 0.445 0.656 0.308 0.752 0.23 0.627 0.33 0.872 0.124 1.000 0.000
+78->id737255 ML_PROB 0.111 0.444 0.658 0.307 0.751 0.231 0.616 0.337 0.871 0.125 1.000 0.000
+79->id990941 ML_PROB 0.114 0.447 0.656 0.308 0.752 0.23 0.628 0.329 0.873 0.123 1.000 0.000
+80->id25464 ML_PROB 0.113 0.447 0.656 0.308 0.755 0.227 0.623 0.333 0.873 0.122 1.000 0.000
+81->id918375 ML_PROB 0.113 0.446 0.657 0.307 0.754 0.229 0.624 0.332 0.873 0.123 1.000 0.000
+82->id537828 ML_PROB 0.111 0.444 0.651 0.311 0.747 0.235 0.628 0.329 0.873 0.123 1.000 0.000
+83->id682778 ML_PROB 0.108 0.442 0.657 0.307 0.754 0.229 0.619 0.335 0.873 0.123 1.000 0.000
+84->id587547 ML_PROB 0.112 0.445 0.656 0.308 0.755 0.228 0.628 0.329 0.873 0.122 1.000 0.000
+85->id670874 ML_PROB 0.111 0.444 0.654 0.31 0.752 0.23 0.624 0.332 0.871 0.125 1.000 0.000
+86->id444459 ML_PROB 0.109 0.442 0.654 0.309 0.752 0.23 0.622 0.333 0.874 0.122 1.000 0.000
+87->id777456 ML_PROB 0.11 0.443 0.652 0.311 0.75 0.232 0.625 0.331 0.87 0.125 1.000 0.000
+88->id452384 ML_PROB 0.111 0.444 0.66 0.305 0.755 0.228 0.63 0.328 0.873 0.123 1.000 0.000
+89->id826975 ML_PROB 0.112 0.445 0.655 0.309 0.749 0.233 0.626 0.33 0.87 0.125 1.000 0.000
+90->id519567 ML_PROB 0.109 0.442 0.657 0.307 0.75 0.232 0.629 0.328 0.873 0.123 1.000 0.000
+91->id84292 ML_PROB 0.11 0.443 0.654 0.31 0.754 0.229 0.626 0.33 0.872 0.124 1.000 0.000
+92->id124432 ML_PROB 0.117 0.45 0.657 0.307 0.753 0.23 0.633 0.325 0.871 0.125 1.000 0.000
+93->id800145 ML_PROB 0.116 0.449 0.657 0.307 0.754 0.229 0.63 0.327 0.873 0.123 1.000 0.000
+94->id153857 ML_PROB 0.109 0.443 0.654 0.309 0.756 0.227 0.628 0.329 0.874 0.122 1.000 0.000
+95->id587157 ML_PROB 0.11 0.443 0.655 0.309 0.753 0.23 0.627 0.33 0.871 0.124 1.000 0.000
+96->id506262 ML_PROB 0.11 0.444 0.651 0.311 0.739 0.241 0.633 0.326 0.86 0.135 1.000 0.000
+97->id634462 ML_PROB 0.113 0.447 0.658 0.307 0.754 0.229 0.628 0.329 0.873 0.123 1.000 0.000
+98->id687592 ML_PROB 0.11 0.444 0.652 0.311 0.745 0.236 0.627 0.33 0.873 0.123 1.000 0.000
+99->id955526 ML_PROB 0.11 0.443 0.657 0.307 0.754 0.229 0.613 0.34 0.873 0.123 1.000 0.000
+100->id181850 ML_PROB 0.109 0.442 0.642 0.319 0.754 0.228 0.629 0.328 0.873 0.123 1.000 0.000
+101->id159506 ML_PROB 0.111 0.445 0.657 0.307 0.753 0.229 0.628 0.329 0.872 0.124 1.000 0.000
+102->id609051 ML_PROB 0.114 0.447 0.655 0.308 0.748 0.234 0.632 0.326 0.865 0.13 1.000 0.000
+103->id963886 ML_PROB 0.11 0.443 0.65 0.312 0.756 0.227 0.625 0.331 0.874 0.122 1.000 0.000
+104->id405792 ML_PROB 0.116 0.45 0.657 0.307 0.754 0.229 0.631 0.327 0.873 0.123 1.000 0.000
+105->id494172 ML_PROB 0.109 0.442 0.646 0.315 0.754 0.228 0.624 0.332 0.873 0.122 1.000 0.000
+106->id964637 ML_PROB 0.11 0.443 0.653 0.31 0.748 0.234 0.632 0.326 0.866 0.129 1.000 0.000
+107->id799355 ML_PROB 0.112 0.445 0.656 0.308 0.753 0.229 0.628 0.329 0.873 0.122 1.000 0.000
+108->id157111 ML_PROB 0.108 0.442 0.641 0.319 0.749 0.233 0.63 0.328 0.874 0.122 1.000 0.000
+109->id114524 ML_PROB 0.111 0.444 0.643 0.317 0.748 0.233 0.628 0.329 0.874 0.122 1.000 0.000
+110->id954931 ML_PROB 0.114 0.448 0.656 0.308 0.751 0.231 0.628 0.329 0.872 0.124 1.000 0.000
+111->id827034 ML_PROB 0.11 0.444 0.65 0.313 0.754 0.229 0.623 0.333 0.873 0.123 1.000 0.000
+112->id689645 ML_PROB 0.108 0.441 0.649 0.313 0.754 0.228 0.632 0.326 0.873 0.122 1.000 0.000
+113->id281585 ML_PROB 0.113 0.447 0.657 0.307 0.754 0.228 0.627 0.33 0.873 0.123 1.000 0.000
+114->id885624 ML_PROB 0.113 0.446 0.655 0.309 0.752 0.23 0.628 0.329 0.873 0.123 1.000 0.000
+115->id577871 ML_PROB 0.112 0.446 0.653 0.31 0.749 0.233 0.628 0.329 0.868 0.128 1.000 0.000
+116->id238796 ML_PROB 0.111 0.445 0.656 0.308 0.752 0.23 0.628 0.329 0.871 0.125 1.000 0.000
+117->id481035 ML_PROB 0.11 0.444 0.656 0.308 0.754 0.229 0.63 0.328 0.872 0.123 1.000 0.000
+118->id972713 ML_PROB 0.111 0.444 0.649 0.313 0.748 0.234 0.631 0.327 0.873 0.123 1.000 0.000
+119->id905484 ML_PROB 0.109 0.442 0.656 0.308 0.747 0.234 0.618 0.336 0.873 0.123 1.000 0.000
+120->id713511 ML_PROB 0.11 0.444 0.644 0.317 0.751 0.231 0.628 0.329 0.87 0.126 1.000 0.000
+121->id512328 ML_PROB 0.112 0.446 0.653 0.31 0.754 0.229 0.627 0.33 0.873 0.123 1.000 0.000
+122->id703534 ML_PROB 0.112 0.446 0.652 0.311 0.749 0.233 0.632 0.326 0.867 0.128 1.000 0.000
+123->id409904 ML_PROB 0.115 0.448 0.658 0.306 0.752 0.23 0.628 0.329 0.872 0.124 1.000 0.000
+124->id577169 ML_PROB 0.112 0.445 0.653 0.31 0.752 0.23 0.626 0.33 0.871 0.125 1.000 0.000
+125->id813971 ML_PROB 0.108 0.441 0.645 0.316 0.74 0.24 0.633 0.325 0.856 0.138 1.000 0.000
+126->id558483 ML_PROB 0.112 0.445 0.656 0.308 0.754 0.229 0.632 0.326 0.873 0.122 1.000 0.000
+127->id892784 ML_PROB 0.112 0.445 0.657 0.307 0.751 0.231 0.629 0.328 0.871 0.124 1.000 0.000
+128->id611178 ML_PROB 0.111 0.444 0.649 0.313 0.752 0.231 0.626 0.33 0.871 0.124 1.000 0.000
+129->id192732 ML_PROB 0.111 0.444 0.654 0.31 0.753 0.229 0.632 0.326 0.873 0.122 1.000 0.000
+130->id917280 ML_PROB 0.109 0.442 0.642 0.318 0.753 0.23 0.614 0.339 0.873 0.123 1.000 0.000
+131->id435876 ML_PROB 0.115 0.448 0.655 0.309 0.756 0.227 0.629 0.328 0.874 0.122 1.000 0.000
+132->id980722 ML_PROB 0.11 0.443 0.656 0.308 0.753 0.229 0.618 0.336 0.873 0.123 1.000 0.000
+133->id308273 ML_PROB 0.109 0.443 0.654 0.309 0.754 0.229 0.626 0.33 0.873 0.122 1.000 0.000
+134->id476685 ML_PROB 0.114 0.447 0.655 0.308 0.751 0.231 0.627 0.33 0.871 0.125 1.000 0.000
+135->id315883 ML_PROB 0.112 0.445 0.65 0.312 0.754 0.228 0.619 0.335 0.873 0.123 1.000 0.000
+136->id935945 ML_PROB 0.11 0.443 0.651 0.312 0.751 0.231 0.624 0.332 0.87 0.125 1.000 0.000
+137->id991781 ML_PROB 0.11 0.444 0.651 0.312 0.749 0.233 0.629 0.328 0.869 0.126 1.000 0.000
+138->id65199 ML_PROB 0.109 0.443 0.655 0.309 0.749 0.233 0.62 0.335 0.873 0.123 1.000 0.000
+139->id226233 ML_PROB 0.109 0.443 0.654 0.31 0.743 0.238 0.632 0.326 0.86 0.134 1.000 0.000
+140->id860183 ML_PROB 0.109 0.442 0.647 0.315 0.752 0.23 0.622 0.333 0.871 0.124 1.000 0.000
+141->id295209 ML_PROB 0.112 0.445 0.651 0.312 0.752 0.231 0.628 0.329 0.872 0.123 1.000 0.000
+142->id544964 ML_PROB 0.112 0.445 0.655 0.309 0.75 0.232 0.626 0.33 0.872 0.124 1.000 0.000
+143->id648663 ML_PROB 0.111 0.444 0.654 0.309 0.752 0.23 0.628 0.329 0.872 0.124 1.000 0.000
+144->id710165 ML_PROB 0.111 0.444 0.652 0.311 0.747 0.234 0.628 0.329 0.873 0.123 1.000 0.000
+145->id392593 ML_PROB 0.111 0.444 0.657 0.307 0.755 0.228 0.616 0.337 0.873 0.122 1.000 0.000
+146->id129945 ML_PROB 0.109 0.442 0.656 0.308 0.751 0.231 0.629 0.329 0.873 0.123 1.000 0.000
+147->id382621 ML_PROB 0.117 0.45 0.657 0.307 0.753 0.23 0.633 0.325 0.871 0.125 1.000 0.000
+148->id901440 ML_PROB 0.109 0.443 0.652 0.311 0.738 0.242 0.632 0.326 0.858 0.136 1.000 0.000
+149->id39847 ML_PROB 0.112 0.445 0.655 0.309 0.747 0.235 0.624 0.332 0.868 0.127 1.000 0.000
+150->id526460 ML_PROB 0.11 0.444 0.651 0.312 0.749 0.233 0.629 0.328 0.868 0.127 1.000 0.000
+151->id477473 ML_PROB 0.113 0.446 0.655 0.309 0.748 0.234 0.631 0.327 0.867 0.128 1.000 0.000
+152->id448194 ML_PROB 0.112 0.445 0.651 0.312 0.754 0.229 0.629 0.328 0.873 0.122 1.000 0.000
+153->id904184 ML_PROB 0.112 0.446 0.655 0.308 0.748 0.234 0.622 0.333 0.872 0.124 1.000 0.000
+154->id747852 ML_PROB 0.11 0.444 0.652 0.311 0.748 0.234 0.623 0.332 0.873 0.123 1.000 0.000
+155->id711012 ML_PROB 0.113 0.446 0.644 0.317 0.754 0.228 0.62 0.335 0.873 0.122 1.000 0.000
+156->id683879 ML_PROB 0.113 0.446 0.655 0.309 0.752 0.23 0.63 0.328 0.872 0.123 1.000 0.000
+157->id789575 ML_PROB 0.108 0.442 0.655 0.308 0.751 0.231 0.633 0.325 0.868 0.127 1.000 0.000
+158->id650729 ML_PROB 0.114 0.448 0.652 0.311 0.751 0.231 0.631 0.327 0.872 0.123 1.000 0.000
+159->id934302 ML_PROB 0.109 0.442 0.656 0.308 0.751 0.231 0.625 0.331 0.87 0.126 1.000 0.000
+160->id555013 ML_PROB 0.111 0.445 0.658 0.306 0.749 0.233 0.619 0.336 0.87 0.125 1.000 0.000
+161->id82779 ML_PROB 0.114 0.447 0.654 0.31 0.748 0.234 0.628 0.329 0.871 0.125 1.000 0.000
+162->id771444 ML_PROB 0.112 0.445 0.653 0.31 0.738 0.242 0.633 0.326 0.861 0.134 1.000 0.000
+163->id821562 ML_PROB 0.114 0.447 0.66 0.305 0.756 0.227 0.624 0.332 0.874 0.122 1.000 0.000
+164->id292809 ML_PROB 0.109 0.442 0.651 0.312 0.749 0.233 0.624 0.332 0.873 0.123 1.000 0.000
+165->id645690 ML_PROB 0.117 0.45 0.659 0.306 0.751 0.231 0.629 0.328 0.871 0.125 1.000 0.000
+166->id223901 ML_PROB 0.111 0.444 0.652 0.311 0.751 0.231 0.621 0.334 0.872 0.124 1.000 0.000
+167->id41320 ML_PROB 0.109 0.443 0.654 0.309 0.75 0.232 0.621 0.334 0.873 0.123 1.000 0.000
+168->id96181 ML_PROB 0.117 0.45 0.657 0.307 0.736 0.244 0.634 0.325 0.871 0.125 1.000 0.000
+169->id147900 ML_PROB 0.108 0.442 0.642 0.319 0.755 0.228 0.622 0.333 0.873 0.122 1.000 0.000
+170->id702917 ML_PROB 0.112 0.445 0.651 0.312 0.749 0.233 0.632 0.326 0.869 0.126 1.000 0.000
+171->id150640 ML_PROB 0.112 0.445 0.657 0.307 0.752 0.23 0.627 0.329 0.872 0.124 1.000 0.000
+172->id518391 ML_PROB 0.109 0.442 0.656 0.308 0.753 0.23 0.631 0.327 0.873 0.123 1.000 0.000
+173->id879076 ML_PROB 0.109 0.443 0.65 0.313 0.755 0.228 0.619 0.335 0.873 0.122 1.000 0.000
+174->id952031 ML_PROB 0.109 0.442 0.657 0.307 0.752 0.23 0.624 0.332 0.871 0.124 1.000 0.000
+175->id10055 ML_PROB 0.112 0.446 0.649 0.313 0.75 0.232 0.631 0.327 0.87 0.126 1.000 0.000
+176->id727213 ML_PROB 0.11 0.444 0.658 0.306 0.751 0.231 0.626 0.331 0.873 0.123 1.000 0.000
+177->id41961 ML_PROB 0.109 0.442 0.656 0.308 0.754 0.229 0.618 0.336 0.872 0.123 1.000 0.000
+178->id257209 ML_PROB 0.113 0.447 0.653 0.31 0.753 0.23 0.631 0.326 0.873 0.123 1.000 0.000
+179->id995361 ML_PROB 0.109 0.443 0.656 0.308 0.742 0.239 0.617 0.337 0.873 0.122 1.000 0.000
+180->id957918 ML_PROB 0.11 0.443 0.655 0.308 0.745 0.236 0.625 0.331 0.873 0.123 1.000 0.000
+181->id975370 ML_PROB 0.112 0.446 0.651 0.312 0.755 0.228 0.627 0.329 0.874 0.122 1.000 0.000
+182->id889896 ML_PROB 0.115 0.449 0.654 0.31 0.751 0.231 0.631 0.327 0.873 0.123 1.000 0.000
+183->id978164 ML_PROB 0.112 0.445 0.656 0.308 0.752 0.231 0.629 0.328 0.872 0.124 1.000 0.000
+184->id90359 ML_PROB 0.114 0.447 0.657 0.307 0.754 0.229 0.624 0.332 0.873 0.123 1.000 0.000
+185->id307158 ML_PROB 0.114 0.447 0.652 0.311 0.731 0.248 0.633 0.325 0.865 0.13 1.000 0.000
+186->id755940 ML_PROB 0.112 0.445 0.655 0.308 0.751 0.232 0.622 0.333 0.873 0.123 1.000 0.000
+187->id995582 ML_PROB 0.111 0.444 0.652 0.311 0.743 0.238 0.633 0.325 0.859 0.135 1.000 0.000
+188->id363965 ML_PROB 0.11 0.443 0.655 0.309 0.754 0.228 0.619 0.336 0.873 0.122 1.000 0.000
+189->id729124 ML_PROB 0.111 0.444 0.649 0.313 0.748 0.234 0.63 0.327 0.865 0.13 1.000 0.000
+190->id871963 ML_PROB 0.112 0.446 0.656 0.308 0.754 0.229 0.628 0.329 0.873 0.122 1.000 0.000
+191->id475172 ML_PROB 0.11 0.443 0.657 0.307 0.754 0.229 0.623 0.333 0.873 0.123 1.000 0.000
+192->id804699 ML_PROB 0.11 0.443 0.655 0.309 0.749 0.233 0.625 0.331 0.873 0.122 1.000 0.000
+193->id625843 ML_PROB 0.111 0.445 0.658 0.306 0.755 0.228 0.626 0.331 0.874 0.122 1.000 0.000
+194->id595713 ML_PROB 0.108 0.441 0.639 0.321 0.753 0.23 0.63 0.328 0.873 0.123 1.000 0.000
+195->id462604 ML_PROB 0.11 0.443 0.653 0.31 0.749 0.233 0.627 0.33 0.871 0.125 1.000 0.000
+196->id106141 ML_PROB 0.113 0.446 0.65 0.312 0.75 0.232 0.631 0.327 0.869 0.126 1.000 0.000
+197->id689349 ML_PROB 0.111 0.444 0.647 0.315 0.755 0.228 0.626 0.331 0.873 0.123 1.000 0.000
+198->id639003 ML_PROB 0.113 0.446 0.654 0.31 0.746 0.236 0.624 0.332 0.868 0.127 1.000 0.000
+199->id393896 ML_PROB 0.11 0.443 0.654 0.309 0.748 0.234 0.623 0.333 0.873 0.122 1.000 0.000
+200->id450307 ML_PROB 0.11 0.443 0.658 0.306 0.756 0.227 0.63 0.328 0.874 0.122 1.000 0.000
diff --git a/checks/inputfiles/test.prob.fvd b/checks/inputfiles/test.prob.fvd
index 5bca9f3..9c08678 100644
Binary files a/checks/inputfiles/test.prob.fvd and b/checks/inputfiles/test.prob.fvd differ
diff --git a/checks/inputfiles/test.prob.fvi b/checks/inputfiles/test.prob.fvi
index 91a91d8..bdcffca 100644
Binary files a/checks/inputfiles/test.prob.fvi and b/checks/inputfiles/test.prob.fvi differ
diff --git a/checks/test_bt.sh b/checks/test_bt.sh
index e3aeb48..d79ed27 100755
--- a/checks/test_bt.sh
+++ b/checks/test_bt.sh
@@ -2,23 +2,32 @@
 # This script runs checks on ProbABEL's palogist module for
 # binary traits.
 
-echo "analysing BT"
+echo "Analysing BT..."
+
+scriptdir=$(dirname $0)
+
+if [ -z ${PA_BINDIR} ]; then
+    PA_BINDIR="${scriptdir}/../src/"
+fi
 if [ -z ${srcdir} ]; then
     srcdir="."
+    PA_BINDIR=${scriptdir}/../src/
 fi
 
-. ${srcdir}/run_diff.sh
+. ${scriptdir}/run_diff.sh
 
-inputdir=${srcdir}/inputfiles
+inputdir=${scriptdir}/inputfiles
+palogist=${PA_BINDIR}/palogist
 
 # Redirect all output to file descriptor 3 to /dev/null except if
 # the first argument is "verbose" then redirect handle 3 to stdout
 exec 3>/dev/null
 if [ "$1" = "verbose" ]; then
+    echo "Verbose mode ON"
     exec 3>&1
 fi
 
-../src/palogist \
+$palogist \
     -p ${inputdir}/logist_data.txt \
     -d ${inputdir}/test.mldose \
     -i ${inputdir}/test.mlinfo \
@@ -27,7 +36,7 @@ fi
     -o logist \
     >& 3
 
-../src/palogist \
+$palogist \
     -p ${inputdir}/logist_data.txt \
     -d ${inputdir}/test.dose.fvi \
     -i ${inputdir}/test.mlinfo \
@@ -41,7 +50,7 @@ run_diff logist_add.out.txt \
     logist_fv_add.out.txt \
     "BT check: dose vs. dose_fv"
 
-../src/palogist \
+$palogist \
     -p ${inputdir}/logist_data.txt \
     -d ${inputdir}/test.mlprob \
     -i ${inputdir}/test.mlinfo \
@@ -51,7 +60,7 @@ run_diff logist_add.out.txt \
     -o logist_prob \
     >& 3
 
-../src/palogist \
+$palogist \
     -p ${inputdir}/logist_data.txt \
     -d ${inputdir}/test.prob.fvi \
     -i ${inputdir}/test.mlinfo \
diff --git a/checks/test_cox.sh b/checks/test_cox.sh
index e441602..7a14254 100755
--- a/checks/test_cox.sh
+++ b/checks/test_cox.sh
@@ -2,13 +2,21 @@
 # This script runs checks on ProbABEL's pacoxph module
 
 echo "Analysing Cox model..."
+
+scriptdir=$(dirname $0)
+
+if [ -z ${PA_BINDIR} ]; then
+    PA_BINDIR="${scriptdir}/../src/"
+fi
 if [ -z ${srcdir} ]; then
     srcdir="."
+    PA_BINDIR=${scriptdir}/../src/
 fi
 
-. ${srcdir}/run_diff.sh
+. ${scriptdir}/run_diff.sh
 
-inputdir=${srcdir}/inputfiles
+inputdir=${scriptdir}/inputfiles
+pacoxph=${PA_BINDIR}/pacoxph
 
 # Redirect all output to file descriptor 3 to /dev/null except if
 # the first argument is "verbose" then redirect handle 3 to stdout
@@ -18,7 +26,7 @@ if [ "$1" = "verbose" ]; then
     exec 3>&1
 fi
 
-../src/pacoxph \
+$pacoxph \
     -p ${inputdir}/coxph_data.txt \
     -d ${inputdir}/test.mldose \
     -i ${inputdir}/test.mlinfo \
@@ -27,7 +35,7 @@ fi
     -o coxph_dose \
     >& 3
 
-../src/pacoxph \
+$pacoxph \
     -p ${inputdir}/coxph_data.txt \
     -d ${inputdir}/test.dose.fvi \
     -i ${inputdir}/test.mlinfo \
@@ -40,7 +48,7 @@ run_diff coxph_dose_add.out.txt coxph_dose_fv_add.out.txt \
     "pacoxph check: dose vs. dose_fv"
 
 
-../src/pacoxph \
+$pacoxph \
     -p ${inputdir}/coxph_data.txt \
     -d ${inputdir}/test.mlprob \
     -i ${inputdir}/test.mlinfo \
@@ -54,7 +62,7 @@ run_diff coxph_dose_add.out.txt coxph_prob_add.out.txt \
     "pacoxph check: dose vs. prob" -I SNP
 
 
-../src/pacoxph \
+$pacoxph \
     -p ${inputdir}/coxph_data.txt \
     -d ${inputdir}/test.prob.fvi \
     -i ${inputdir}/test.mlinfo \
diff --git a/checks/test_mms.sh b/checks/test_mms.sh
index 6543e20..0644e85 100755
--- a/checks/test_mms.sh
+++ b/checks/test_mms.sh
@@ -2,23 +2,32 @@
 # This script runs checks on ProbABEL's palinear module for
 # quantitative traits combined with the mmscore option.
 
-echo "analysis using MMScore"
+echo "Analysis using MMScore..."
+
+scriptdir=$(dirname $0)
+
+if [ -z ${PA_BINDIR} ]; then
+    PA_BINDIR="${scriptdir}/../src/"
+fi
 if [ -z ${srcdir} ]; then
     srcdir="."
+    PA_BINDIR=${scriptdir}/../src/
 fi
 
-. ${srcdir}/run_diff.sh
+. ${scriptdir}/run_diff.sh
 
-inputdir=${srcdir}/inputfiles
+inputdir=${scriptdir}/inputfiles
+palinear=${PA_BINDIR}/palinear
 
 # Redirect all output to file descriptor 3 to /dev/null except if
 # the first argument is "verbose" then redirect handle 3 to stdout
 exec 3>/dev/null
 if [ "$1" = "verbose" ]; then
+    echo "Verbose mode ON"
     exec 3>&1
 fi
 
-../src/palinear \
+$palinear \
     -p ${inputdir}/mmscore_pheno.PHE \
     -i ${inputdir}/mmscore_gen.mlinfo \
     -d ${inputdir}/mmscore_gen.mldose \
@@ -27,7 +36,7 @@ fi
     --mmscore ${inputdir}/mmscore_InvSigma_aj.sex.age.dat \
     >& 3
 
-../src/palinear \
+$palinear \
     -p ${inputdir}/mmscore_pheno.PHE \
     -i ${inputdir}/mmscore_gen.mlinfo \
     -d ${inputdir}/mmscore_gen.dose.fvi \
@@ -42,7 +51,7 @@ run_diff mmscore_dose_add.out.txt \
     "mmscore check: dose vs. dose_fv"
 
 
-../src/palinear \
+$palinear \
     -p ${inputdir}/mmscore_pheno.PHE \
     -i ${inputdir}/mmscore_gen.mlinfo \
     -d ${inputdir}/mmscore_gen.mlprob \
@@ -51,7 +60,7 @@ run_diff mmscore_dose_add.out.txt \
     --mmscore ${inputdir}/mmscore_InvSigma_aj.sex.age.dat \
     >& 3
 
-../src/palinear \
+$palinear \
     -p ${inputdir}/mmscore_pheno.PHE \
     -i ${inputdir}/mmscore_gen.mlinfo \
     -d ${inputdir}/mmscore_gen.prob.fvi \
diff --git a/checks/test_qt.sh b/checks/test_qt.sh
index f271f10..e1976ef 100755
--- a/checks/test_qt.sh
+++ b/checks/test_qt.sh
@@ -2,263 +2,272 @@
 # This script runs checks on ProbABEL's palinear module for
 # quantitative traits.
 
-echo "analysing QT"
+echo "Analysing QT..."
+
+scriptdir=$(dirname $0)
+
+if [ -z ${PA_BINDIR} ]; then
+    PA_BINDIR="${scriptdir}/../src/"
+fi
 if [ -z ${srcdir} ]; then
     srcdir="."
+    PA_BINDIR=${scriptdir}/../src/
 fi
 
-. ${srcdir}/run_diff.sh
+. ${scriptdir}/run_diff.sh
 
-inputdir=${srcdir}/inputfiles
+inputdir=${scriptdir}/inputfiles
+palinear=${PA_BINDIR}/palinear
 
 # Redirect all output to file descriptor 3 to /dev/null except if
 # the first argument is "verbose" then redirect handle 3 to stdout
 exec 3>/dev/null
 if [ "$1" = "verbose" ]; then
+    echo "Verbose mode ON"
     exec 3>&1
 fi
 
 echo "base analysis"
-../src/palinear \
+$palinear \
     -p ${inputdir}/height.txt \
     -d ${inputdir}/test.mldose \
     -i ${inputdir}/test.mlinfo \
     -m ${inputdir}/test.map \
     -c 19 \
-    -o height_base \
+    -o linear_base \
     >& 3
-../src/palinear \
+$palinear \
     -p ${inputdir}/height.txt \
     -d ${inputdir}/test.dose.fvi \
     -i ${inputdir}/test.mlinfo \
     -m ${inputdir}/test.map \
     -c 19 \
-    -o height_base_fv \
+    -o linear_base_fv \
     >& 3
 
 #echo -n "QT check: dose vs. dose_fv"
-run_diff height_base_add.out.txt \
-    height_base_fv_add.out.txt \
+run_diff linear_base_add.out.txt \
+    linear_base_fv_add.out.txt \
     "QT check: dose vs. dose_fv"
 
 
 echo "Option --allcov"
-../src/palinear -p ${inputdir}/height.txt \
+$palinear -p ${inputdir}/height.txt \
     -d ${inputdir}/test.mldose \
     -i ${inputdir}/test.mlinfo \
     -m ${inputdir}/test.map \
     -c 19 --allcov \
-    -o height_allcov \
+    -o linear_allcov \
     >& 3
-../src/palinear \
+$palinear \
     -p ${inputdir}/height.txt \
     -d ${inputdir}/test.dose.fvi \
     -i ${inputdir}/test.mlinfo \
     -m ${inputdir}/test.map \
     -c 19 --allcov \
-    -o height_allcov_fv \
+    -o linear_allcov_fv \
     >& 3
 
-run_diff height_allcov_add.out.txt \
-    height_allcov_fv_add.out.txt \
+run_diff linear_allcov_add.out.txt \
+    linear_allcov_fv_add.out.txt \
     "QT check: allcov: dose vs. dose_fv"
 
 
 echo "Option --interaction=1"
-../src/palinear \
+$palinear \
     -p ${inputdir}/height.txt \
     -d ${inputdir}/test.mldose \
     -i ${inputdir}/test.mlinfo \
     -m ${inputdir}/test.map \
     -c 19 --interaction=1 \
-    -o height_int1 \
+    -o linear_int1 \
     >& 3
-../src/palinear \
+$palinear \
     -p ${inputdir}/height.txt \
     -d ${inputdir}/test.dose.fvi \
     -i ${inputdir}/test.mlinfo \
     -m ${inputdir}/test.map \
     -c 19 --interaction=1 \
-    -o height_int1_fv \
+    -o linear_int1_fv \
     >& 3
 
-run_diff height_int1_add.out.txt \
-    height_int1_fv_add.out.txt \
+run_diff linear_int1_add.out.txt \
+    linear_int1_fv_add.out.txt \
     "QT check: interactions: dose vs. dose_fv"
 
 
 echo "Option --robust"
-../src/palinear \
+$palinear \
     -p ${inputdir}/height.txt \
     -d ${inputdir}/test.mldose \
     -i ${inputdir}/test.mlinfo \
     -m ${inputdir}/test.map \
     -c 19 --robust \
-    -o height_robust \
+    -o linear_robust \
     >& 3
-../src/palinear \
+$palinear \
     -p ${inputdir}/height.txt \
     -d ${inputdir}/test.dose.fvi \
     -i ${inputdir}/test.mlinfo \
     -m ${inputdir}/test.map \
     -c 19 --robust \
-    -o height_robust_fv \
+    -o linear_robust_fv \
     >& 3
 
-run_diff height_robust_add.out.txt \
-    height_robust_fv_add.out.txt \
+run_diff linear_robust_add.out.txt \
+    linear_robust_fv_add.out.txt \
     "QT check: robust: dose vs. dose_fv"
 
 
 echo "Option --robust --interaction=1"
-../src/palinear \
+$palinear \
     -p ${inputdir}/height.txt \
     -d ${inputdir}/test.mldose \
     -i ${inputdir}/test.mlinfo \
     -m ${inputdir}/test.map \
     -c 19 --robust --interaction=1 \
-    -o height_robust_int1 \
+    -o linear_robust_int1 \
     >& 3
-../src/palinear \
+$palinear \
     -p ${inputdir}/height.txt \
     -d ${inputdir}/test.dose.fvi \
     -i ${inputdir}/test.mlinfo \
     -m ${inputdir}/test.map \
     -c 19 --robust --interaction=1 \
-    -o height_robust_int1_fv \
+    -o linear_robust_int1_fv \
     >& 3
 
-run_diff height_robust_int1_add.out.txt \
-    height_robust_int1_fv_add.out.txt \
+run_diff linear_robust_int1_add.out.txt \
+    linear_robust_int1_fv_add.out.txt \
     "QT check: robust & interaction: dose vs. dose_fv"
 
 
 echo "Option --ngp=2, mlprob file"
-../src/palinear \
+$palinear \
     -p ${inputdir}/height.txt \
     -d ${inputdir}/test.mlprob \
     -i ${inputdir}/test.mlinfo \
     -m ${inputdir}/test.map \
     -c 19 --ngp=2 \
-    -o height_ngp2 \
+    -o linear_ngp2 \
     >& 3
-../src/palinear \
+$palinear \
     -p ${inputdir}/height.txt \
     -d ${inputdir}/test.prob.fvi \
     -i ${inputdir}/test.mlinfo \
     -m ${inputdir}/test.map \
     -c 19 --ngp=2 \
-    -o height_ngp2_fv \
+    -o linear_ngp2_fv \
     >& 3
 
 
 # Remove header from the outputs, because they differ
-run_diff height_base_add.out.txt \
-    height_ngp2_add.out.txt \
+run_diff linear_base_add.out.txt \
+    linear_ngp2_add.out.txt \
     "QT check: dose vs. prob (additive model)" -I SNP
 
 for model in add domin over_domin recess 2df; do
-    run_diff height_ngp2_${model}.out.txt \
-        height_ngp2_fv_${model}.out.txt \
+    run_diff linear_ngp2_${model}.out.txt \
+        linear_ngp2_fv_${model}.out.txt \
         "QT check ($model model): prob vs. prob_fv"
 done
 
 
 echo "Option --ngp=2 --allcov"
-../src/palinear \
+$palinear \
     -p ${inputdir}/height.txt \
     -d ${inputdir}/test.mlprob \
     -i ${inputdir}/test.mlinfo \
     -m ${inputdir}/test.map \
     -c 19 --ngp=2 --allcov \
-    -o height_ngp2_allcov \
+    -o linear_ngp2_allcov \
     >& 3
-../src/palinear \
+$palinear \
     -p ${inputdir}/height.txt \
     -d ${inputdir}/test.prob.fvi \
     -i ${inputdir}/test.mlinfo \
     -m ${inputdir}/test.map \
     -c 19 --ngp=2 --allcov \
-    -o height_ngp2_allcov_fv \
+    -o linear_ngp2_allcov_fv \
     >& 3
 
 for model in add domin over_domin recess 2df; do
-    run_diff height_ngp2_allcov_${model}.out.txt \
-        height_ngp2_allcov_fv_${model}.out.txt \
+    run_diff linear_ngp2_allcov_${model}.out.txt \
+        linear_ngp2_allcov_fv_${model}.out.txt \
         "QT check --allcov ($model model): prob vs. prob_fv"
 done
 
 
 echo "Option --ngp=2 --interaction=1"
-../src/palinear \
+$palinear \
     -p ${inputdir}/height.txt \
     -d ${inputdir}/test.mlprob \
     -i ${inputdir}/test.mlinfo \
     -m ${inputdir}/test.map \
     -c 19 --ngp=2 --interaction=1 \
-    -o height_ngp2_int1 \
+    -o linear_ngp2_int1 \
     >& 3
-../src/palinear \
+$palinear \
     -p ${inputdir}/height.txt \
     -d ${inputdir}/test.prob.fvi \
     -i ${inputdir}/test.mlinfo \
     -m ${inputdir}/test.map \
     -c 19 --ngp=2 --interaction=1 \
-    -o height_ngp2_int1_fv \
+    -o linear_ngp2_int1_fv \
     >& 3
 
 for model in add domin over_domin recess 2df; do
-    run_diff height_ngp2_int1_${model}.out.txt \
-        height_ngp2_int1_fv_${model}.out.txt \
+    run_diff linear_ngp2_int1_${model}.out.txt \
+        linear_ngp2_int1_fv_${model}.out.txt \
         "QT check --interactions ($model model): prob vs. prob_fv"
 done
 
 
 echo "Option --ngp=2 --robust"
-../src/palinear \
+$palinear \
     -p ${inputdir}/height.txt \
     -d ${inputdir}/test.mlprob \
     -i ${inputdir}/test.mlinfo \
     -m ${inputdir}/test.map \
     -c 19 --ngp=2 --robust \
-    -o height_ngp2_robust \
+    -o linear_ngp2_robust \
     >& 3
-../src/palinear \
+$palinear \
     -p ${inputdir}/height.txt \
     -d ${inputdir}/test.prob.fvi \
     -i ${inputdir}/test.mlinfo \
     -m ${inputdir}/test.map \
     -c 19 --ngp=2 --robust \
-    -o height_ngp2_robust_fv \
+    -o linear_ngp2_robust_fv \
     >& 3
 
 for model in add domin over_domin recess 2df; do
-    run_diff height_ngp2_robust_${model}.out.txt \
-        height_ngp2_robust_fv_${model}.out.txt \
+    run_diff linear_ngp2_robust_${model}.out.txt \
+        linear_ngp2_robust_fv_${model}.out.txt \
         "QT check --robust ($model model): prob vs. prob_fv"
 done
 
 
 echo "Option --ngp=2 --robust --interaction=1"
-../src/palinear \
+$palinear \
     -p ${inputdir}/height.txt \
     -d ${inputdir}/test.mlprob \
     -i ${inputdir}/test.mlinfo \
     -m ${inputdir}/test.map \
     -c 19 --ngp=2 --robust --interaction=1 \
-    -o height_ngp2_robust_int1 \
+    -o linear_ngp2_robust_int1 \
     >& 3
-../src/palinear \
+$palinear \
     -p ${inputdir}/height.txt \
     -d ${inputdir}/test.prob.fvi \
     -i ${inputdir}/test.mlinfo \
     -m ${inputdir}/test.map \
     -c 19 --ngp=2 --robust --interaction=1 \
-    -o height_ngp2_robust_int1_fv \
+    -o linear_ngp2_robust_int1_fv \
     >& 3
 
 for model in add domin over_domin recess 2df; do
-    run_diff height_ngp2_robust_int1_${model}.out.txt \
-        height_ngp2_robust_int1_fv_${model}.out.txt \
+    run_diff linear_ngp2_robust_int1_${model}.out.txt \
+        linear_ngp2_robust_int1_fv_${model}.out.txt \
         "QT check --robust --interactions ($model model): prob vs. prob_fv"
 done
diff --git a/checks/verified_results/height_base_add.out.txt b/checks/verified_results/height_base_add.out.txt
index f70ebfb..416b271 100644
--- a/checks/verified_results/height_base_add.out.txt
+++ b/checks/verified_results/height_base_add.out.txt
@@ -4,3 +4,4 @@ rs8102643 C TGGT 0.5847 0.415 0.9308 0.8685 181 0.808177 19 207859 -25.7632 86.4
 rs8102615 T A 0.5006 0.4702 0.9375 0.8932 182 0.8665 19 211970 -40.7722 102.559 0.161525
 rs8105536 G A 0.5783 0.4213 0.9353 0.8832 182 0.791701 19 212033 35.3602 81.7869 0.191023
 rs2312724 T C 0.9122 0.0877 0.9841 1.3e-17 182 0.933464 19 217034 nan nan nan
+rs3174230 G C 0.8123 1.2e-05 0.9991 0.0185 182 0.997253 19 7845238 -6.73472 6.49041 1.09758
diff --git a/configure b/configure
index fd8aa18..22b3659 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for ProbABEL 0.4.1.
+# Generated by GNU Autoconf 2.69 for ProbABEL 0.4.2.
 #
 # Report bugs to <genabel-devel at r-forge.wu-wien.ac.at>.
 #
@@ -580,8 +580,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='ProbABEL'
 PACKAGE_TARNAME='probabel'
-PACKAGE_VERSION='0.4.1'
-PACKAGE_STRING='ProbABEL 0.4.1'
+PACKAGE_VERSION='0.4.2'
+PACKAGE_STRING='ProbABEL 0.4.2'
 PACKAGE_BUGREPORT='genabel-devel at r-forge.wu-wien.ac.at'
 PACKAGE_URL=''
 
@@ -625,6 +625,8 @@ ac_includes_default="\
 ac_subst_vars='am__EXEEXT_FALSE
 am__EXEEXT_TRUE
 LTLIBOBJS
+BUILD_extractsnp_FALSE
+BUILD_extractsnp_TRUE
 BUILD_pacoxph_FALSE
 BUILD_pacoxph_TRUE
 BUILD_palogist_FALSE
@@ -749,6 +751,7 @@ enable_largefile
 enable_palinear
 enable_palogist
 enable_pacoxph
+enable_extract_snp
 '
       ac_precious_vars='build_alias
 host_alias
@@ -1302,7 +1305,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures ProbABEL 0.4.1 to adapt to many kinds of systems.
+\`configure' configures ProbABEL 0.4.2 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1368,7 +1371,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of ProbABEL 0.4.1:";;
+     short | recursive ) echo "Configuration of ProbABEL 0.4.2:";;
    esac
   cat <<\_ACEOF
 
@@ -1376,16 +1379,21 @@ Optional Features:
   --disable-option-checking  ignore unrecognized --enable/--with options
   --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
   --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
-  --enable-silent-rules          less verbose build output (undo: `make V=1')
-  --disable-silent-rules         verbose build output (undo: `make V=0')
-  --disable-maintainer-mode  disable make rules and dependencies not useful
-			  (and sometimes confusing) to the casual installer
-  --disable-dependency-tracking  speeds up one-time build
-  --enable-dependency-tracking   do not reject slow dependency extractors
+  --enable-silent-rules   less verbose build output (undo: "make V=1")
+  --disable-silent-rules  verbose build output (undo: "make V=0")
+  --disable-maintainer-mode
+                          disable make rules and dependencies not useful (and
+                          sometimes confusing) to the casual installer
+  --enable-dependency-tracking
+                          do not reject slow dependency extractors
+  --disable-dependency-tracking
+                          speeds up one-time build
   --disable-largefile     omit support for large files
   --disable-palinear      disable building the palinear program
   --disable-palogist      disable building the palogist program
   --disable-pacoxph       disable building the pacoxph program
+  --enable-extract-snp    enable building the extract-snp program. NOTE: this
+                          program is not finished yet!
 
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
@@ -1476,7 +1484,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-ProbABEL configure 0.4.1
+ProbABEL configure 0.4.2
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1937,7 +1945,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by ProbABEL $as_me 0.4.1, which was
+It was created by ProbABEL $as_me 0.4.2, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -2285,7 +2293,7 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
-am__api_version='1.11'
+am__api_version='1.13'
 
 ac_aux_dir=
 for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
@@ -2411,9 +2419,6 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5
 $as_echo_n "checking whether build environment is sane... " >&6; }
-# Just in case
-sleep 1
-echo timestamp > conftest.file
 # Reject unsafe characters in $srcdir or the absolute working directory
 # name.  Accept space and tab only in the latter.
 am_lf='
@@ -2424,32 +2429,40 @@ case `pwd` in
 esac
 case $srcdir in
   *[\\\"\#\$\&\'\`$am_lf\ \	]*)
-    as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;;
+    as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;;
 esac
 
-# Do `set' in a subshell so we don't clobber the current shell's
+# Do 'set' in a subshell so we don't clobber the current shell's
 # arguments.  Must try -L first in case configure is actually a
 # symlink; some systems play weird games with the mod time of symlinks
 # (eg FreeBSD returns the mod time of the symlink's containing
 # directory).
 if (
-   set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
-   if test "$*" = "X"; then
-      # -L didn't work.
-      set X `ls -t "$srcdir/configure" conftest.file`
-   fi
-   rm -f conftest.file
-   if test "$*" != "X $srcdir/configure conftest.file" \
-      && test "$*" != "X conftest.file $srcdir/configure"; then
-
-      # If neither matched, then we have a broken ls.  This can happen
-      # if, for instance, CONFIG_SHELL is bash and it inherits a
-      # broken ls alias from the environment.  This has actually
-      # happened.  Such a system could not be considered "sane".
-      as_fn_error $? "ls -t appears to fail.  Make sure there is not a broken
-alias in your environment" "$LINENO" 5
-   fi
-
+   am_has_slept=no
+   for am_try in 1 2; do
+     echo "timestamp, slept: $am_has_slept" > conftest.file
+     set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
+     if test "$*" = "X"; then
+	# -L didn't work.
+	set X `ls -t "$srcdir/configure" conftest.file`
+     fi
+     if test "$*" != "X $srcdir/configure conftest.file" \
+	&& test "$*" != "X conftest.file $srcdir/configure"; then
+
+	# If neither matched, then we have a broken ls.  This can happen
+	# if, for instance, CONFIG_SHELL is bash and it inherits a
+	# broken ls alias from the environment.  This has actually
+	# happened.  Such a system could not be considered "sane".
+	as_fn_error $? "ls -t appears to fail.  Make sure there is not a broken
+  alias in your environment" "$LINENO" 5
+     fi
+     if test "$2" = conftest.file || test $am_try -eq 2; then
+       break
+     fi
+     # Just in case.
+     sleep 1
+     am_has_slept=yes
+   done
    test "$2" = conftest.file
    )
 then
@@ -2461,6 +2474,16 @@ Check your system clock" "$LINENO" 5
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
+# If we didn't sleep, we still need to ensure time stamps of config.status and
+# generated files are strictly newer.
+am_sleep_pid=
+if grep 'slept: no' conftest.file >/dev/null 2>&1; then
+  ( sleep 1 ) &
+  am_sleep_pid=$!
+fi
+
+rm -f conftest.file
+
 test "$program_prefix" != NONE &&
   program_transform_name="s&^&$program_prefix&;$program_transform_name"
 # Use a double $ so make ignores it.
@@ -2483,12 +2506,12 @@ if test x"${MISSING+set}" != xset; then
   esac
 fi
 # Use eval to expand $SHELL
-if eval "$MISSING --run true"; then
-  am_missing_run="$MISSING --run "
+if eval "$MISSING --is-lightweight"; then
+  am_missing_run="$MISSING "
 else
   am_missing_run=
-  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5
-$as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;}
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5
+$as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;}
 fi
 
 if test x"${install_sh}" != xset; then
@@ -2500,10 +2523,10 @@ if test x"${install_sh}" != xset; then
   esac
 fi
 
-# Installed binaries are usually stripped using `strip' when the user
-# run `make install-strip'.  However `strip' might not be the right
+# Installed binaries are usually stripped using 'strip' when the user
+# run "make install-strip".  However 'strip' might not be the right
 # tool to use in cross-compilation environments, therefore Automake
-# will honor the `STRIP' environment variable to overrule this program.
+# will honor the 'STRIP' environment variable to overrule this program.
 if test "$cross_compiling" != no; then
   if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
@@ -2642,12 +2665,6 @@ fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5
 $as_echo "$MKDIR_P" >&6; }
 
-mkdir_p="$MKDIR_P"
-case $mkdir_p in
-  [\\/$]* | ?:[\\/]*) ;;
-  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
-esac
-
 for ac_prog in gawk mawk nawk awk
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
@@ -2735,10 +2752,10 @@ if test "${enable_silent_rules+set}" = set; then :
   enableval=$enable_silent_rules;
 fi
 
-case $enable_silent_rules in
-yes) AM_DEFAULT_VERBOSITY=0;;
-no)  AM_DEFAULT_VERBOSITY=1;;
-*)   AM_DEFAULT_VERBOSITY=1;;
+case $enable_silent_rules in # (((
+  yes) AM_DEFAULT_VERBOSITY=0;;
+   no) AM_DEFAULT_VERBOSITY=1;;
+    *) AM_DEFAULT_VERBOSITY=1;;
 esac
 am_make=${MAKE-make}
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5
@@ -2791,7 +2808,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='probabel'
- VERSION='0.4.1'
+ VERSION='0.4.2'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -2819,27 +2836,38 @@ AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"}
 
 MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
 
+# For better backward compatibility.  To be removed once Automake 1.9.x
+# dies out for good.  For more background, see:
+# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
+# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
+mkdir_p='$(MKDIR_P)'
+
 # We need awk for the "check" target.  The system "awk" is bad on
 # some platforms.
 # Always define AMTAR for backward compatibility.  Yes, it's still used
 # in the wild :-(  We should find a proper way to deprecate it ...
 AMTAR='$${TAR-tar}'
 
+
+# We'll loop over all known methods to create a tar archive until one works.
+_am_tools='gnutar  pax cpio none'
+
 am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'
 
 
 
 
 
+
 # Check whether --enable-silent-rules was given.
 if test "${enable_silent_rules+set}" = set; then :
   enableval=$enable_silent_rules;
 fi
 
-case $enable_silent_rules in
-yes) AM_DEFAULT_VERBOSITY=0;;
-no)  AM_DEFAULT_VERBOSITY=1;;
-*)   AM_DEFAULT_VERBOSITY=1;;
+case $enable_silent_rules in # (((
+  yes) AM_DEFAULT_VERBOSITY=0;;
+   no) AM_DEFAULT_VERBOSITY=1;;
+    *) AM_DEFAULT_VERBOSITY=0;;
 esac
 am_make=${MAKE-make}
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5
@@ -3710,7 +3738,7 @@ am__quote=
 _am_result=none
 # First try GNU make style include.
 echo "include confinc" > confmf
-# Ignore all kinds of additional output from `make'.
+# Ignore all kinds of additional output from 'make'.
 case `$am_make -s -f confmf 2> /dev/null` in #(
 *the\ am__doit\ target*)
   am__include=include
@@ -3766,8 +3794,8 @@ else
   # We make a subdir and do the tests there.  Otherwise we can end up
   # making bogus files that we don't know about and never remove.  For
   # instance it was reported that on HP-UX the gcc test will end up
-  # making a dummy file named `D' -- because `-MD' means `put the output
-  # in D'.
+  # making a dummy file named 'D' -- because '-MD' means "put the output
+  # in D".
   rm -rf conftest.dir
   mkdir conftest.dir
   # Copy depcomp to subdir because otherwise we won't find it if we're
@@ -3802,16 +3830,16 @@ else
     : > sub/conftest.c
     for i in 1 2 3 4 5 6; do
       echo '#include "conftst'$i'.h"' >> sub/conftest.c
-      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
-      # Solaris 8's {/usr,}/bin/sh.
-      touch sub/conftst$i.h
+      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
+      # Solaris 10 /bin/sh.
+      echo '/* dummy */' > sub/conftst$i.h
     done
     echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
 
-    # We check with `-c' and `-o' for the sake of the "dashmstdout"
+    # We check with '-c' and '-o' for the sake of the "dashmstdout"
     # mode.  It turns out that the SunPro C++ compiler does not properly
-    # handle `-M -o', and we need to detect this.  Also, some Intel
-    # versions had trouble with output in subdirs
+    # handle '-M -o', and we need to detect this.  Also, some Intel
+    # versions had trouble with output in subdirs.
     am__obj=sub/conftest.${OBJEXT-o}
     am__minus_obj="-o $am__obj"
     case $depmode in
@@ -3820,8 +3848,8 @@ else
       test "$am__universal" = false || continue
       ;;
     nosideeffect)
-      # after this tag, mechanisms are not by side-effect, so they'll
-      # only be used when explicitly requested
+      # After this tag, mechanisms are not by side-effect, so they'll
+      # only be used when explicitly requested.
       if test "x$enable_dependency_tracking" = xyes; then
 	continue
       else
@@ -3829,7 +3857,7 @@ else
       fi
       ;;
     msvc7 | msvc7msys | msvisualcpp | msvcmsys)
-      # This compiler won't grok `-c -o', but also, the minuso test has
+      # This compiler won't grok '-c -o', but also, the minuso test has
       # not run yet.  These depmodes are late enough in the game, and
       # so weak that their functioning should not be impacted.
       am__obj=conftest.${OBJEXT-o}
@@ -4299,8 +4327,8 @@ else
   # We make a subdir and do the tests there.  Otherwise we can end up
   # making bogus files that we don't know about and never remove.  For
   # instance it was reported that on HP-UX the gcc test will end up
-  # making a dummy file named `D' -- because `-MD' means `put the output
-  # in D'.
+  # making a dummy file named 'D' -- because '-MD' means "put the output
+  # in D".
   rm -rf conftest.dir
   mkdir conftest.dir
   # Copy depcomp to subdir because otherwise we won't find it if we're
@@ -4335,16 +4363,16 @@ else
     : > sub/conftest.c
     for i in 1 2 3 4 5 6; do
       echo '#include "conftst'$i'.h"' >> sub/conftest.c
-      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
-      # Solaris 8's {/usr,}/bin/sh.
-      touch sub/conftst$i.h
+      # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
+      # Solaris 10 /bin/sh.
+      echo '/* dummy */' > sub/conftst$i.h
     done
     echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
 
-    # We check with `-c' and `-o' for the sake of the "dashmstdout"
+    # We check with '-c' and '-o' for the sake of the "dashmstdout"
     # mode.  It turns out that the SunPro C++ compiler does not properly
-    # handle `-M -o', and we need to detect this.  Also, some Intel
-    # versions had trouble with output in subdirs
+    # handle '-M -o', and we need to detect this.  Also, some Intel
+    # versions had trouble with output in subdirs.
     am__obj=sub/conftest.${OBJEXT-o}
     am__minus_obj="-o $am__obj"
     case $depmode in
@@ -4353,8 +4381,8 @@ else
       test "$am__universal" = false || continue
       ;;
     nosideeffect)
-      # after this tag, mechanisms are not by side-effect, so they'll
-      # only be used when explicitly requested
+      # After this tag, mechanisms are not by side-effect, so they'll
+      # only be used when explicitly requested.
       if test "x$enable_dependency_tracking" = xyes; then
 	continue
       else
@@ -4362,7 +4390,7 @@ else
       fi
       ;;
     msvc7 | msvc7msys | msvisualcpp | msvcmsys)
-      # This compiler won't grok `-c -o', but also, the minuso test has
+      # This compiler won't grok '-c -o', but also, the minuso test has
       # not run yet.  These depmodes are late enough in the game, and
       # so weak that their functioning should not be impacted.
       am__obj=conftest.${OBJEXT-o}
@@ -4417,6 +4445,11 @@ fi
 
 
 
+
+#Tell compiler to build not R version of filevector
+CXXFLAGS+=" -D_NOT_R_FILEVECTOR"
+
+
 # Since most of our code is in C++, set that language as the default
 # for the subsequent checks
 ac_ext=cpp
@@ -5021,7 +5054,8 @@ _ACEOF
 fi
 
 for ac_header in float.h inttypes.h libintl.h limits.h stddef.h \
-                          stdint.h stdlib.h string.h sys/param.h wchar.h wctype.h
+                          stdint.h stdlib.h string.h sys/param.h \
+                          wchar.h wctype.h
 do :
   as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
 ac_fn_cxx_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
@@ -5289,73 +5323,8 @@ esac
 
 fi
 
-for ac_header in stdlib.h
-do :
-  ac_fn_cxx_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default"
-if test "x$ac_cv_header_stdlib_h" = xyes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_STDLIB_H 1
-_ACEOF
-
-fi
-
-done
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU libc compatible malloc" >&5
-$as_echo_n "checking for GNU libc compatible malloc... " >&6; }
-if ${ac_cv_func_malloc_0_nonnull+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test "$cross_compiling" = yes; then :
-  ac_cv_func_malloc_0_nonnull=no
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#if defined STDC_HEADERS || defined HAVE_STDLIB_H
-# include <stdlib.h>
-#else
-char *malloc ();
-#endif
-
-int
-main ()
-{
-return ! malloc (0);
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_cxx_try_run "$LINENO"; then :
-  ac_cv_func_malloc_0_nonnull=yes
-else
-  ac_cv_func_malloc_0_nonnull=no
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
-  conftest.$ac_objext conftest.beam conftest.$ac_ext
-fi
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_malloc_0_nonnull" >&5
-$as_echo "$ac_cv_func_malloc_0_nonnull" >&6; }
-if test $ac_cv_func_malloc_0_nonnull = yes; then :
-
-$as_echo "#define HAVE_MALLOC 1" >>confdefs.h
-
-else
-  $as_echo "#define HAVE_MALLOC 0" >>confdefs.h
-
-   case " $LIBOBJS " in
-  *" malloc.$ac_objext "* ) ;;
-  *) LIBOBJS="$LIBOBJS malloc.$ac_objext"
- ;;
-esac
-
-
-$as_echo "#define malloc rpl_malloc" >>confdefs.h
-
-fi
-
-
+# Disabled the next line to make cross compiling for Windows work.
+#AC_FUNC_MALLOC
 for ac_func in pow putenv sqrt strdup strncasecmp floor
 do :
   as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
@@ -5928,8 +5897,31 @@ fi
 
 
 
+# Check whether --enable-extract-snp was given.
+if test "${enable_extract_snp+set}" = set; then :
+  enableval=$enable_extract_snp; extractsnp=yes
+else
+  extractsnp=no
+fi
+
+
+if test "x$extractsnp" = "xyes"; then
+   { $as_echo "$as_me:${as_lineno-$LINENO}: building of extract-snp is enabled" >&5
+$as_echo "$as_me: building of extract-snp is enabled" >&6;}
+fi
+
+ if test "x$extractsnp" = "xyes"; then
+  BUILD_extractsnp_TRUE=
+  BUILD_extractsnp_FALSE='#'
+else
+  BUILD_extractsnp_TRUE='#'
+  BUILD_extractsnp_FALSE=
+fi
+
+
+
 # Files to be generated by autotools
-ac_config_files="$ac_config_files Makefile src/Makefile doc/Makefile examples/Makefile checks/Makefile"
+ac_config_files="$ac_config_files Makefile src/Makefile doc/Makefile examples/Makefile checks/Makefile checks/R-tests/Makefile"
 
 
 # Create output files
@@ -6042,6 +6034,14 @@ LIBOBJS=$ac_libobjs
 LTLIBOBJS=$ac_ltlibobjs
 
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5
+$as_echo_n "checking that generated files are newer than configure... " >&6; }
+   if test -n "$am_sleep_pid"; then
+     # Hide warnings about reused PIDs.
+     wait $am_sleep_pid 2>/dev/null
+   fi
+   { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5
+$as_echo "done" >&6; }
  if test -n "$EXEEXT"; then
   am__EXEEXT_TRUE=
   am__EXEEXT_FALSE='#'
@@ -6090,6 +6090,10 @@ if test -z "${BUILD_pacoxph_TRUE}" && test -z "${BUILD_pacoxph_FALSE}"; then
   as_fn_error $? "conditional \"BUILD_pacoxph\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
+if test -z "${BUILD_extractsnp_TRUE}" && test -z "${BUILD_extractsnp_FALSE}"; then
+  as_fn_error $? "conditional \"BUILD_extractsnp\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
 
 : "${CONFIG_STATUS=./config.status}"
 ac_write_fail=0
@@ -6487,7 +6491,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by ProbABEL $as_me 0.4.1, which was
+This file was extended by ProbABEL $as_me 0.4.2, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -6553,7 +6557,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-ProbABEL config.status 0.4.1
+ProbABEL config.status 0.4.2
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
@@ -6689,6 +6693,7 @@ do
     "doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;;
     "examples/Makefile") CONFIG_FILES="$CONFIG_FILES examples/Makefile" ;;
     "checks/Makefile") CONFIG_FILES="$CONFIG_FILES checks/Makefile" ;;
+    "checks/R-tests/Makefile") CONFIG_FILES="$CONFIG_FILES checks/R-tests/Makefile" ;;
 
   *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
   esac
@@ -7285,7 +7290,7 @@ $as_echo "$as_me: executing $ac_file commands" >&6;}
 
   case $ac_file$ac_mode in
     "depfiles":C) test x"$AMDEP_TRUE" != x"" || {
-  # Autoconf 2.62 quotes --file arguments for eval, but not when files
+  # Older Autoconf quotes --file arguments for eval, but not when files
   # are listed without --file.  Let's play safe and only enable the eval
   # if we detect the quoting.
   case $CONFIG_FILES in
@@ -7298,7 +7303,7 @@ $as_echo "$as_me: executing $ac_file commands" >&6;}
     # Strip MF so we end up with the name of the file.
     mf=`echo "$mf" | sed -e 's/:.*$//'`
     # Check whether this is an Automake generated Makefile or not.
-    # We used to match only the files named `Makefile.in', but
+    # We used to match only the files named 'Makefile.in', but
     # some people rename them; so instead we look at the file content.
     # Grep'ing the first line is not enough: some people post-process
     # each Makefile.in and add a new line on top of each file to say so.
@@ -7332,21 +7337,19 @@ $as_echo X"$mf" |
       continue
     fi
     # Extract the definition of DEPDIR, am__include, and am__quote
-    # from the Makefile without running `make'.
+    # from the Makefile without running 'make'.
     DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
     test -z "$DEPDIR" && continue
     am__include=`sed -n 's/^am__include = //p' < "$mf"`
-    test -z "am__include" && continue
+    test -z "$am__include" && continue
     am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
-    # When using ansi2knr, U may be empty or an underscore; expand it
-    U=`sed -n 's/^U = //p' < "$mf"`
     # Find all dependency output files, they are included files with
     # $(DEPDIR) in their names.  We invoke sed twice because it is the
     # simplest approach to changing $(DEPDIR) to its actual value in the
     # expansion.
     for file in `sed -n "
       s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
-	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
+	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
       # Make sure the directory exists.
       test -f "$dirpart/$file" && continue
       fdir=`$as_dirname -- "$file" ||
diff --git a/configure.ac b/configure.ac
index 3f0346b..d78aa76 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2,9 +2,9 @@
 # Process this file with autoconf to produce a configure script.
 
 AC_PREREQ([2.67])
-AC_INIT(ProbABEL, 0.4.1, genabel-devel at r-forge.wu-wien.ac.at)
+AC_INIT(ProbABEL, 0.4.2, genabel-devel at r-forge.wu-wien.ac.at)
 AM_INIT_AUTOMAKE([silent-rules])
-AM_SILENT_RULES
+AM_SILENT_RULES([yes])
 AC_CONFIG_SRCDIR([src/data.h])
 AC_CONFIG_HEADERS([src/config.h])
 
@@ -31,6 +31,11 @@ fi
 # with its own defaults
 AC_PROG_CXX
 
+
+#Tell compiler to build not R version of filevector
+CXXFLAGS+=" -D_NOT_R_FILEVECTOR"
+
+
 # Since most of our code is in C++, set that language as the default
 # for the subsequent checks
 AC_LANG_PUSH([C++])
@@ -40,7 +45,8 @@ AC_LANG_PUSH([C++])
 # Checks for header files.
 AC_FUNC_ALLOCA
 AC_CHECK_HEADERS([float.h inttypes.h libintl.h limits.h stddef.h \
-                          stdint.h stdlib.h string.h sys/param.h wchar.h wctype.h])
+                          stdint.h stdlib.h string.h sys/param.h \
+                          wchar.h wctype.h])
 
 
 # See if we want use of the Eigen library enabled (yes by default) and if so,
@@ -86,7 +92,8 @@ AC_TYPE_SIZE_T
 
 # Checks for library functions.
 AC_FUNC_ERROR_AT_LINE
-AC_FUNC_MALLOC
+# Disabled the next line to make cross compiling for Windows work.
+#AC_FUNC_MALLOC
 AC_CHECK_FUNCS([pow putenv sqrt strdup strncasecmp floor])
 
 # Check if we can use large (>2GB) files on 32 bit platforms
@@ -152,6 +159,19 @@ fi
 AM_CONDITIONAL([BUILD_pacoxph], test "x$pacoxph" = "xyes")
 
 
+AC_ARG_ENABLE([extract-snp],
+    [AS_HELP_STRING([--enable-extract-snp], [enable building the
+    extract-snp program. NOTE: this program is not finished yet!])],
+    [extractsnp=yes],
+    [extractsnp=no])
+
+if test "x$extractsnp" = "xyes"; then
+   AC_MSG_NOTICE([building of extract-snp is enabled])
+fi
+
+AM_CONDITIONAL([BUILD_extractsnp], test "x$extractsnp" = "xyes")
+
+
 # Files to be generated by autotools
 AC_CONFIG_FILES([
         Makefile
@@ -159,6 +179,7 @@ AC_CONFIG_FILES([
         doc/Makefile
         examples/Makefile
         checks/Makefile
+        checks/R-tests/Makefile
 ])
 
 # Create output files
diff --git a/doc/ChangeLog b/doc/ChangeLog
index 2c35f7b..848c466 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -1,8 +1,37 @@
+***** v.0.4.2
+* The 'probabel.pl' script is now simply renamed to 'probabel' (a user
+  shouldn't care what scripting language we use). For at least several
+  releases to come, the old script name will still exist (as a link to the
+  original) and a warning message is displayed when the user runs the
+  .pl script. This should give people time to adjust their pipelines.
+* Fix bug #4919: Too small reading buffers for long alleles in mach info
+  and legend files. Thanks to Daniel Taliun for reporting the bug and
+  providing the patch. Thanks to Xia Shen for testing.
+* Fix bug #4776: Specifying --sep="\t" as an option to pa* doesn't insert
+  a TAB as separator. Now ProbABEL inserts proper tabs when specifying
+  "\t". Thanks to Maksim Struchalin for fixing this bug.
+* Improved convergence checks in the Cox PH regression module. The checks
+  now give similar errors as R does.
+* A minor change in the screen output of ProbABEL. Some of the status
+  messages ("Reading phenotype data" etc.) have been added or move to a
+  slightly different place in the code to help debugging problems with the
+  input data.
+* Fix a bug in the example scripts: an incorrect shell variable was used.
+* The extract-snp binary is no longer built by default (as it isn't
+  finished yet). Building can be enabled at compile time by giving the
+  --enable-extract-snp option to ./configure.
+* For developers: If R is installed, running 'make check' will also
+  compare the results of ProbABEL with those of the same regressions in
+  R.
+* For developers: a start has been made on documenting the internal
+  functions using Doxygen.
+
 ***** v.0.4.1 (2013.08.29)
 * Fix bug #4854: When using mmscore, there is one (nan) column missing in
   the output for low-frequency SNPs. Also includes a simplification of the
   R-based test scripts.
 
+
 ***** v.0.4.0 (2013.08.25)
 * The output files now contain a chi^2 column with the chi^2 value based
   on the LRT when not using --mmscore. When using --mmscore, the chi^2
diff --git a/doc/INSTALL b/doc/INSTALL
index 622ddb4..edf7340 100644
--- a/doc/INSTALL
+++ b/doc/INSTALL
@@ -42,17 +42,15 @@ make install
   PDF version of the documentation will not be built.
 
   NOTE: make install will OVERWRITE any file with the same name if it
-  already exists. By default the name of the probabel.pl config file is
-  probabel_config.cfg.example. For probabel.pl to work please rename
+  already exists. By default the name of the probabel config file is
+  probabel_config.cfg.example. For probabel to work please rename
   this file to probabel_config.cfg.
 
   To see options, run
-
 ./configure --help
 
   The most notable option is
 ./configure --prefix=/some/subdirectory
-
   to install ProbABEL in that subdirectory. Instead of using
   /usr/local/ as install root directory, it installs in /some/subdirectory.
 
@@ -61,10 +59,6 @@ make install
   adding a --disable- option to configure, for example:
 ./configure --disable-palinear
 
-  Another commonly used option is --enable-silent-rules, this reduces
-  the output (sometimes considered to be noise) of the make step:
-./configure --enable-silent-rules
-
 
 * Options for developers
   To generate a .tar.gz package for distribution run:
@@ -82,7 +76,7 @@ make distcheck
   ones you specified when running ./configure earlier won't be
   "transmitted" to this run). This can be done as in the following
   example:
-DISTCHECK_CONFIGURE_FLAGS="--enable-silent-rules" make distcheck
+DISTCHECK_CONFIGURE_FLAGS="--without-eigen" make distcheck
 
   To clean up all files generated by ./configure and make, run
 make distclean
@@ -130,7 +124,8 @@ apt-get install binutils-mingw-w64-i686 gcc-mingw-w64-base gcc-mingw-w64-i686 \
   subdirectories like 'share/' and 'etc/'.
 
   Now you can run
-make CFLAGS+="-O2 -static-libgcc -static-libstdc++" CXXFLAGS+="-O2 -static-libgcc -static-libstdc++"
+make CFLAGS+="-O2 -static-libgcc -static-libstdc++ -D_NOT_R_FILEVECTOR" \
+     CXXFLAGS+="-O2 -static-libgcc -static-libstdc++ -D_NOT_R_FILEVECTOR"
 make install
 
   This creates the binaries pacoxph.exe, palinear.exe and
diff --git a/doc/Makefile.am b/doc/Makefile.am
index 2304012..fc948f9 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -6,7 +6,7 @@ dist_doc_DATA = ProbABEL_manual.tex QuickStart.txt			\
  test.mlinfo test_regression.R COPYING LICENSE INSTALL ChangeLog	\
  TODO
 
-man_MANS =
+man_MANS = probabel.1 probabel.pl.1
 if BUILD_palinear
 man_MANS += palinear.1
 endif
diff --git a/doc/Makefile.in b/doc/Makefile.in
index 7011d42..e0f999e 100644
--- a/doc/Makefile.in
+++ b/doc/Makefile.in
@@ -1,9 +1,8 @@
-# Makefile.in generated by automake 1.11.6 from Makefile.am.
+# Makefile.in generated by automake 1.13.3 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# Copyright (C) 1994-2013 Free Software Foundation, Inc.
+
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -16,23 +15,51 @@
 @SET_MAKE@
 
 VPATH = @srcdir@
-am__make_dryrun = \
-  { \
-    am__dry=no; \
+am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
+am__make_running_with_option = \
+  case $${target_option-} in \
+      ?) ;; \
+      *) echo "am__make_running_with_option: internal error: invalid" \
+              "target option '$${target_option-}' specified" >&2; \
+         exit 1;; \
+  esac; \
+  has_opt=no; \
+  sane_makeflags=$$MAKEFLAGS; \
+  if $(am__is_gnu_make); then \
+    sane_makeflags=$$MFLAGS; \
+  else \
     case $$MAKEFLAGS in \
       *\\[\ \	]*) \
-        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
-          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
-      *) \
-        for am__flg in $$MAKEFLAGS; do \
-          case $$am__flg in \
-            *=*|--*) ;; \
-            *n*) am__dry=yes; break;; \
-          esac; \
-        done;; \
+        bs=\\; \
+        sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+          | sed "s/$$bs$$bs[$$bs $$bs	]*//g"`;; \
     esac; \
-    test $$am__dry = yes; \
-  }
+  fi; \
+  skip_next=no; \
+  strip_trailopt () \
+  { \
+    flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+  }; \
+  for flg in $$sane_makeflags; do \
+    test $$skip_next = yes && { skip_next=no; continue; }; \
+    case $$flg in \
+      *=*|--*) continue;; \
+        -*I) strip_trailopt 'I'; skip_next=yes;; \
+      -*I?*) strip_trailopt 'I';; \
+        -*O) strip_trailopt 'O'; skip_next=yes;; \
+      -*O?*) strip_trailopt 'O';; \
+        -*l) strip_trailopt 'l'; skip_next=yes;; \
+      -*l?*) strip_trailopt 'l';; \
+      -[dEDm]) skip_next=yes;; \
+      -[JT]) skip_next=yes;; \
+    esac; \
+    case $$flg in \
+      *$$target_option*) has_opt=yes; break;; \
+    esac; \
+  done; \
+  test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
 pkgdatadir = $(datadir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
@@ -53,8 +80,8 @@ POST_UNINSTALL = :
 @BUILD_palogist_TRUE at am__append_2 = palogist.1
 @BUILD_pacoxph_TRUE at am__append_3 = pacoxph.1
 subdir = doc
-DIST_COMMON = $(dist_doc_DATA) $(srcdir)/Makefile.am \
-	$(srcdir)/Makefile.in COPYING ChangeLog INSTALL TODO
+DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
+	$(dist_doc_DATA) COPYING ChangeLog INSTALL TODO
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
@@ -63,12 +90,30 @@ mkinstalldirs = $(install_sh) -d
 CONFIG_HEADER = $(top_builddir)/src/config.h
 CONFIG_CLEAN_FILES =
 CONFIG_CLEAN_VPATH_FILES =
+AM_V_P = $(am__v_P_ at AM_V@)
+am__v_P_ = $(am__v_P_ at AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
 AM_V_GEN = $(am__v_GEN_ at AM_V@)
 am__v_GEN_ = $(am__v_GEN_ at AM_DEFAULT_V@)
-am__v_GEN_0 = @echo "  GEN   " $@;
+am__v_GEN_0 = @echo "  GEN     " $@;
+am__v_GEN_1 = 
 AM_V_at = $(am__v_at_ at AM_V@)
 am__v_at_ = $(am__v_at_ at AM_DEFAULT_V@)
 am__v_at_0 = @
+am__v_at_1 = 
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+AM_V_CC = $(am__v_CC_ at AM_V@)
+am__v_CC_ = $(am__v_CC_ at AM_DEFAULT_V@)
+am__v_CC_0 = @echo "  CC      " $@;
+am__v_CC_1 = 
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_CCLD = $(am__v_CCLD_ at AM_V@)
+am__v_CCLD_ = $(am__v_CCLD_ at AM_DEFAULT_V@)
+am__v_CCLD_0 = @echo "  CCLD    " $@;
+am__v_CCLD_1 = 
 SOURCES =
 DIST_SOURCES =
 am__can_run_installinfo = \
@@ -109,6 +154,7 @@ am__installdirs = "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(docdir)" \
 NROFF = nroff
 MANS = $(man_MANS)
 DATA = $(dist_doc_DATA) $(doc_DATA)
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
 ALLOCA = @ALLOCA@
@@ -213,7 +259,8 @@ dist_doc_DATA = ProbABEL_manual.tex QuickStart.txt			\
  test.mlinfo test_regression.R COPYING LICENSE INSTALL ChangeLog	\
  TODO
 
-man_MANS = $(am__append_1) $(am__append_2) $(am__append_3)
+man_MANS = probabel.1 probabel.pl.1 $(am__append_1) $(am__append_2) \
+	$(am__append_3)
 EXTRA_DIST = $(man_MANS)
 @HAVE_PDFLATEX_TRUE at MANNAME = ProbABEL_manual
 @HAVE_PDFLATEX_TRUE at MANPDF = $(MANNAME).pdf
@@ -342,27 +389,14 @@ uninstall-docDATA:
 	@list='$(doc_DATA)'; test -n "$(docdir)" || list=; \
 	files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
 	dir='$(DESTDIR)$(docdir)'; $(am__uninstall_files_from_dir)
-tags: TAGS
-TAGS:
+tags TAGS:
+
+ctags CTAGS:
 
-ctags: CTAGS
-CTAGS:
+cscope cscopelist:
 
 
 distdir: $(DISTFILES)
-	@list='$(MANS)'; if test -n "$$list"; then \
-	  list=`for p in $$list; do \
-	    if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
-	    if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \
-	  if test -n "$$list" && \
-	    grep 'ab help2man is required to generate this page' $$list >/dev/null; then \
-	    echo "error: found man pages containing the \`missing help2man' replacement text:" >&2; \
-	    grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/         /' >&2; \
-	    echo "       to fix them, install help2man, remove and regenerate the man pages;" >&2; \
-	    echo "       typically \`make maintainer-clean' will remove them" >&2; \
-	    exit 1; \
-	  else :; fi; \
-	else :; fi
 	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
 	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
 	list='$(DISTFILES)'; \
@@ -500,18 +534,18 @@ uninstall-man: uninstall-man1
 
 .MAKE: install-am install-strip
 
-.PHONY: all all-am check check-am clean clean-generic distclean \
-	distclean-generic distdir dvi dvi-am html html-am info info-am \
-	install install-am install-data install-data-am \
-	install-dist_docDATA install-docDATA install-dvi \
-	install-dvi-am install-exec install-exec-am install-html \
-	install-html-am install-info install-info-am install-man \
-	install-man1 install-pdf install-pdf-am install-ps \
+.PHONY: all all-am check check-am clean clean-generic cscopelist-am \
+	ctags-am distclean distclean-generic distdir dvi dvi-am html \
+	html-am info info-am install install-am install-data \
+	install-data-am install-dist_docDATA install-docDATA \
+	install-dvi install-dvi-am install-exec install-exec-am \
+	install-html install-html-am install-info install-info-am \
+	install-man install-man1 install-pdf install-pdf-am install-ps \
 	install-ps-am install-strip installcheck installcheck-am \
 	installdirs maintainer-clean maintainer-clean-generic \
-	mostlyclean mostlyclean-generic pdf pdf-am ps ps-am uninstall \
-	uninstall-am uninstall-dist_docDATA uninstall-docDATA \
-	uninstall-man uninstall-man1
+	mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags-am \
+	uninstall uninstall-am uninstall-dist_docDATA \
+	uninstall-docDATA uninstall-man uninstall-man1
 
 
 # Several make rules to generate the PDF from the LaTeX source
diff --git a/doc/ProbABEL_manual.tex b/doc/ProbABEL_manual.tex
index 04409b1..e20e7d0 100644
--- a/doc/ProbABEL_manual.tex
+++ b/doc/ProbABEL_manual.tex
@@ -1,16 +1,17 @@
 \documentclass[12pt,a4paper]{article}
 
-\title{Manual for ProbABEL v0.4.1}
-\author{\emph{Current Programmers:} Lennart Karssen$^{1}$, Maarten
-  Kooyman$^1$, \\
-  Yurii Aulchenko$^{2}$ \\
+\title{Manual for ProbABEL v0.4.2}
+\author{\emph{Current Programmers:} Lennart Karssen$^{1,2}$, Maarten
+  Kooyman$^2$, \\
+  Yurii Aulchenko$^{1,3}$ \\
   \emph{Former Programmers:} Maksim Struchalin
   \\
   \\
-  $^{1}${\small Erasmus MC, Rotterdam} \\
-  $^{2}${\small Institute of Cytology and Genetics SD RAS, Novosibirsk}
+  $^{1}${\small YuriiA Consulting} \\
+  $^{2}${\small Erasmus MC, Rotterdam}\\
+  $^{3}${\small Institute of Cytology and Genetics SD RAS, Novosibirsk}
 }
-\date{\today}
+\date{January 2, 2014}
 
 \usepackage{verbatim}
 \usepackage{titleref}
@@ -99,6 +100,14 @@ as well as the Cox proportional hazards model. The corresponding analysis
 programs are called \texttt{palinear},  \texttt{palogist},
 and \texttt{pacoxph}.
 
+For more information, please have a look at the GenABEL project
+website at \url{http://www.genabel.org}. The \PA{}-specific home
+page is located at
+\url{http://www.genabel.org/packages/ProbABEL}. For user support
+questions, please turn to our forum at
+\url{http://forum.genabel.org}. Bugs in \PA{} can be reported in the
+GenABEL project bug tracker at
+\url{https://r-forge.r-project.org/tracker/index.php?group_id=505&atid=2058}.
 
 \section{Input files}
 \PA{} takes three files as input: a file containing SNP
@@ -286,7 +295,7 @@ you run either program with the \texttt{--help} option, you will get a
 short explanation to the command line options:
 \begin{verbatim}
 user at server:~$ palogist --help
-probabel v. 0.4.1
+probabel v. 0.4.2
 (C) Yurii Aulchenko, Lennart C. Karssen, Maksim Struchalin, EMCR
 
 Using EIGEN version 3.1.2 for matrix operations
@@ -423,9 +432,9 @@ variance should be fit as part of \GA{}'s
 %in which case the main effect should normally estimated in the polygenic
 %model and only the interaction term in the \PA{} analysis.
 
-\subsection{Running multiple analyses at once: \texttt{probabel.pl}}
-The Perl script \texttt{bin/probabel.pl} represents a handy wraper for
-\PA{} functions.  To start using it the configuration file
+\subsection{Running multiple analyses at once: \texttt{probabel}}
+The \texttt{bin/probabel} script is a handy wraper for the \PA{}
+functions. To start using it the configuration file
 \texttt{etc/probabel\_config.cfg.example} needs to be edited and
 renamed to \texttt{etc/probabel\_config.cfg}. The configuration file
 consists of five columns, separated by commas. Each column except the
@@ -437,14 +446,14 @@ where the chromosome number has been replaced by
 \texttt{\_.\_chr\_.\_}. In case the imputations were run on chunks of
 chromosomes, the pattern \texttt{\_.\_chunk\_.\_} will be replaced
 with the corresponding chunk number. Chunk numbers should start at 1
-for each chromosome. The columns ``dose\_path'', ``prob\_path''
-and ``legend\_path'' are paths and patterns for ``dose'', ``prob'' and
+for each chromosome. The columns ``dose\_path'', ``prob\_path'' and
+``legend\_path'' are paths and patterns for ``dose'', ``prob'' and
 ``legend'' files, respectively. These also need to include the pattern
 for the chromosome as used in the column for the ``info'' files.
 Empty lines and lines starting with a \texttt{\#} are ignored.
 
 The \texttt{make install} installation procedure should have set all
-paths in the \texttt{probabel.pl} script correctly. If that is not the
+paths in the \texttt{probabel} script correctly. If that is not the
 case you will have to change the variable \texttt{\$config} in the
 script to point to the full path of the configuration file and the
 variables \texttt{\$base\_path} and \texttt{@anprog} to point the full
@@ -846,7 +855,7 @@ BMC Bioinformatics. 2010, 11:134.
 \end{quote}
 A proper reference may look like
 \begin{quote}
-For the analysis of imputed data, we used the \PA{} v.0.4.1
+For the analysis of imputed data, we used the \PA{} v.0.4.2
 from the \texttt{GenABEL} suite of programs (Aulchenko \emph{et al.}, 2010).
 \end{quote}
 
diff --git a/doc/pacoxph.1 b/doc/pacoxph.1
index 952b0a8..2359961 100644
--- a/doc/pacoxph.1
+++ b/doc/pacoxph.1
@@ -1,4 +1,4 @@
-.TH pacoxph 1 "29 August 2013"
+.TH pacoxph 1 "2 January 2014" "ProbABEL 0.4.2"
 .SH NAME
 pacoxph \- Perform Genome-Wide Association Analysis using a linear model
 .SH SYNOPSIS
diff --git a/doc/palinear.1 b/doc/palinear.1
index 36b5fd0..95743ca 100644
--- a/doc/palinear.1
+++ b/doc/palinear.1
@@ -1,4 +1,4 @@
-.TH palinear 1 "29 August 2013"
+.TH palinear 1 "2 January 2014" "ProbABEL 0.4.2"
 .SH NAME
 palinear \- Perform Genome-Wide Association Analysis using a linear model
 .SH SYNOPSIS
@@ -76,7 +76,7 @@ Report robust (a.k.a. sandwich, a.k.a. Hubert-White) standard errors.
 Print help.
 
 .SH "SEE ALSO"
-palogist(1), pacoxph(1)
+probabel(1), palogist(1), pacoxph(1)
 .SH BUGS
 The bugtracker is located at
 .br
diff --git a/doc/palogist.1 b/doc/palogist.1
index 00794f0..7cbf8ec 100644
--- a/doc/palogist.1
+++ b/doc/palogist.1
@@ -1,4 +1,4 @@
-.TH palogist 1 "29 August 2013"
+.TH palogist 1 "2 January 2014" "ProbABEL 0.4.2"
 .SH NAME
 palogist \- Perform Genome-Wide Association Analysis using a linear model
 .SH SYNOPSIS
@@ -76,7 +76,7 @@ Report robust (a.k.a. sandwich, a.k.a. Hubert-White) standard errors.
 Print help.
 
 .SH "SEE ALSO"
-palinear(1), pacoxph(1)
+probabel(1), palinear(1), pacoxph(1)
 .SH BUGS
 The bugtracker is located at
 .br
diff --git a/doc/probabel.1 b/doc/probabel.1
new file mode 100644
index 0000000..d818345
--- /dev/null
+++ b/doc/probabel.1
@@ -0,0 +1,91 @@
+.TH ProbABEL 1 "2 January 2014" "ProbABEL 0.4.2"
+.SH NAME
+probabel \- Wrapper around the three ProbABEL binaries, simplifying their use
+.SH SYNOPSIS
+.B probabel
+.BI "" "CHROM-START CHROM-STOP METHOD COHORT MODEL PHENOTYPE [OTHER_OPTIONS]"
+.SH DESCRIPTION
+.B probabel
+is a wrapper around the three ProbABEL binaries: \fBpalinear\fR,
+\fBpalogist\fR, and \fBpacoxph\fR.
+.PP
+It is designed to simplify runnig of a Genome-Wide Association Study
+(GWAS) by saving the user's precious time in two ways:
+.PP
+1) it runs the regression analysis of all chromosomes from \fICHROM-START\fR to
+\fICHROM-STOP\fR.
+.PP
+2) In contrast to the three binaries mentioned above,
+with \fBprobabel\fR the user doesn't need to specify the locations
+of the required genetic data files. Their location is centrally
+managed in a configuration file (\fI/etc/probabel_config.cfg\fR by default).
+
+.SH OPTIONS
+.SS Required command line options
+.TP
+.I CHROM-START
+Number of the chromosome to start the analysis at.
+.TP
+.I CHROM-END
+Number of the chromosome to end the analysis at.
+.PP
+Note that analysis of a single chromosome can be run by specifying the
+same number for \fICHROM-START\fR and \fICHROM-STOP\fR. In fact, this
+is the way to run analysis for the X or Y chromosome
+.TP
+.I METHOD
+Which regression method to use, can be one of \fIlinear\fR,
+\fIlogistic,\fR or \fIcoxph\fR.
+
+.TP
+.I COHORT
+The name of the cohort as defined in the
+\fI/etc/probabel_config.cfg\fR file. Using the cohort identifier from
+the config file the three actual ProbABEL binaries know where to find
+the genotypic information files (dosage files and/or probability
+files).
+.TP
+.I MODEL
+The genetic model to be used. Can be either \fB--additive\fR for the
+additive model (requires genotype data in dosage form), or
+\fB--allmodels\fR to run all genetic models: additive, recessive,
+dominant, over-dominant and 2df.
+.TP
+.I PHENOTYPE
+The name of the phenotype file, without its extension (which should be
+\fI.PHE\fR!).
+
+.SS Other options
+Any options listed after the (mandatory) previous ones will be passed
+on to the underlying binary: \fBpalinear\fR, \fBpalogist\fR or
+\fBpacoxph\fR, depending on the \fIMETHOD\fR.
+.PP
+The most commonly used option is the \fB\-o\fR option, followed by a
+file name, this specifies the beginning of the file name for the
+output files.
+
+.SS Additional options
+.B "\-h, \-\-help"
+Get additional help on how to run \fBprobabel\fR. In this case none of
+the other options needs to be specified.
+
+.SH EXAMPLES
+This runs a genome-wide association scan using linear regression and
+the additive genetic model on cohort \fIMy_Large_Cohort\fR for
+phenotype \fImy_phenotype\fR:
+.PP
+.nf
+.RS
+probabel 1 22 linear "My_Large_Cohort" \-\-additive my_phenotype
+.RE
+.fi
+.PP
+
+.SH "SEE ALSO"
+palinear(1), palogist(1), pacoxph(1)
+.SH BUGS
+The bugtracker is located at
+.br
+https://r-forge.r-project.org/tracker/?group_id=505
+.SH AUTHORS
+Lennart C. Karssen
diff --git a/doc/probabel.pl.1 b/doc/probabel.pl.1
new file mode 100644
index 0000000..d818345
--- /dev/null
+++ b/doc/probabel.pl.1
@@ -0,0 +1,91 @@
+.TH ProbABEL 1 "2 January 2014" "ProbABEL 0.4.2"
+.SH NAME
+probabel \- Wrapper around the three ProbABEL binaries, simplifying their use
+.SH SYNOPSIS
+.B probabel
+.BI "" "CHROM-START CHROM-STOP METHOD COHORT MODEL PHENOTYPE [OTHER_OPTIONS]"
+.SH DESCRIPTION
+.B probabel
+is a wrapper around the three ProbABEL binaries: \fBpalinear\fR,
+\fBpalogist\fR, and \fBpacoxph\fR.
+.PP
+It is designed to simplify runnig of a Genome-Wide Association Study
+(GWAS) by saving the user's precious time in two ways:
+.PP
+1) it runs the regression analysis of all chromosomes from \fICHROM-START\fR to
+\fICHROM-STOP\fR.
+.PP
+2) In contrast to the three binaries mentioned above,
+with \fBprobabel\fR the user doesn't need to specify the locations
+of the required genetic data files. Their location is centrally
+managed in a configuration file (\fI/etc/probabel_config.cfg\fR by default).
+
+.SH OPTIONS
+.SS Required command line options
+.TP
+.I CHROM-START
+Number of the chromosome to start the analysis at.
+.TP
+.I CHROM-END
+Number of the chromosome to end the analysis at.
+.PP
+Note that analysis of a single chromosome can be run by specifying the
+same number for \fICHROM-START\fR and \fICHROM-STOP\fR. In fact, this
+is the way to run analysis for the X or Y chromosome
+.TP
+.I METHOD
+Which regression method to use, can be one of \fIlinear\fR,
+\fIlogistic,\fR or \fIcoxph\fR.
+
+.TP
+.I COHORT
+The name of the cohort as defined in the
+\fI/etc/probabel_config.cfg\fR file. Using the cohort identifier from
+the config file the three actual ProbABEL binaries know where to find
+the genotypic information files (dosage files and/or probability
+files).
+.TP
+.I MODEL
+The genetic model to be used. Can be either \fB--additive\fR for the
+additive model (requires genotype data in dosage form), or
+\fB--allmodels\fR to run all genetic models: additive, recessive,
+dominant, over-dominant and 2df.
+.TP
+.I PHENOTYPE
+The name of the phenotype file, without its extension (which should be
+\fI.PHE\fR!).
+
+.SS Other options
+Any options listed after the (mandatory) previous ones will be passed
+on to the underlying binary: \fBpalinear\fR, \fBpalogist\fR or
+\fBpacoxph\fR, depending on the \fIMETHOD\fR.
+.PP
+The most commonly used option is the \fB\-o\fR option, followed by a
+file name, this specifies the beginning of the file name for the
+output files.
+
+.SS Additional options
+.B "\-h, \-\-help"
+Get additional help on how to run \fBprobabel\fR. In this case none of
+the other options needs to be specified.
+
+.SH EXAMPLES
+This runs a genome-wide association scan using linear regression and
+the additive genetic model on cohort \fIMy_Large_Cohort\fR for
+phenotype \fImy_phenotype\fR:
+.PP
+.nf
+.RS
+probabel 1 22 linear "My_Large_Cohort" \-\-additive my_phenotype
+.RE
+.fi
+.PP
+
+.SH "SEE ALSO"
+palinear(1), palogist(1), pacoxph(1)
+.SH BUGS
+The bugtracker is located at
+.br
+https://r-forge.r-project.org/tracker/?group_id=505
+.SH AUTHORS
+Lennart C. Karssen
diff --git a/examples/Makefile.am b/examples/Makefile.am
index 4771ca7..ee918bb 100644
--- a/examples/Makefile.am
+++ b/examples/Makefile.am
@@ -40,3 +40,84 @@ dist_example_SCRIPTS = $(example_scripts)
 
 gdatadir = $(pkgdatadir)/examples/gtdata
 dist_gdata_DATA = $(genofiles)
+
+
+cleanfiles_example_qt = height_allcov_fv_add.out.txt	\
+ height_base_add.out.txt				\
+ height_base_fv_add.out.txt				\
+ height_int1_fv_add.out.txt				\
+ height_ngp2_2df.out.txt				\
+ height_ngp2_add.out.txt				\
+ height_ngp2_allcov_fv_2df.out.txt			\
+ height_ngp2_allcov_fv_add.out.txt			\
+ height_ngp2_allcov_fv_domin.out.txt			\
+ height_ngp2_allcov_fv_over_domin.out.txt		\
+ height_ngp2_allcov_fv_recess.out.txt			\
+ height_ngp2_domin.out.txt				\
+ height_ngp2_fv_2df.out.txt				\
+ height_ngp2_fv_add.out.txt				\
+ height_ngp2_fv_domin.out.txt				\
+ height_ngp2_fv_over_domin.out.txt			\
+ height_ngp2_fv_recess.out.txt				\
+ height_ngp2_int1_fv_2df.out.txt			\
+ height_ngp2_int1_fv_add.out.txt			\
+ height_ngp2_int1_fv_domin.out.txt			\
+ height_ngp2_int1_fv_over_domin.out.txt			\
+ height_ngp2_int1_fv_recess.out.txt			\
+ height_ngp2_over_domin.out.txt				\
+ height_ngp2_recess.out.txt				\
+ height_ngp2_robust_fv_2df.out.txt			\
+ height_ngp2_robust_fv_add.out.txt			\
+ height_ngp2_robust_fv_domin.out.txt			\
+ height_ngp2_robust_fv_over_domin.out.txt		\
+ height_ngp2_robust_fv_recess.out.txt			\
+ height_ngp2_robust_int1_fv_2df.out.txt			\
+ height_ngp2_robust_int1_fv_add.out.txt			\
+ height_ngp2_robust_int1_fv_domin.out.txt		\
+ height_ngp2_robust_int1_fv_over_domin.out.txt		\
+ height_ngp2_robust_int1_fv_recess.out.txt		\
+ height_robust_fv_add.out.txt				\
+ height_robust_int1_fv_add.out.txt
+
+cleanfiles_example_bt = logist_add.out.txt	\
+ logist_fv_add.out.txt				\
+ logist_prob_2df.out.txt			\
+ logist_prob_add.out.txt			\
+ logist_prob_domin.out.txt			\
+ logist_prob_fv_2df.out.txt			\
+ logist_prob_fv_add.out.txt			\
+ logist_prob_fv_domin.out.txt			\
+ logist_prob_fv_over_domin.out.txt		\
+ logist_prob_fv_recess.out.txt			\
+ logist_prob_over_domin.out.txt			\
+ logist_prob_recess.out.txt
+
+cleanfiles_example_cox = coxph_dose_add.out.txt	\
+ coxph_dose_fv_add.out.txt			\
+ coxph_prob_2df.out.txt				\
+ coxph_prob_add.out.txt				\
+ coxph_prob_domin.out.txt			\
+ coxph_prob_fv_2df.out.txt			\
+ coxph_prob_fv_add.out.txt			\
+ coxph_prob_fv_domin.out.txt			\
+ coxph_prob_fv_over_domin.out.txt		\
+ coxph_prob_fv_recess.out.txt			\
+ coxph_prob_over_domin.out.txt			\
+ coxph_prob_recess.out.txt
+
+cleanfiles_example_mmscore = mmscore_dose_add.out.txt	\
+ mmscore_dose_fv_add.out.txt				\
+ mmscore_prob_2df.out.txt				\
+ mmscore_prob_add.out.txt				\
+ mmscore_prob_domin.out.txt				\
+ mmscore_prob_fv_2df.out.txt				\
+ mmscore_prob_fv_add.out.txt				\
+ mmscore_prob_fv_domin.out.txt				\
+ mmscore_prob_fv_over_domin.out.txt			\
+ mmscore_prob_fv_recess.out.txt				\
+ mmscore_prob_over_domin.out.txt			\
+ mmscore_prob_recess.out.txt
+
+
+CLEANFILES =  $(cleanfiles_example_qt) $(cleanfiles_example_bt)	\
+ $(cleanfiles_example_cox) $(cleanfiles_example_mmscore)
diff --git a/examples/Makefile.in b/examples/Makefile.in
index 03ad1de..4d6d1bf 100644
--- a/examples/Makefile.in
+++ b/examples/Makefile.in
@@ -1,9 +1,8 @@
-# Makefile.in generated by automake 1.11.6 from Makefile.am.
+# Makefile.in generated by automake 1.13.3 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# Copyright (C) 1994-2013 Free Software Foundation, Inc.
+
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -17,23 +16,51 @@
 
 
 VPATH = @srcdir@
-am__make_dryrun = \
-  { \
-    am__dry=no; \
+am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
+am__make_running_with_option = \
+  case $${target_option-} in \
+      ?) ;; \
+      *) echo "am__make_running_with_option: internal error: invalid" \
+              "target option '$${target_option-}' specified" >&2; \
+         exit 1;; \
+  esac; \
+  has_opt=no; \
+  sane_makeflags=$$MAKEFLAGS; \
+  if $(am__is_gnu_make); then \
+    sane_makeflags=$$MFLAGS; \
+  else \
     case $$MAKEFLAGS in \
       *\\[\ \	]*) \
-        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
-          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
-      *) \
-        for am__flg in $$MAKEFLAGS; do \
-          case $$am__flg in \
-            *=*|--*) ;; \
-            *n*) am__dry=yes; break;; \
-          esac; \
-        done;; \
+        bs=\\; \
+        sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+          | sed "s/$$bs$$bs[$$bs $$bs	]*//g"`;; \
     esac; \
-    test $$am__dry = yes; \
-  }
+  fi; \
+  skip_next=no; \
+  strip_trailopt () \
+  { \
+    flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+  }; \
+  for flg in $$sane_makeflags; do \
+    test $$skip_next = yes && { skip_next=no; continue; }; \
+    case $$flg in \
+      *=*|--*) continue;; \
+        -*I) strip_trailopt 'I'; skip_next=yes;; \
+      -*I?*) strip_trailopt 'I';; \
+        -*O) strip_trailopt 'O'; skip_next=yes;; \
+      -*O?*) strip_trailopt 'O';; \
+        -*l) strip_trailopt 'l'; skip_next=yes;; \
+      -*l?*) strip_trailopt 'l';; \
+      -[dEDm]) skip_next=yes;; \
+      -[JT]) skip_next=yes;; \
+    esac; \
+    case $$flg in \
+      *$$target_option*) has_opt=yes; break;; \
+    esac; \
+  done; \
+  test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
 pkgdatadir = $(datadir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
@@ -51,8 +78,9 @@ NORMAL_UNINSTALL = :
 PRE_UNINSTALL = :
 POST_UNINSTALL = :
 subdir = examples
-DIST_COMMON = README $(dist_example_DATA) $(dist_example_SCRIPTS) \
-	$(dist_gdata_DATA) $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
+	$(dist_example_SCRIPTS) $(dist_example_DATA) \
+	$(dist_gdata_DATA) README
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
@@ -91,12 +119,18 @@ am__uninstall_files_from_dir = { \
 am__installdirs = "$(DESTDIR)$(exampledir)" "$(DESTDIR)$(exampledir)" \
 	"$(DESTDIR)$(gdatadir)"
 SCRIPTS = $(dist_example_SCRIPTS)
+AM_V_P = $(am__v_P_ at AM_V@)
+am__v_P_ = $(am__v_P_ at AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
 AM_V_GEN = $(am__v_GEN_ at AM_V@)
 am__v_GEN_ = $(am__v_GEN_ at AM_DEFAULT_V@)
-am__v_GEN_0 = @echo "  GEN   " $@;
+am__v_GEN_0 = @echo "  GEN     " $@;
+am__v_GEN_1 = 
 AM_V_at = $(am__v_at_ at AM_V@)
 am__v_at_ = $(am__v_at_ at AM_DEFAULT_V@)
 am__v_at_0 = @
+am__v_at_1 = 
 SOURCES =
 DIST_SOURCES =
 am__can_run_installinfo = \
@@ -105,6 +139,7 @@ am__can_run_installinfo = \
     *) (install-info --version) >/dev/null 2>&1;; \
   esac
 DATA = $(dist_example_DATA) $(dist_gdata_DATA)
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
 ALLOCA = @ALLOCA@
@@ -240,6 +275,85 @@ dist_example_DATA = $(phenofiles) $(additional_files)
 dist_example_SCRIPTS = $(example_scripts)
 gdatadir = $(pkgdatadir)/examples/gtdata
 dist_gdata_DATA = $(genofiles)
+cleanfiles_example_qt = height_allcov_fv_add.out.txt	\
+ height_base_add.out.txt				\
+ height_base_fv_add.out.txt				\
+ height_int1_fv_add.out.txt				\
+ height_ngp2_2df.out.txt				\
+ height_ngp2_add.out.txt				\
+ height_ngp2_allcov_fv_2df.out.txt			\
+ height_ngp2_allcov_fv_add.out.txt			\
+ height_ngp2_allcov_fv_domin.out.txt			\
+ height_ngp2_allcov_fv_over_domin.out.txt		\
+ height_ngp2_allcov_fv_recess.out.txt			\
+ height_ngp2_domin.out.txt				\
+ height_ngp2_fv_2df.out.txt				\
+ height_ngp2_fv_add.out.txt				\
+ height_ngp2_fv_domin.out.txt				\
+ height_ngp2_fv_over_domin.out.txt			\
+ height_ngp2_fv_recess.out.txt				\
+ height_ngp2_int1_fv_2df.out.txt			\
+ height_ngp2_int1_fv_add.out.txt			\
+ height_ngp2_int1_fv_domin.out.txt			\
+ height_ngp2_int1_fv_over_domin.out.txt			\
+ height_ngp2_int1_fv_recess.out.txt			\
+ height_ngp2_over_domin.out.txt				\
+ height_ngp2_recess.out.txt				\
+ height_ngp2_robust_fv_2df.out.txt			\
+ height_ngp2_robust_fv_add.out.txt			\
+ height_ngp2_robust_fv_domin.out.txt			\
+ height_ngp2_robust_fv_over_domin.out.txt		\
+ height_ngp2_robust_fv_recess.out.txt			\
+ height_ngp2_robust_int1_fv_2df.out.txt			\
+ height_ngp2_robust_int1_fv_add.out.txt			\
+ height_ngp2_robust_int1_fv_domin.out.txt		\
+ height_ngp2_robust_int1_fv_over_domin.out.txt		\
+ height_ngp2_robust_int1_fv_recess.out.txt		\
+ height_robust_fv_add.out.txt				\
+ height_robust_int1_fv_add.out.txt
+
+cleanfiles_example_bt = logist_add.out.txt	\
+ logist_fv_add.out.txt				\
+ logist_prob_2df.out.txt			\
+ logist_prob_add.out.txt			\
+ logist_prob_domin.out.txt			\
+ logist_prob_fv_2df.out.txt			\
+ logist_prob_fv_add.out.txt			\
+ logist_prob_fv_domin.out.txt			\
+ logist_prob_fv_over_domin.out.txt		\
+ logist_prob_fv_recess.out.txt			\
+ logist_prob_over_domin.out.txt			\
+ logist_prob_recess.out.txt
+
+cleanfiles_example_cox = coxph_dose_add.out.txt	\
+ coxph_dose_fv_add.out.txt			\
+ coxph_prob_2df.out.txt				\
+ coxph_prob_add.out.txt				\
+ coxph_prob_domin.out.txt			\
+ coxph_prob_fv_2df.out.txt			\
+ coxph_prob_fv_add.out.txt			\
+ coxph_prob_fv_domin.out.txt			\
+ coxph_prob_fv_over_domin.out.txt		\
+ coxph_prob_fv_recess.out.txt			\
+ coxph_prob_over_domin.out.txt			\
+ coxph_prob_recess.out.txt
+
+cleanfiles_example_mmscore = mmscore_dose_add.out.txt	\
+ mmscore_dose_fv_add.out.txt				\
+ mmscore_prob_2df.out.txt				\
+ mmscore_prob_add.out.txt				\
+ mmscore_prob_domin.out.txt				\
+ mmscore_prob_fv_2df.out.txt				\
+ mmscore_prob_fv_add.out.txt				\
+ mmscore_prob_fv_domin.out.txt				\
+ mmscore_prob_fv_over_domin.out.txt			\
+ mmscore_prob_fv_recess.out.txt				\
+ mmscore_prob_over_domin.out.txt			\
+ mmscore_prob_recess.out.txt
+
+CLEANFILES = $(cleanfiles_example_qt) $(cleanfiles_example_bt)	\
+ $(cleanfiles_example_cox) $(cleanfiles_example_mmscore)
+
 all: all-am
 
 .SUFFIXES:
@@ -350,11 +464,11 @@ uninstall-dist_gdataDATA:
 	@list='$(dist_gdata_DATA)'; test -n "$(gdatadir)" || list=; \
 	files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
 	dir='$(DESTDIR)$(gdatadir)'; $(am__uninstall_files_from_dir)
-tags: TAGS
-TAGS:
+tags TAGS:
 
-ctags: CTAGS
-CTAGS:
+ctags CTAGS:
+
+cscope cscopelist:
 
 
 distdir: $(DISTFILES)
@@ -416,6 +530,7 @@ install-strip:
 mostlyclean-generic:
 
 clean-generic:
+	-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
 
 distclean-generic:
 	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
@@ -494,19 +609,19 @@ uninstall-am: uninstall-dist_exampleDATA uninstall-dist_exampleSCRIPTS \
 
 .MAKE: install-am install-strip
 
-.PHONY: all all-am check check-am clean clean-generic distclean \
-	distclean-generic distdir dvi dvi-am html html-am info info-am \
-	install install-am install-data install-data-am \
-	install-dist_exampleDATA install-dist_exampleSCRIPTS \
-	install-dist_gdataDATA install-dvi install-dvi-am install-exec \
-	install-exec-am install-html install-html-am install-info \
-	install-info-am install-man install-pdf install-pdf-am \
-	install-ps install-ps-am install-strip installcheck \
-	installcheck-am installdirs maintainer-clean \
-	maintainer-clean-generic mostlyclean mostlyclean-generic pdf \
-	pdf-am ps ps-am uninstall uninstall-am \
-	uninstall-dist_exampleDATA uninstall-dist_exampleSCRIPTS \
-	uninstall-dist_gdataDATA
+.PHONY: all all-am check check-am clean clean-generic cscopelist-am \
+	ctags-am distclean distclean-generic distdir dvi dvi-am html \
+	html-am info info-am install install-am install-data \
+	install-data-am install-dist_exampleDATA \
+	install-dist_exampleSCRIPTS install-dist_gdataDATA install-dvi \
+	install-dvi-am install-exec install-exec-am install-html \
+	install-html-am install-info install-info-am install-man \
+	install-pdf install-pdf-am install-ps install-ps-am \
+	install-strip installcheck installcheck-am installdirs \
+	maintainer-clean maintainer-clean-generic mostlyclean \
+	mostlyclean-generic pdf pdf-am ps ps-am tags-am uninstall \
+	uninstall-am uninstall-dist_exampleDATA \
+	uninstall-dist_exampleSCRIPTS uninstall-dist_gdataDATA
 
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
diff --git a/examples/example_bt.sh b/examples/example_bt.sh
index e70244a..36281b0 100755
--- a/examples/example_bt.sh
+++ b/examples/example_bt.sh
@@ -15,9 +15,9 @@ padir="../src/"
 # Using text-based dosage genotype files as input
 ${padir}palogist \
     -p logist_data.txt \
-    -d ${inputdir}/test.mldose \
-    -i ${inputdir}/test.mlinfo \
-    -m ${inputdir}/test.map \
+    -d ${gtdatadir}/test.mldose \
+    -i ${gtdatadir}/test.mlinfo \
+    -m ${gtdatadir}/test.map \
     -c 19 \
     -o logist
 
@@ -25,9 +25,9 @@ ${padir}palogist \
 # Using filevector (DatABEL) files as dosage genotype input
 ${padir}palogist \
     -p logist_data.txt \
-    -d ${inputdir}/test.dose.fvi \
-    -i ${inputdir}/test.mlinfo \
-    -m ${inputdir}/test.map \
+    -d ${gtdatadir}/test.dose.fvi \
+    -i ${gtdatadir}/test.mlinfo \
+    -m ${gtdatadir}/test.map \
     -c 19 \
     -o logist_fv
 
@@ -35,9 +35,9 @@ ${padir}palogist \
 # Using text-based probability files as genotype input
 ${padir}palogist \
     -p logist_data.txt \
-    -d ${inputdir}/test.mlprob \
-    -i ${inputdir}/test.mlinfo \
-    -m ${inputdir}/test.map \
+    -d ${gtdatadir}/test.mlprob \
+    -i ${gtdatadir}/test.mlinfo \
+    -m ${gtdatadir}/test.map \
     --ngpreds=2 \
     -c 19 \
     -o logist_prob
@@ -46,9 +46,9 @@ ${padir}palogist \
 # Using filevector (DatABEL) probability files as genotype input
 ${padir}palogist \
     -p logist_data.txt \
-    -d ${inputdir}/test.prob.fvi \
-    -i ${inputdir}/test.mlinfo \
-    -m ${inputdir}/test.map \
+    -d ${gtdatadir}/test.prob.fvi \
+    -i ${gtdatadir}/test.mlinfo \
+    -m ${gtdatadir}/test.map \
     --ngpreds=2 \
     -c 19 \
     -o logist_prob_fv
diff --git a/examples/example_cox.sh b/examples/example_cox.sh
index 3f164cc..ad62aa0 100755
--- a/examples/example_cox.sh
+++ b/examples/example_cox.sh
@@ -14,9 +14,9 @@ padir="../src/"
 # Using text-based dosage genotype files as input
 ${padir}pacoxph \
     -p coxph_data.txt \
-    -d ${inputdir}/test.mldose \
-    -i ${inputdir}/test.mlinfo \
-    -m ${inputdir}/test.map \
+    -d ${gtdatadir}/test.mldose \
+    -i ${gtdatadir}/test.mlinfo \
+    -m ${gtdatadir}/test.map \
     -c 19 \
     -o coxph_dose
 
@@ -24,9 +24,9 @@ ${padir}pacoxph \
 # Using filevector (DatABEL) files as dosage genotype input
 ${padir}pacoxph \
     -p coxph_data.txt \
-    -d ${inputdir}/test.dose.fvi \
-    -i ${inputdir}/test.mlinfo \
-    -m ${inputdir}/test.map \
+    -d ${gtdatadir}/test.dose.fvi \
+    -i ${gtdatadir}/test.mlinfo \
+    -m ${gtdatadir}/test.map \
     -c 19 \
     -o coxph_dose_fv
 
@@ -34,9 +34,9 @@ ${padir}pacoxph \
 # Using text-based probability files as genotype input
 ${padir}pacoxph \
     -p coxph_data.txt \
-    -d ${inputdir}/test.mlprob \
-    -i ${inputdir}/test.mlinfo \
-    -m ${inputdir}/test.map \
+    -d ${gtdatadir}/test.mlprob \
+    -i ${gtdatadir}/test.mlinfo \
+    -m ${gtdatadir}/test.map \
     --ngpreds=2 \
     -c 19 \
     -o coxph_prob
@@ -45,9 +45,9 @@ ${padir}pacoxph \
 # Using filevector (DatABEL) probability files as genotype input
 ${padir}pacoxph \
     -p coxph_data.txt \
-    -d ${inputdir}/test.prob.fvi \
-    -i ${inputdir}/test.mlinfo \
-    -m ${inputdir}/test.map \
+    -d ${gtdatadir}/test.prob.fvi \
+    -i ${gtdatadir}/test.mlinfo \
+    -m ${gtdatadir}/test.map \
     --ngpreds=2 \
     -c 19 \
     -o coxph_prob_fv
diff --git a/examples/example_qt.sh b/examples/example_qt.sh
index be49c40..7c2e25b 100755
--- a/examples/example_qt.sh
+++ b/examples/example_qt.sh
@@ -16,9 +16,9 @@ padir="${padir}"
 echo "basic analysis"
 ${padir}palinear \
     -p height.txt \
-    -d ${inputdir}/test.mldose \
-    -i ${inputdir}/test.mlinfo \
-    -m ${inputdir}/test.map \
+    -d ${gtdatadir}/test.mldose \
+    -i ${gtdatadir}/test.mlinfo \
+    -m ${gtdatadir}/test.map \
     -c 19 \
     -o height_base
 
@@ -26,9 +26,9 @@ ${padir}palinear \
 # Using filevector (DatABEL) files as dosage genotype input
 ${padir}palinear \
     -p height.txt \
-    -d ${inputdir}/test.dose.fvi \
-    -i ${inputdir}/test.mlinfo \
-    -m ${inputdir}/test.map \
+    -d ${gtdatadir}/test.dose.fvi \
+    -i ${gtdatadir}/test.mlinfo \
+    -m ${gtdatadir}/test.map \
     -c 19 \
     -o height_base_fv
 
@@ -36,9 +36,9 @@ ${padir}palinear \
 echo "Option --allcov"
 ${padir}palinear \
     -p height.txt \
-    -d ${inputdir}/test.dose.fvi \
-    -i ${inputdir}/test.mlinfo \
-    -m ${inputdir}/test.map \
+    -d ${gtdatadir}/test.dose.fvi \
+    -i ${gtdatadir}/test.mlinfo \
+    -m ${gtdatadir}/test.map \
     -c 19 --allcov \
     -o height_allcov_fv
 
@@ -46,9 +46,9 @@ ${padir}palinear \
 echo "Option --interaction=1"
 ${padir}palinear \
     -p height.txt \
-    -d ${inputdir}/test.dose.fvi \
-    -i ${inputdir}/test.mlinfo \
-    -m ${inputdir}/test.map \
+    -d ${gtdatadir}/test.dose.fvi \
+    -i ${gtdatadir}/test.mlinfo \
+    -m ${gtdatadir}/test.map \
     -c 19 --interaction=1 \
     -o height_int1_fv
 
@@ -56,9 +56,9 @@ ${padir}palinear \
 echo "Option --robust"
 ${padir}palinear \
     -p height.txt \
-    -d ${inputdir}/test.dose.fvi \
-    -i ${inputdir}/test.mlinfo \
-    -m ${inputdir}/test.map \
+    -d ${gtdatadir}/test.dose.fvi \
+    -i ${gtdatadir}/test.mlinfo \
+    -m ${gtdatadir}/test.map \
     -c 19 --robust \
     -o height_robust_fv
 
@@ -66,9 +66,9 @@ ${padir}palinear \
 echo "Option --robust --interaction=1"
 ${padir}palinear \
     -p height.txt \
-    -d ${inputdir}/test.dose.fvi \
-    -i ${inputdir}/test.mlinfo \
-    -m ${inputdir}/test.map \
+    -d ${gtdatadir}/test.dose.fvi \
+    -i ${gtdatadir}/test.mlinfo \
+    -m ${gtdatadir}/test.map \
     -c 19 --robust --interaction=1 \
     -o height_robust_int1_fv
 
@@ -77,9 +77,9 @@ ${padir}palinear \
 echo "Option --ngp=2, mlprob file"
 ${padir}palinear \
     -p height.txt \
-    -d ${inputdir}/test.mlprob \
-    -i ${inputdir}/test.mlinfo \
-    -m ${inputdir}/test.map \
+    -d ${gtdatadir}/test.mlprob \
+    -i ${gtdatadir}/test.mlinfo \
+    -m ${gtdatadir}/test.map \
     -c 19 --ngp=2 \
     -o height_ngp2
 
@@ -87,9 +87,9 @@ ${padir}palinear \
 # Using filevector (DatABEL) probability files as genotype input
 ${padir}palinear \
     -p height.txt \
-    -d ${inputdir}/test.prob.fvi \
-    -i ${inputdir}/test.mlinfo \
-    -m ${inputdir}/test.map \
+    -d ${gtdatadir}/test.prob.fvi \
+    -i ${gtdatadir}/test.mlinfo \
+    -m ${gtdatadir}/test.map \
     -c 19 --ngp=2 \
     -o height_ngp2_fv
 
@@ -97,9 +97,9 @@ ${padir}palinear \
 echo "Option --ngp=2 --allcov"
 ${padir}palinear \
     -p height.txt \
-    -d ${inputdir}/test.prob.fvi \
-    -i ${inputdir}/test.mlinfo \
-    -m ${inputdir}/test.map \
+    -d ${gtdatadir}/test.prob.fvi \
+    -i ${gtdatadir}/test.mlinfo \
+    -m ${gtdatadir}/test.map \
     -c 19 --ngp=2 --allcov \
     -o height_ngp2_allcov_fv
 
@@ -107,9 +107,9 @@ ${padir}palinear \
 echo "Option --ngp=2 --interaction=1"
 ${padir}palinear \
     -p height.txt \
-    -d ${inputdir}/test.prob.fvi \
-    -i ${inputdir}/test.mlinfo \
-    -m ${inputdir}/test.map \
+    -d ${gtdatadir}/test.prob.fvi \
+    -i ${gtdatadir}/test.mlinfo \
+    -m ${gtdatadir}/test.map \
     -c 19 --ngp=2 --interaction=1 \
     -o height_ngp2_int1_fv
 
@@ -117,9 +117,9 @@ ${padir}palinear \
 echo "Option --ngp=2 --robust"
 ${padir}palinear \
     -p height.txt \
-    -d ${inputdir}/test.prob.fvi \
-    -i ${inputdir}/test.mlinfo \
-    -m ${inputdir}/test.map \
+    -d ${gtdatadir}/test.prob.fvi \
+    -i ${gtdatadir}/test.mlinfo \
+    -m ${gtdatadir}/test.map \
     -c 19 --ngp=2 --robust \
     -o height_ngp2_robust_fv
 
@@ -127,8 +127,8 @@ ${padir}palinear \
 echo "Option --ngp=2 --robust --interaction=1"
 ${padir}palinear \
     -p height.txt \
-    -d ${inputdir}/test.prob.fvi \
-    -i ${inputdir}/test.mlinfo \
-    -m ${inputdir}/test.map \
+    -d ${gtdatadir}/test.prob.fvi \
+    -i ${gtdatadir}/test.mlinfo \
+    -m ${gtdatadir}/test.map \
     -c 19 --ngp=2 --robust --interaction=1 \
     -o height_ngp2_robust_int1_fv
diff --git a/missing b/missing
index 28055d2..cdea514 100755
--- a/missing
+++ b/missing
@@ -1,11 +1,10 @@
 #! /bin/sh
-# Common stub for a few missing GNU programs while installing.
+# Common wrapper for a few potentially missing GNU programs.
 
-scriptversion=2009-04-28.21; # UTC
+scriptversion=2012-06-26.16; # UTC
 
-# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006,
-# 2008, 2009 Free Software Foundation, Inc.
-# Originally by Fran,cois Pinard <pinard at iro.umontreal.ca>, 1996.
+# Copyright (C) 1996-2013 Free Software Foundation, Inc.
+# Originally written by Fran,cois Pinard <pinard at iro.umontreal.ca>, 1996.
 
 # 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
@@ -26,69 +25,40 @@ scriptversion=2009-04-28.21; # UTC
 # the same distribution terms that you use for the rest of that program.
 
 if test $# -eq 0; then
-  echo 1>&2 "Try \`$0 --help' for more information"
+  echo 1>&2 "Try '$0 --help' for more information"
   exit 1
 fi
 
-run=:
-sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
-sed_minuso='s/.* -o \([^ ]*\).*/\1/p'
-
-# In the cases where this matters, `missing' is being run in the
-# srcdir already.
-if test -f configure.ac; then
-  configure_ac=configure.ac
-else
-  configure_ac=configure.in
-fi
+case $1 in
 
-msg="missing on your system"
+  --is-lightweight)
+    # Used by our autoconf macros to check whether the available missing
+    # script is modern enough.
+    exit 0
+    ;;
 
-case $1 in
---run)
-  # Try to run requested program, and just exit if it succeeds.
-  run=
-  shift
-  "$@" && exit 0
-  # Exit code 63 means version mismatch.  This often happens
-  # when the user try to use an ancient version of a tool on
-  # a file that requires a minimum version.  In this case we
-  # we should proceed has if the program had been absent, or
-  # if --run hadn't been passed.
-  if test $? = 63; then
-    run=:
-    msg="probably too old"
-  fi
-  ;;
+  --run)
+    # Back-compat with the calling convention used by older automake.
+    shift
+    ;;
 
   -h|--h|--he|--hel|--help)
     echo "\
 $0 [OPTION]... PROGRAM [ARGUMENT]...
 
-Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
-error status if there is no known handling for PROGRAM.
+Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due
+to PROGRAM being missing or too old.
 
 Options:
   -h, --help      display this help and exit
   -v, --version   output version information and exit
-  --run           try to run the given command, and emulate it if it fails
 
 Supported PROGRAM values:
-  aclocal      touch file \`aclocal.m4'
-  autoconf     touch file \`configure'
-  autoheader   touch file \`config.h.in'
-  autom4te     touch the output file, or create a stub one
-  automake     touch all \`Makefile.in' files
-  bison        create \`y.tab.[ch]', if possible, from existing .[ch]
-  flex         create \`lex.yy.c', if possible, from existing .c
-  help2man     touch the output file
-  lex          create \`lex.yy.c', if possible, from existing .c
-  makeinfo     touch the output file
-  tar          try tar, gnutar, gtar, then tar without non-portable flags
-  yacc         create \`y.tab.[ch]', if possible, from existing .[ch]
+  aclocal   autoconf  autoheader   autom4te  automake  makeinfo
+  bison     yacc      flex         lex       help2man
 
-Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and
-\`g' are ignored when checking the name.
+Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and
+'g' are ignored when checking the name.
 
 Send bug reports to <bug-automake at gnu.org>."
     exit $?
@@ -100,272 +70,141 @@ Send bug reports to <bug-automake at gnu.org>."
     ;;
 
   -*)
-    echo 1>&2 "$0: Unknown \`$1' option"
-    echo 1>&2 "Try \`$0 --help' for more information"
+    echo 1>&2 "$0: unknown '$1' option"
+    echo 1>&2 "Try '$0 --help' for more information"
     exit 1
     ;;
 
 esac
 
-# normalize program name to check for.
-program=`echo "$1" | sed '
-  s/^gnu-//; t
-  s/^gnu//; t
-  s/^g//; t'`
-
-# Now exit if we have it, but it failed.  Also exit now if we
-# don't have it and --version was passed (most likely to detect
-# the program).  This is about non-GNU programs, so use $1 not
-# $program.
-case $1 in
-  lex*|yacc*)
-    # Not GNU programs, they don't have --version.
-    ;;
-
-  tar*)
-    if test -n "$run"; then
-       echo 1>&2 "ERROR: \`tar' requires --run"
-       exit 1
-    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
-       exit 1
-    fi
-    ;;
-
-  *)
-    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
-       # We have it, but it failed.
-       exit 1
-    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
-       # Could not run --version or --help.  This is probably someone
-       # running `$TOOL --version' or `$TOOL --help' to check whether
-       # $TOOL exists and not knowing $TOOL uses missing.
-       exit 1
-    fi
-    ;;
-esac
-
-# If it does not exist, or fails to run (possibly an outdated version),
-# try to emulate it.
-case $program in
-  aclocal*)
-    echo 1>&2 "\
-WARNING: \`$1' is $msg.  You should only need it if
-         you modified \`acinclude.m4' or \`${configure_ac}'.  You might want
-         to install the \`Automake' and \`Perl' packages.  Grab them from
-         any GNU archive site."
-    touch aclocal.m4
-    ;;
-
-  autoconf*)
-    echo 1>&2 "\
-WARNING: \`$1' is $msg.  You should only need it if
-         you modified \`${configure_ac}'.  You might want to install the
-         \`Autoconf' and \`GNU m4' packages.  Grab them from any GNU
-         archive site."
-    touch configure
-    ;;
-
-  autoheader*)
-    echo 1>&2 "\
-WARNING: \`$1' is $msg.  You should only need it if
-         you modified \`acconfig.h' or \`${configure_ac}'.  You might want
-         to install the \`Autoconf' and \`GNU m4' packages.  Grab them
-         from any GNU archive site."
-    files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
-    test -z "$files" && files="config.h"
-    touch_files=
-    for f in $files; do
-      case $f in
-      *:*) touch_files="$touch_files "`echo "$f" |
-				       sed -e 's/^[^:]*://' -e 's/:.*//'`;;
-      *) touch_files="$touch_files $f.in";;
-      esac
-    done
-    touch $touch_files
-    ;;
-
-  automake*)
-    echo 1>&2 "\
-WARNING: \`$1' is $msg.  You should only need it if
-         you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
-         You might want to install the \`Automake' and \`Perl' packages.
-         Grab them from any GNU archive site."
-    find . -type f -name Makefile.am -print |
-	   sed 's/\.am$/.in/' |
-	   while read f; do touch "$f"; done
-    ;;
-
-  autom4te*)
-    echo 1>&2 "\
-WARNING: \`$1' is needed, but is $msg.
-         You might have modified some files without having the
-         proper tools for further handling them.
-         You can get \`$1' as part of \`Autoconf' from any GNU
-         archive site."
-
-    file=`echo "$*" | sed -n "$sed_output"`
-    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
-    if test -f "$file"; then
-	touch $file
-    else
-	test -z "$file" || exec >$file
-	echo "#! /bin/sh"
-	echo "# Created by GNU Automake missing as a replacement of"
-	echo "#  $ $@"
-	echo "exit 0"
-	chmod +x $file
-	exit 1
-    fi
-    ;;
-
-  bison*|yacc*)
-    echo 1>&2 "\
-WARNING: \`$1' $msg.  You should only need it if
-         you modified a \`.y' file.  You may need the \`Bison' package
-         in order for those modifications to take effect.  You can get
-         \`Bison' from any GNU archive site."
-    rm -f y.tab.c y.tab.h
-    if test $# -ne 1; then
-        eval LASTARG="\${$#}"
-	case $LASTARG in
-	*.y)
-	    SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
-	    if test -f "$SRCFILE"; then
-	         cp "$SRCFILE" y.tab.c
-	    fi
-	    SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
-	    if test -f "$SRCFILE"; then
-	         cp "$SRCFILE" y.tab.h
-	    fi
-	  ;;
-	esac
-    fi
-    if test ! -f y.tab.h; then
-	echo >y.tab.h
-    fi
-    if test ! -f y.tab.c; then
-	echo 'main() { return 0; }' >y.tab.c
-    fi
-    ;;
-
-  lex*|flex*)
-    echo 1>&2 "\
-WARNING: \`$1' is $msg.  You should only need it if
-         you modified a \`.l' file.  You may need the \`Flex' package
-         in order for those modifications to take effect.  You can get
-         \`Flex' from any GNU archive site."
-    rm -f lex.yy.c
-    if test $# -ne 1; then
-        eval LASTARG="\${$#}"
-	case $LASTARG in
-	*.l)
-	    SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
-	    if test -f "$SRCFILE"; then
-	         cp "$SRCFILE" lex.yy.c
-	    fi
-	  ;;
-	esac
-    fi
-    if test ! -f lex.yy.c; then
-	echo 'main() { return 0; }' >lex.yy.c
-    fi
-    ;;
-
-  help2man*)
-    echo 1>&2 "\
-WARNING: \`$1' is $msg.  You should only need it if
-	 you modified a dependency of a manual page.  You may need the
-	 \`Help2man' package in order for those modifications to take
-	 effect.  You can get \`Help2man' from any GNU archive site."
-
-    file=`echo "$*" | sed -n "$sed_output"`
-    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
-    if test -f "$file"; then
-	touch $file
-    else
-	test -z "$file" || exec >$file
-	echo ".ab help2man is required to generate this page"
-	exit $?
-    fi
-    ;;
-
-  makeinfo*)
-    echo 1>&2 "\
-WARNING: \`$1' is $msg.  You should only need it if
-         you modified a \`.texi' or \`.texinfo' file, or any other file
-         indirectly affecting the aspect of the manual.  The spurious
-         call might also be the consequence of using a buggy \`make' (AIX,
-         DU, IRIX).  You might want to install the \`Texinfo' package or
-         the \`GNU make' package.  Grab either from any GNU archive site."
-    # The file to touch is that specified with -o ...
-    file=`echo "$*" | sed -n "$sed_output"`
-    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
-    if test -z "$file"; then
-      # ... or it is the one specified with @setfilename ...
-      infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
-      file=`sed -n '
-	/^@setfilename/{
-	  s/.* \([^ ]*\) *$/\1/
-	  p
-	  q
-	}' $infile`
-      # ... or it is derived from the source name (dir/f.texi becomes f.info)
-      test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
-    fi
-    # If the file does not exist, the user really needs makeinfo;
-    # let's fail without touching anything.
-    test -f $file || exit 1
-    touch $file
-    ;;
-
-  tar*)
-    shift
-
-    # We have already tried tar in the generic part.
-    # Look for gnutar/gtar before invocation to avoid ugly error
-    # messages.
-    if (gnutar --version > /dev/null 2>&1); then
-       gnutar "$@" && exit 0
-    fi
-    if (gtar --version > /dev/null 2>&1); then
-       gtar "$@" && exit 0
-    fi
-    firstarg="$1"
-    if shift; then
-	case $firstarg in
-	*o*)
-	    firstarg=`echo "$firstarg" | sed s/o//`
-	    tar "$firstarg" "$@" && exit 0
-	    ;;
-	esac
-	case $firstarg in
-	*h*)
-	    firstarg=`echo "$firstarg" | sed s/h//`
-	    tar "$firstarg" "$@" && exit 0
-	    ;;
-	esac
-    fi
-
-    echo 1>&2 "\
-WARNING: I can't seem to be able to run \`tar' with the given arguments.
-         You may want to install GNU tar or Free paxutils, or check the
-         command line arguments."
-    exit 1
-    ;;
-
-  *)
-    echo 1>&2 "\
-WARNING: \`$1' is needed, and is $msg.
-         You might have modified some files without having the
-         proper tools for further handling them.  Check the \`README' file,
-         it often tells you about the needed prerequisites for installing
-         this package.  You may also peek at any GNU archive site, in case
-         some other package would contain this missing \`$1' program."
-    exit 1
-    ;;
-esac
+# Run the given program, remember its exit status.
+"$@"; st=$?
+
+# If it succeeded, we are done.
+test $st -eq 0 && exit 0
+
+# Also exit now if we it failed (or wasn't found), and '--version' was
+# passed; such an option is passed most likely to detect whether the
+# program is present and works.
+case $2 in --version|--help) exit $st;; esac
+
+# Exit code 63 means version mismatch.  This often happens when the user
+# tries to use an ancient version of a tool on a file that requires a
+# minimum version.
+if test $st -eq 63; then
+  msg="probably too old"
+elif test $st -eq 127; then
+  # Program was missing.
+  msg="missing on your system"
+else
+  # Program was found and executed, but failed.  Give up.
+  exit $st
+fi
 
-exit 0
+perl_URL=http://www.perl.org/
+flex_URL=http://flex.sourceforge.net/
+gnu_software_URL=http://www.gnu.org/software
+
+program_details ()
+{
+  case $1 in
+    aclocal|automake)
+      echo "The '$1' program is part of the GNU Automake package:"
+      echo "<$gnu_software_URL/automake>"
+      echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:"
+      echo "<$gnu_software_URL/autoconf>"
+      echo "<$gnu_software_URL/m4/>"
+      echo "<$perl_URL>"
+      ;;
+    autoconf|autom4te|autoheader)
+      echo "The '$1' program is part of the GNU Autoconf package:"
+      echo "<$gnu_software_URL/autoconf/>"
+      echo "It also requires GNU m4 and Perl in order to run:"
+      echo "<$gnu_software_URL/m4/>"
+      echo "<$perl_URL>"
+      ;;
+  esac
+}
+
+give_advice ()
+{
+  # Normalize program name to check for.
+  normalized_program=`echo "$1" | sed '
+    s/^gnu-//; t
+    s/^gnu//; t
+    s/^g//; t'`
+
+  printf '%s\n' "'$1' is $msg."
+
+  configure_deps="'configure.ac' or m4 files included by 'configure.ac'"
+  case $normalized_program in
+    autoconf*)
+      echo "You should only need it if you modified 'configure.ac',"
+      echo "or m4 files included by it."
+      program_details 'autoconf'
+      ;;
+    autoheader*)
+      echo "You should only need it if you modified 'acconfig.h' or"
+      echo "$configure_deps."
+      program_details 'autoheader'
+      ;;
+    automake*)
+      echo "You should only need it if you modified 'Makefile.am' or"
+      echo "$configure_deps."
+      program_details 'automake'
+      ;;
+    aclocal*)
+      echo "You should only need it if you modified 'acinclude.m4' or"
+      echo "$configure_deps."
+      program_details 'aclocal'
+      ;;
+   autom4te*)
+      echo "You might have modified some maintainer files that require"
+      echo "the 'automa4te' program to be rebuilt."
+      program_details 'autom4te'
+      ;;
+    bison*|yacc*)
+      echo "You should only need it if you modified a '.y' file."
+      echo "You may want to install the GNU Bison package:"
+      echo "<$gnu_software_URL/bison/>"
+      ;;
+    lex*|flex*)
+      echo "You should only need it if you modified a '.l' file."
+      echo "You may want to install the Fast Lexical Analyzer package:"
+      echo "<$flex_URL>"
+      ;;
+    help2man*)
+      echo "You should only need it if you modified a dependency" \
+           "of a man page."
+      echo "You may want to install the GNU Help2man package:"
+      echo "<$gnu_software_URL/help2man/>"
+    ;;
+    makeinfo*)
+      echo "You should only need it if you modified a '.texi' file, or"
+      echo "any other file indirectly affecting the aspect of the manual."
+      echo "You might want to install the Texinfo package:"
+      echo "<$gnu_software_URL/texinfo/>"
+      echo "The spurious makeinfo call might also be the consequence of"
+      echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might"
+      echo "want to install GNU make:"
+      echo "<$gnu_software_URL/make/>"
+      ;;
+    *)
+      echo "You might have modified some files without having the proper"
+      echo "tools for further handling them.  Check the 'README' file, it"
+      echo "often tells you about the needed prerequisites for installing"
+      echo "this package.  You may also peek at any GNU archive site, in"
+      echo "case some other package contains this missing '$1' program."
+      ;;
+  esac
+}
+
+give_advice "$1" | sed -e '1s/^/WARNING: /' \
+                       -e '2,$s/^/         /' >&2
+
+# Propagate the correct exit status (expected to be 127 for a program
+# not found, 63 for a program that failed due to version mismatch).
+exit $st
 
 # Local variables:
 # eval: (add-hook 'write-file-hooks 'time-stamp)
diff --git a/src/Makefile.am b/src/Makefile.am
index c541869..2d1ceaf 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -7,7 +7,7 @@ REGFILES = data.h data.cpp gendata.h gendata.cpp mematrix.h mematri1.h	\
  command_line_settings.h command_line_settings.cpp reg1.h usage.h		\
  usage.cpp main.cpp utilities.h utilities.cpp phedata.h phedata.cpp	\
  cholesky.h cholesky.cpp regdata.h regdata.cpp  \
- maskedmatrix.cpp maskedmatrix.h reg1.cpp
+ maskedmatrix.cpp maskedmatrix.h reg1.cpp main_functions_dump.h main_functions_dump.cpp
 
 EIGENFILES = eigen_mematrix.h eigen_mematrix.cpp
 
@@ -30,7 +30,7 @@ RHEADERS = include/R.h include/Rmath.h include/R_ext/Arith.h		\
  include/R_ext/Print.h include/R_ext/Random.h include/R_ext/Utils.h	\
  include/R_ext/RS.h
 
-bin_PROGRAMS = extract-snp
+bin_PROGRAMS =
 if BUILD_palinear
 bin_PROGRAMS += palinear
 endif
@@ -46,6 +46,11 @@ COXSRC = $(COXBASE:=.c)
 bin_PROGRAMS += pacoxph
 endif
 
+if BUILD_extractsnp
+bin_PROGRAMS += extract-snp
+endif
+
+
 palinear_SOURCES = $(REGFILES) $(FVSRC) $(FVHEADERS)
 palinear_CXXFLAGS = -DLINEAR $(AM_CXXFLAGS)
 palinear_CPPFLAGS = $(AM_CPPFLAGS)
@@ -75,18 +80,24 @@ endif
 extract_snp_SOURCES = extract-snp.cpp $(FVSRC) $(FVHEADERS)
 
 ## Install these scripts in the bin directory as well:
-dist_bin_SCRIPTS = probabel.pl extIDS.pl
+dist_bin_SCRIPTS = probabel
 
 ## Install this R script in the examples directory
 scriptdir = $(pkgdatadir)/scripts
-dist_script_DATA = prepare_data.R
+dist_script_DATA = prepare_data.R extIDS.pl
 
 ## Install the config file
 dist_sysconf_DATA = probabel_config.cfg.example
 
-## Insert the correct values of several variables in the installed probabel.pl
+## Insert the correct values of several variables in the installed
+## probabel script
 install-exec-hook:
 	$(SED) -i "s;probabel_config.cfg;@sysconfdir@/probabel_config.cfg;" \
-		$(DESTDIR)$(bindir)/probabel.pl
-	$(SED) -i "s;\./;@bindir@/;" $(DESTDIR)$(bindir)/probabel.pl
-	$(SED) -i "s;PROBABEL_VERSION;@VERSION@;" $(DESTDIR)$(bindir)/probabel.pl
+		$(DESTDIR)$(bindir)/probabel
+	$(SED) -i "s;\./;@bindir@/;" $(DESTDIR)$(bindir)/probabel
+	$(SED) -i "s;PROBABEL_VERSION;@VERSION@;" $(DESTDIR)$(bindir)/probabel
+	ln -s $(DESTDIR)$(bindir)/probabel $(DESTDIR)$(bindir)/probabel.pl
+
+## Make the script executable
+install-data-hook:
+	chmod a+rx $(DESTDIR)/$(scriptdir)/extIDS.pl
diff --git a/src/Makefile.in b/src/Makefile.in
index e16ac7b..c649499 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -1,9 +1,8 @@
-# Makefile.in generated by automake 1.11.6 from Makefile.am.
+# Makefile.in generated by automake 1.13.3 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# Copyright (C) 1994-2013 Free Software Foundation, Inc.
+
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -18,23 +17,51 @@
 
 
 VPATH = @srcdir@
-am__make_dryrun = \
-  { \
-    am__dry=no; \
+am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
+am__make_running_with_option = \
+  case $${target_option-} in \
+      ?) ;; \
+      *) echo "am__make_running_with_option: internal error: invalid" \
+              "target option '$${target_option-}' specified" >&2; \
+         exit 1;; \
+  esac; \
+  has_opt=no; \
+  sane_makeflags=$$MAKEFLAGS; \
+  if $(am__is_gnu_make); then \
+    sane_makeflags=$$MFLAGS; \
+  else \
     case $$MAKEFLAGS in \
       *\\[\ \	]*) \
-        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
-          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
-      *) \
-        for am__flg in $$MAKEFLAGS; do \
-          case $$am__flg in \
-            *=*|--*) ;; \
-            *n*) am__dry=yes; break;; \
-          esac; \
-        done;; \
+        bs=\\; \
+        sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+          | sed "s/$$bs$$bs[$$bs $$bs	]*//g"`;; \
     esac; \
-    test $$am__dry = yes; \
-  }
+  fi; \
+  skip_next=no; \
+  strip_trailopt () \
+  { \
+    flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+  }; \
+  for flg in $$sane_makeflags; do \
+    test $$skip_next = yes && { skip_next=no; continue; }; \
+    case $$flg in \
+      *=*|--*) continue;; \
+        -*I) strip_trailopt 'I'; skip_next=yes;; \
+      -*I?*) strip_trailopt 'I';; \
+        -*O) strip_trailopt 'O'; skip_next=yes;; \
+      -*O?*) strip_trailopt 'O';; \
+        -*l) strip_trailopt 'l'; skip_next=yes;; \
+      -*l?*) strip_trailopt 'l';; \
+      -[dEDm]) skip_next=yes;; \
+      -[JT]) skip_next=yes;; \
+    esac; \
+    case $$flg in \
+      *$$target_option*) has_opt=yes; break;; \
+    esac; \
+  done; \
+  test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
 pkgdatadir = $(datadir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
@@ -51,21 +78,22 @@ POST_INSTALL = :
 NORMAL_UNINSTALL = :
 PRE_UNINSTALL = :
 POST_UNINSTALL = :
-bin_PROGRAMS = extract-snp$(EXEEXT) $(am__EXEEXT_1) $(am__EXEEXT_2) \
-	$(am__EXEEXT_3)
+bin_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \
+	$(am__EXEEXT_4)
 @BUILD_palinear_TRUE at am__append_1 = palinear
 @BUILD_palogist_TRUE at am__append_2 = palogist
 @BUILD_pacoxph_TRUE at am__append_3 = pacoxph
- at WITH_EIGEN_TRUE@am__append_4 = $(EIGENFILES)
- at WITH_EIGEN_TRUE@am__append_5 = -DEIGEN
- at WITH_EIGEN_TRUE@am__append_6 = $(EIGENFILES)
- at WITH_EIGEN_TRUE@am__append_7 = -DEIGEN
- at WITH_EIGEN_TRUE@am__append_8 = $(EIGENFILES)
- at WITH_EIGEN_TRUE@am__append_9 = -DEIGEN
+ at BUILD_extractsnp_TRUE@am__append_4 = extract-snp
+ at WITH_EIGEN_TRUE@am__append_5 = $(EIGENFILES)
+ at WITH_EIGEN_TRUE@am__append_6 = -DEIGEN
+ at WITH_EIGEN_TRUE@am__append_7 = $(EIGENFILES)
+ at WITH_EIGEN_TRUE@am__append_8 = -DEIGEN
+ at WITH_EIGEN_TRUE@am__append_9 = $(EIGENFILES)
+ at WITH_EIGEN_TRUE@am__append_10 = -DEIGEN
 subdir = src
-DIST_COMMON = $(dist_bin_SCRIPTS) $(dist_script_DATA) \
-	$(dist_sysconf_DATA) $(srcdir)/Makefile.am \
-	$(srcdir)/Makefile.in $(srcdir)/config.h.in
+DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
+	$(srcdir)/config.h.in $(dist_bin_SCRIPTS) \
+	$(top_srcdir)/depcomp $(dist_script_DATA) $(dist_sysconf_DATA)
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
@@ -77,6 +105,7 @@ CONFIG_CLEAN_VPATH_FILES =
 @BUILD_palinear_TRUE at am__EXEEXT_1 = palinear$(EXEEXT)
 @BUILD_palogist_TRUE at am__EXEEXT_2 = palogist$(EXEEXT)
 @BUILD_pacoxph_TRUE at am__EXEEXT_3 = pacoxph$(EXEEXT)
+ at BUILD_extractsnp_TRUE@am__EXEEXT_4 = extract-snp$(EXEEXT)
 am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(bindir)" \
 	"$(DESTDIR)$(scriptdir)" "$(DESTDIR)$(sysconfdir)"
 PROGRAMS = $(bin_PROGRAMS)
@@ -96,6 +125,7 @@ am__pacoxph_SOURCES_DIST = coxfit2.c chinv2.c cholesky2.c chsolve2.c \
 	reg1.h usage.h usage.cpp main.cpp utilities.h utilities.cpp \
 	phedata.h phedata.cpp cholesky.h cholesky.cpp regdata.h \
 	regdata.cpp maskedmatrix.cpp maskedmatrix.h reg1.cpp \
+	main_functions_dump.h main_functions_dump.cpp \
 	fvlib/AbstractMatrix.cpp fvlib/CastUtils.cpp \
 	fvlib/convert_util.cpp fvlib/FileVector.cpp \
 	fvlib/FilteredMatrix.cpp fvlib/frutil.cpp fvlib/Logger.cpp \
@@ -124,7 +154,8 @@ am__objects_5 = pacoxph-data.$(OBJEXT) pacoxph-gendata.$(OBJEXT) \
 	pacoxph-usage.$(OBJEXT) pacoxph-main.$(OBJEXT) \
 	pacoxph-utilities.$(OBJEXT) pacoxph-phedata.$(OBJEXT) \
 	pacoxph-cholesky.$(OBJEXT) pacoxph-regdata.$(OBJEXT) \
-	pacoxph-maskedmatrix.$(OBJEXT) pacoxph-reg1.$(OBJEXT)
+	pacoxph-maskedmatrix.$(OBJEXT) pacoxph-reg1.$(OBJEXT) \
+	pacoxph-main_functions_dump.$(OBJEXT)
 am__objects_6 = pacoxph-AbstractMatrix.$(OBJEXT) \
 	pacoxph-CastUtils.$(OBJEXT) pacoxph-convert_util.$(OBJEXT) \
 	pacoxph-FileVector.$(OBJEXT) pacoxph-FilteredMatrix.$(OBJEXT) \
@@ -146,7 +177,8 @@ am__palinear_SOURCES_DIST = data.h data.cpp gendata.h gendata.cpp \
 	command_line_settings.cpp reg1.h usage.h usage.cpp main.cpp \
 	utilities.h utilities.cpp phedata.h phedata.cpp cholesky.h \
 	cholesky.cpp regdata.h regdata.cpp maskedmatrix.cpp \
-	maskedmatrix.h reg1.cpp fvlib/AbstractMatrix.cpp \
+	maskedmatrix.h reg1.cpp main_functions_dump.h \
+	main_functions_dump.cpp fvlib/AbstractMatrix.cpp \
 	fvlib/CastUtils.cpp fvlib/convert_util.cpp \
 	fvlib/FileVector.cpp fvlib/FilteredMatrix.cpp fvlib/frutil.cpp \
 	fvlib/Logger.cpp fvlib/RealHandlerWrapper.cpp \
@@ -161,7 +193,8 @@ am__objects_9 = palinear-data.$(OBJEXT) palinear-gendata.$(OBJEXT) \
 	palinear-usage.$(OBJEXT) palinear-main.$(OBJEXT) \
 	palinear-utilities.$(OBJEXT) palinear-phedata.$(OBJEXT) \
 	palinear-cholesky.$(OBJEXT) palinear-regdata.$(OBJEXT) \
-	palinear-maskedmatrix.$(OBJEXT) palinear-reg1.$(OBJEXT)
+	palinear-maskedmatrix.$(OBJEXT) palinear-reg1.$(OBJEXT) \
+	palinear-main_functions_dump.$(OBJEXT)
 am__objects_10 = palinear-AbstractMatrix.$(OBJEXT) \
 	palinear-CastUtils.$(OBJEXT) palinear-convert_util.$(OBJEXT) \
 	palinear-FileVector.$(OBJEXT) \
@@ -183,7 +216,8 @@ am__palogist_SOURCES_DIST = data.h data.cpp gendata.h gendata.cpp \
 	command_line_settings.cpp reg1.h usage.h usage.cpp main.cpp \
 	utilities.h utilities.cpp phedata.h phedata.cpp cholesky.h \
 	cholesky.cpp regdata.h regdata.cpp maskedmatrix.cpp \
-	maskedmatrix.h reg1.cpp fvlib/AbstractMatrix.cpp \
+	maskedmatrix.h reg1.cpp main_functions_dump.h \
+	main_functions_dump.cpp fvlib/AbstractMatrix.cpp \
 	fvlib/CastUtils.cpp fvlib/convert_util.cpp \
 	fvlib/FileVector.cpp fvlib/FilteredMatrix.cpp fvlib/frutil.cpp \
 	fvlib/Logger.cpp fvlib/RealHandlerWrapper.cpp \
@@ -198,7 +232,8 @@ am__objects_13 = palogist-data.$(OBJEXT) palogist-gendata.$(OBJEXT) \
 	palogist-usage.$(OBJEXT) palogist-main.$(OBJEXT) \
 	palogist-utilities.$(OBJEXT) palogist-phedata.$(OBJEXT) \
 	palogist-cholesky.$(OBJEXT) palogist-regdata.$(OBJEXT) \
-	palogist-maskedmatrix.$(OBJEXT) palogist-reg1.$(OBJEXT)
+	palogist-maskedmatrix.$(OBJEXT) palogist-reg1.$(OBJEXT) \
+	palogist-main_functions_dump.$(OBJEXT)
 am__objects_14 = palogist-AbstractMatrix.$(OBJEXT) \
 	palogist-CastUtils.$(OBJEXT) palogist-convert_util.$(OBJEXT) \
 	palogist-FileVector.$(OBJEXT) \
@@ -243,6 +278,18 @@ am__uninstall_files_from_dir = { \
          $(am__cd) "$$dir" && rm -f $$files; }; \
   }
 SCRIPTS = $(dist_bin_SCRIPTS)
+AM_V_P = $(am__v_P_ at AM_V@)
+am__v_P_ = $(am__v_P_ at AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_ at AM_V@)
+am__v_GEN_ = $(am__v_GEN_ at AM_DEFAULT_V@)
+am__v_GEN_0 = @echo "  GEN     " $@;
+am__v_GEN_1 = 
+AM_V_at = $(am__v_at_ at AM_V@)
+am__v_at_ = $(am__v_at_ at AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 = 
 DEFAULT_INCLUDES = -I. at am__isrc@
 depcomp = $(SHELL) $(top_srcdir)/depcomp
 am__depfiles_maybe = depfiles
@@ -250,33 +297,32 @@ am__mv = mv -f
 AM_V_lt = $(am__v_lt_ at AM_V@)
 am__v_lt_ = $(am__v_lt_ at AM_DEFAULT_V@)
 am__v_lt_0 = --silent
+am__v_lt_1 = 
 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
 	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
 AM_V_CC = $(am__v_CC_ at AM_V@)
 am__v_CC_ = $(am__v_CC_ at AM_DEFAULT_V@)
-am__v_CC_0 = @echo "  CC    " $@;
-AM_V_at = $(am__v_at_ at AM_V@)
-am__v_at_ = $(am__v_at_ at AM_DEFAULT_V@)
-am__v_at_0 = @
+am__v_CC_0 = @echo "  CC      " $@;
+am__v_CC_1 = 
 CCLD = $(CC)
 LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
 AM_V_CCLD = $(am__v_CCLD_ at AM_V@)
 am__v_CCLD_ = $(am__v_CCLD_ at AM_DEFAULT_V@)
-am__v_CCLD_0 = @echo "  CCLD  " $@;
+am__v_CCLD_0 = @echo "  CCLD    " $@;
+am__v_CCLD_1 = 
 CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
 	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
 AM_V_CXX = $(am__v_CXX_ at AM_V@)
 am__v_CXX_ = $(am__v_CXX_ at AM_DEFAULT_V@)
-am__v_CXX_0 = @echo "  CXX   " $@;
+am__v_CXX_0 = @echo "  CXX     " $@;
+am__v_CXX_1 = 
 CXXLD = $(CXX)
 CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
 	-o $@
 AM_V_CXXLD = $(am__v_CXXLD_ at AM_V@)
 am__v_CXXLD_ = $(am__v_CXXLD_ at AM_DEFAULT_V@)
-am__v_CXXLD_0 = @echo "  CXXLD " $@;
-AM_V_GEN = $(am__v_GEN_ at AM_V@)
-am__v_GEN_ = $(am__v_GEN_ at AM_DEFAULT_V@)
-am__v_GEN_0 = @echo "  GEN   " $@;
+am__v_CXXLD_0 = @echo "  CXXLD   " $@;
+am__v_CXXLD_1 = 
 SOURCES = $(extract_snp_SOURCES) $(pacoxph_SOURCES) \
 	$(palinear_SOURCES) $(palogist_SOURCES)
 DIST_SOURCES = $(extract_snp_SOURCES) $(am__pacoxph_SOURCES_DIST) \
@@ -287,6 +333,24 @@ am__can_run_installinfo = \
     *) (install-info --version) >/dev/null 2>&1;; \
   esac
 DATA = $(dist_script_DATA) $(dist_sysconf_DATA)
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \
+	$(LISP)config.h.in
+# Read a list of newline-separated strings from the standard input,
+# and print each of them once, without duplicates.  Input order is
+# *not* preserved.
+am__uniquify_input = $(AWK) '\
+  BEGIN { nonempty = 0; } \
+  { items[$$0] = 1; nonempty = 1; } \
+  END { if (nonempty) { for (i in items) print i; }; } \
+'
+# Make sure the list of sources is unique.  This is necessary because,
+# e.g., the same source file might be shared among _SOURCES variables
+# for different programs/libraries.
+am__define_uniq_tagged_files = \
+  list='$(am__tagged_files)'; \
+  unique=`for i in $$list; do \
+    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+  done | $(am__uniquify_input)`
 ETAGS = etags
 CTAGS = ctags
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@@ -391,7 +455,7 @@ REGFILES = data.h data.cpp gendata.h gendata.cpp mematrix.h mematri1.h	\
  command_line_settings.h command_line_settings.cpp reg1.h usage.h		\
  usage.cpp main.cpp utilities.h utilities.cpp phedata.h phedata.cpp	\
  cholesky.h cholesky.cpp regdata.h regdata.cpp  \
- maskedmatrix.cpp maskedmatrix.h reg1.cpp
+ maskedmatrix.cpp maskedmatrix.h reg1.cpp main_functions_dump.h main_functions_dump.cpp
 
 EIGENFILES = eigen_mematrix.h eigen_mematrix.cpp
 FVSRC = fvlib/AbstractMatrix.cpp fvlib/CastUtils.cpp			\
@@ -414,23 +478,23 @@ RHEADERS = include/R.h include/Rmath.h include/R_ext/Arith.h		\
 
 @BUILD_pacoxph_TRUE at COXBASE = coxfit2 chinv2 cholesky2 chsolve2 dmatrix
 @BUILD_pacoxph_TRUE at COXSRC = $(COXBASE:=.c)
-palinear_SOURCES = $(REGFILES) $(FVSRC) $(FVHEADERS) $(am__append_4)
-palinear_CXXFLAGS = -DLINEAR $(AM_CXXFLAGS) $(am__append_5)
+palinear_SOURCES = $(REGFILES) $(FVSRC) $(FVHEADERS) $(am__append_5)
+palinear_CXXFLAGS = -DLINEAR $(AM_CXXFLAGS) $(am__append_6)
 palinear_CPPFLAGS = $(AM_CPPFLAGS)
-palogist_SOURCES = $(REGFILES) $(FVSRC) $(FVHEADERS) $(am__append_6)
-palogist_CXXFLAGS = -DLOGISTIC $(AM_CXXFLAGS) $(am__append_7)
+palogist_SOURCES = $(REGFILES) $(FVSRC) $(FVHEADERS) $(am__append_7)
+palogist_CXXFLAGS = -DLOGISTIC $(AM_CXXFLAGS) $(am__append_8)
 palogist_CPPFLAGS = $(AM_CPPFLAGS)
 pacoxph_SOURCES = $(COXSRC) $(REGFILES) $(FVSRC) $(FVHEADERS) \
 	$(RHEADERS) survS.h survproto.h coxph_data.h coxph_data.cpp \
-	$(am__append_8)
-pacoxph_CXXFLAGS = -DCOXPH -I $(top_srcdir)/src/include $(AM_CXXFLAGS) \
 	$(am__append_9)
+pacoxph_CXXFLAGS = -DCOXPH -I $(top_srcdir)/src/include $(AM_CXXFLAGS) \
+	$(am__append_10)
 pacoxph_CPPFLAGS = $(AM_CPPFLAGS)
 pacoxph_CFLAGS = -DCOXPH -I $(top_srcdir)/src/include $(AM_CFLAGS)
 extract_snp_SOURCES = extract-snp.cpp $(FVSRC) $(FVHEADERS)
-dist_bin_SCRIPTS = probabel.pl extIDS.pl
+dist_bin_SCRIPTS = probabel
 scriptdir = $(pkgdatadir)/scripts
-dist_script_DATA = prepare_data.R
+dist_script_DATA = prepare_data.R extIDS.pl
 dist_sysconf_DATA = probabel_config.cfg.example
 all: config.h
 	$(MAKE) $(AM_MAKEFLAGS) all-am
@@ -491,10 +555,11 @@ install-binPROGRAMS: $(bin_PROGRAMS)
 	fi; \
 	for p in $$list; do echo "$$p $$p"; done | \
 	sed 's/$(EXEEXT)$$//' | \
-	while read p p1; do if test -f $$p; \
-	  then echo "$$p"; echo "$$p"; else :; fi; \
+	while read p p1; do if test -f $$p \
+	  ; then echo "$$p"; echo "$$p"; else :; fi; \
 	done | \
-	sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
+	sed -e 'p;s,.*/,,;n;h' \
+	    -e 's|.*|.|' \
 	    -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
 	sed 'N;N;N;s,\n, ,g' | \
 	$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
@@ -515,22 +580,27 @@ uninstall-binPROGRAMS:
 	@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
 	files=`for p in $$list; do echo "$$p"; done | \
 	  sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
-	      -e 's/$$/$(EXEEXT)/' `; \
+	      -e 's/$$/$(EXEEXT)/' \
+	`; \
 	test -n "$$list" || exit 0; \
 	echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
 	cd "$(DESTDIR)$(bindir)" && rm -f $$files
 
 clean-binPROGRAMS:
 	-test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
+
 extract-snp$(EXEEXT): $(extract_snp_OBJECTS) $(extract_snp_DEPENDENCIES) $(EXTRA_extract_snp_DEPENDENCIES) 
 	@rm -f extract-snp$(EXEEXT)
 	$(AM_V_CXXLD)$(CXXLINK) $(extract_snp_OBJECTS) $(extract_snp_LDADD) $(LIBS)
+
 pacoxph$(EXEEXT): $(pacoxph_OBJECTS) $(pacoxph_DEPENDENCIES) $(EXTRA_pacoxph_DEPENDENCIES) 
 	@rm -f pacoxph$(EXEEXT)
 	$(AM_V_CXXLD)$(pacoxph_LINK) $(pacoxph_OBJECTS) $(pacoxph_LDADD) $(LIBS)
+
 palinear$(EXEEXT): $(palinear_OBJECTS) $(palinear_DEPENDENCIES) $(EXTRA_palinear_DEPENDENCIES) 
 	@rm -f palinear$(EXEEXT)
 	$(AM_V_CXXLD)$(palinear_LINK) $(palinear_OBJECTS) $(palinear_LDADD) $(LIBS)
+
 palogist$(EXEEXT): $(palogist_OBJECTS) $(palogist_DEPENDENCIES) $(EXTRA_palogist_DEPENDENCIES) 
 	@rm -f palogist$(EXEEXT)
 	$(AM_V_CXXLD)$(palogist_LINK) $(palogist_OBJECTS) $(palogist_LDADD) $(LIBS)
@@ -609,6 +679,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pacoxph-frutil.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pacoxph-gendata.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pacoxph-main.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pacoxph-main_functions_dump.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pacoxph-maskedmatrix.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pacoxph-phedata.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pacoxph-reg1.Po at am__quote@
@@ -631,6 +702,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/palinear-frutil.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/palinear-gendata.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/palinear-main.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/palinear-main_functions_dump.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/palinear-maskedmatrix.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/palinear-phedata.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/palinear-reg1.Po at am__quote@
@@ -653,6 +725,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/palogist-frutil.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/palogist-gendata.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/palogist-main.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/palogist-main_functions_dump.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/palogist-maskedmatrix.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/palogist-phedata.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/palogist-reg1.Po at am__quote@
@@ -1052,6 +1125,20 @@ pacoxph-reg1.obj: reg1.cpp
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(pacoxph_CPPFLAGS) $(CPPFLAGS) $(pacoxph_CXXFLAGS) $(CXXFLAGS) -c -o pacoxph-reg1.obj `if test -f 'reg1.cpp'; then $(CYGPATH_W) 'reg1.cpp'; else $(CYGPATH_W) '$(srcdir)/reg1.cpp'; fi`
 
+pacoxph-main_functions_dump.o: main_functions_dump.cpp
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(pacoxph_CPPFLAGS) $(CPPFLAGS) $(pacoxph_CXXFLAGS) $(CXXFLAGS) -MT pacoxph-main_functions_dump.o -MD -MP -MF $(DEPDIR)/pacoxph-main_functions_dump.Tpo -c -o pacoxph-main_functions_dump.o `test -f 'main_functions_dump.cpp' || echo '$(srcdir)/'`main_functions_dump.cpp
+ at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/pacoxph-main_functions_dump.Tpo $(DEPDIR)/pacoxph-main_functions_dump.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='main_functions_dump.cpp' object='pacoxph-main_functions_dump.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(pacoxph_CPPFLAGS) $(CPPFLAGS) $(pacoxph_CXXFLAGS) $(CXXFLAGS) -c -o pacoxph-main_functions_dump.o `test -f 'main_functions_dump.cpp' || echo '$(srcdir)/'`main_functions_dump.cpp
+
+pacoxph-main_functions_dump.obj: main_functions_dump.cpp
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(pacoxph_CPPFLAGS) $(CPPFLAGS) $(pacoxph_CXXFLAGS) $(CXXFLAGS) -MT pacoxph-main_functions_dump.obj -MD -MP -MF $(DEPDIR)/pacoxph-main_functions_dump.Tpo -c -o pacoxph-main_functions_dump.obj `if test -f 'main_functions_dump.cpp'; then $(CYGPATH_W) 'main_functions_dump.cpp'; else $(CYGPATH_W) '$(srcdir)/main_functions_dump.cpp'; fi`
+ at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/pacoxph-main_functions_dump.Tpo $(DEPDIR)/pacoxph-main_functions_dump.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='main_functions_dump.cpp' object='pacoxph-main_functions_dump.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(pacoxph_CPPFLAGS) $(CPPFLAGS) $(pacoxph_CXXFLAGS) $(CXXFLAGS) -c -o pacoxph-main_functions_dump.obj `if test -f 'main_functions_dump.cpp'; then $(CYGPATH_W) 'main_functions_dump.cpp'; else $(CYGPATH_W) '$(srcdir)/main_functions_dump.cpp'; fi`
+
 pacoxph-AbstractMatrix.o: fvlib/AbstractMatrix.cpp
 @am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(pacoxph_CPPFLAGS) $(CPPFLAGS) $(pacoxph_CXXFLAGS) $(CXXFLAGS) -MT pacoxph-AbstractMatrix.o -MD -MP -MF $(DEPDIR)/pacoxph-AbstractMatrix.Tpo -c -o pacoxph-AbstractMatrix.o `test -f 'fvlib/AbstractMatrix.cpp' || echo '$(srcdir)/'`fvlib/AbstractMatrix.cpp
 @am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/pacoxph-AbstractMatrix.Tpo $(DEPDIR)/pacoxph-AbstractMatrix.Po
@@ -1374,6 +1461,20 @@ palinear-reg1.obj: reg1.cpp
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(palinear_CPPFLAGS) $(CPPFLAGS) $(palinear_CXXFLAGS) $(CXXFLAGS) -c -o palinear-reg1.obj `if test -f 'reg1.cpp'; then $(CYGPATH_W) 'reg1.cpp'; else $(CYGPATH_W) '$(srcdir)/reg1.cpp'; fi`
 
+palinear-main_functions_dump.o: main_functions_dump.cpp
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(palinear_CPPFLAGS) $(CPPFLAGS) $(palinear_CXXFLAGS) $(CXXFLAGS) -MT palinear-main_functions_dump.o -MD -MP -MF $(DEPDIR)/palinear-main_functions_dump.Tpo -c -o palinear-main_functions_dump.o `test -f 'main_functions_dump.cpp' || echo '$(srcdir)/'`main_functions_dump.cpp
+ at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/palinear-main_functions_dump.Tpo $(DEPDIR)/palinear-main_functions_dump.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='main_functions_dump.cpp' object='palinear-main_functions_dump.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(palinear_CPPFLAGS) $(CPPFLAGS) $(palinear_CXXFLAGS) $(CXXFLAGS) -c -o palinear-main_functions_dump.o `test -f 'main_functions_dump.cpp' || echo '$(srcdir)/'`main_functions_dump.cpp
+
+palinear-main_functions_dump.obj: main_functions_dump.cpp
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(palinear_CPPFLAGS) $(CPPFLAGS) $(palinear_CXXFLAGS) $(CXXFLAGS) -MT palinear-main_functions_dump.obj -MD -MP -MF $(DEPDIR)/palinear-main_functions_dump.Tpo -c -o palinear-main_functions_dump.obj `if test -f 'main_functions_dump.cpp'; then $(CYGPATH_W) 'main_functions_dump.cpp'; else $(CYGPATH_W) '$(srcdir)/main_functions_dump.cpp'; fi`
+ at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/palinear-main_functions_dump.Tpo $(DEPDIR)/palinear-main_functions_dump.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='main_functions_dump.cpp' object='palinear-main_functions_dump.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(palinear_CPPFLAGS) $(CPPFLAGS) $(palinear_CXXFLAGS) $(CXXFLAGS) -c -o palinear-main_functions_dump.obj `if test -f 'main_functions_dump.cpp'; then $(CYGPATH_W) 'main_functions_dump.cpp'; else $(CYGPATH_W) '$(srcdir)/main_functions_dump.cpp'; fi`
+
 palinear-AbstractMatrix.o: fvlib/AbstractMatrix.cpp
 @am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(palinear_CPPFLAGS) $(CPPFLAGS) $(palinear_CXXFLAGS) $(CXXFLAGS) -MT palinear-AbstractMatrix.o -MD -MP -MF $(DEPDIR)/palinear-AbstractMatrix.Tpo -c -o palinear-AbstractMatrix.o `test -f 'fvlib/AbstractMatrix.cpp' || echo '$(srcdir)/'`fvlib/AbstractMatrix.cpp
 @am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/palinear-AbstractMatrix.Tpo $(DEPDIR)/palinear-AbstractMatrix.Po
@@ -1682,6 +1783,20 @@ palogist-reg1.obj: reg1.cpp
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(palogist_CPPFLAGS) $(CPPFLAGS) $(palogist_CXXFLAGS) $(CXXFLAGS) -c -o palogist-reg1.obj `if test -f 'reg1.cpp'; then $(CYGPATH_W) 'reg1.cpp'; else $(CYGPATH_W) '$(srcdir)/reg1.cpp'; fi`
 
+palogist-main_functions_dump.o: main_functions_dump.cpp
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(palogist_CPPFLAGS) $(CPPFLAGS) $(palogist_CXXFLAGS) $(CXXFLAGS) -MT palogist-main_functions_dump.o -MD -MP -MF $(DEPDIR)/palogist-main_functions_dump.Tpo -c -o palogist-main_functions_dump.o `test -f 'main_functions_dump.cpp' || echo '$(srcdir)/'`main_functions_dump.cpp
+ at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/palogist-main_functions_dump.Tpo $(DEPDIR)/palogist-main_functions_dump.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='main_functions_dump.cpp' object='palogist-main_functions_dump.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(palogist_CPPFLAGS) $(CPPFLAGS) $(palogist_CXXFLAGS) $(CXXFLAGS) -c -o palogist-main_functions_dump.o `test -f 'main_functions_dump.cpp' || echo '$(srcdir)/'`main_functions_dump.cpp
+
+palogist-main_functions_dump.obj: main_functions_dump.cpp
+ at am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(palogist_CPPFLAGS) $(CPPFLAGS) $(palogist_CXXFLAGS) $(CXXFLAGS) -MT palogist-main_functions_dump.obj -MD -MP -MF $(DEPDIR)/palogist-main_functions_dump.Tpo -c -o palogist-main_functions_dump.obj `if test -f 'main_functions_dump.cpp'; then $(CYGPATH_W) 'main_functions_dump.cpp'; else $(CYGPATH_W) '$(srcdir)/main_functions_dump.cpp'; fi`
+ at am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/palogist-main_functions_dump.Tpo $(DEPDIR)/palogist-main_functions_dump.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@	$(AM_V_CXX)source='main_functions_dump.cpp' object='palogist-main_functions_dump.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@	$(AM_V_CXX at am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(palogist_CPPFLAGS) $(CPPFLAGS) $(palogist_CXXFLAGS) $(CXXFLAGS) -c -o palogist-main_functions_dump.obj `if test -f 'main_functions_dump.cpp'; then $(CYGPATH_W) 'main_functions_dump.cpp'; else $(CYGPATH_W) '$(srcdir)/main_functions_dump.cpp'; fi`
+
 palogist-AbstractMatrix.o: fvlib/AbstractMatrix.cpp
 @am__fastdepCXX_TRUE@	$(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(palogist_CPPFLAGS) $(CPPFLAGS) $(palogist_CXXFLAGS) $(CXXFLAGS) -MT palogist-AbstractMatrix.o -MD -MP -MF $(DEPDIR)/palogist-AbstractMatrix.Tpo -c -o palogist-AbstractMatrix.o `test -f 'fvlib/AbstractMatrix.cpp' || echo '$(srcdir)/'`fvlib/AbstractMatrix.cpp
 @am__fastdepCXX_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/palogist-AbstractMatrix.Tpo $(DEPDIR)/palogist-AbstractMatrix.Po
@@ -1878,26 +1993,15 @@ uninstall-dist_sysconfDATA:
 	files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
 	dir='$(DESTDIR)$(sysconfdir)'; $(am__uninstall_files_from_dir)
 
-ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
-	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
-	unique=`for i in $$list; do \
-	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-	  done | \
-	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
-	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	mkid -fID $$unique
-tags: TAGS
-
-TAGS:  $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
-		$(TAGS_FILES) $(LISP)
+ID: $(am__tagged_files)
+	$(am__define_uniq_tagged_files); mkid -fID $$unique
+tags: tags-am
+TAGS: tags
+
+tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
 	set x; \
 	here=`pwd`; \
-	list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
-	unique=`for i in $$list; do \
-	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-	  done | \
-	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
-	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	$(am__define_uniq_tagged_files); \
 	shift; \
 	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
 	  test -n "$$unique" || unique=$$empty_fix; \
@@ -1909,15 +2013,11 @@ TAGS:  $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
 	      $$unique; \
 	  fi; \
 	fi
-ctags: CTAGS
-CTAGS:  $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
-		$(TAGS_FILES) $(LISP)
-	list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
-	unique=`for i in $$list; do \
-	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-	  done | \
-	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
-	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+ctags: ctags-am
+
+CTAGS: ctags
+ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+	$(am__define_uniq_tagged_files); \
 	test -z "$(CTAGS_ARGS)$$unique" \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
 	     $$unique
@@ -1926,6 +2026,21 @@ GTAGS:
 	here=`$(am__cd) $(top_builddir) && pwd` \
 	  && $(am__cd) $(top_srcdir) \
 	  && gtags -i $(GTAGS_ARGS) "$$here"
+cscopelist: cscopelist-am
+
+cscopelist-am: $(am__tagged_files)
+	list='$(am__tagged_files)'; \
+	case "$(srcdir)" in \
+	  [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+	  *) sdir=$(subdir)/$(srcdir) ;; \
+	esac; \
+	for i in $$list; do \
+	  if test -f "$$i"; then \
+	    echo "$(subdir)/$$i"; \
+	  else \
+	    echo "$$sdir/$$i"; \
+	  fi; \
+	done >> $(top_builddir)/cscope.files
 
 distclean-tags:
 	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
@@ -2020,7 +2135,8 @@ info: info-am
 info-am:
 
 install-data-am: install-dist_scriptDATA
-
+	@$(NORMAL_INSTALL)
+	$(MAKE) $(AM_MAKEFLAGS) install-data-hook
 install-dvi: install-dvi-am
 
 install-dvi-am:
@@ -2069,31 +2185,35 @@ ps-am:
 uninstall-am: uninstall-binPROGRAMS uninstall-dist_binSCRIPTS \
 	uninstall-dist_scriptDATA uninstall-dist_sysconfDATA
 
-.MAKE: all install-am install-exec-am install-strip
-
-.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
-	clean-generic ctags distclean distclean-compile \
-	distclean-generic distclean-hdr distclean-tags distdir dvi \
-	dvi-am html html-am info info-am install install-am \
-	install-binPROGRAMS install-data install-data-am \
-	install-dist_binSCRIPTS install-dist_scriptDATA \
-	install-dist_sysconfDATA install-dvi install-dvi-am \
-	install-exec install-exec-am install-exec-hook install-html \
-	install-html-am install-info install-info-am install-man \
-	install-pdf install-pdf-am install-ps install-ps-am \
-	install-strip installcheck installcheck-am installdirs \
-	maintainer-clean maintainer-clean-generic mostlyclean \
-	mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \
-	tags uninstall uninstall-am uninstall-binPROGRAMS \
-	uninstall-dist_binSCRIPTS uninstall-dist_scriptDATA \
-	uninstall-dist_sysconfDATA
+.MAKE: all install-am install-data-am install-exec-am install-strip
+
+.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean \
+	clean-binPROGRAMS clean-generic cscopelist-am ctags ctags-am \
+	distclean distclean-compile distclean-generic distclean-hdr \
+	distclean-tags distdir dvi dvi-am html html-am info info-am \
+	install install-am install-binPROGRAMS install-data \
+	install-data-am install-data-hook install-dist_binSCRIPTS \
+	install-dist_scriptDATA install-dist_sysconfDATA install-dvi \
+	install-dvi-am install-exec install-exec-am install-exec-hook \
+	install-html install-html-am install-info install-info-am \
+	install-man install-pdf install-pdf-am install-ps \
+	install-ps-am install-strip installcheck installcheck-am \
+	installdirs maintainer-clean maintainer-clean-generic \
+	mostlyclean mostlyclean-compile mostlyclean-generic pdf pdf-am \
+	ps ps-am tags tags-am uninstall uninstall-am \
+	uninstall-binPROGRAMS uninstall-dist_binSCRIPTS \
+	uninstall-dist_scriptDATA uninstall-dist_sysconfDATA
 
 
 install-exec-hook:
 	$(SED) -i "s;probabel_config.cfg;@sysconfdir@/probabel_config.cfg;" \
-		$(DESTDIR)$(bindir)/probabel.pl
-	$(SED) -i "s;\./;@bindir@/;" $(DESTDIR)$(bindir)/probabel.pl
-	$(SED) -i "s;PROBABEL_VERSION;@VERSION@;" $(DESTDIR)$(bindir)/probabel.pl
+		$(DESTDIR)$(bindir)/probabel
+	$(SED) -i "s;\./;@bindir@/;" $(DESTDIR)$(bindir)/probabel
+	$(SED) -i "s;PROBABEL_VERSION;@VERSION@;" $(DESTDIR)$(bindir)/probabel
+	ln -s $(DESTDIR)$(bindir)/probabel $(DESTDIR)$(bindir)/probabel.pl
+
+install-data-hook:
+	chmod a+rx $(DESTDIR)/$(scriptdir)/extIDS.pl
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
diff --git a/src/command_line_settings.cpp b/src/command_line_settings.cpp
index d335fed..33bd1c3 100644
--- a/src/command_line_settings.cpp
+++ b/src/command_line_settings.cpp
@@ -20,7 +20,9 @@
 #endif
 #include "fvlib/FileVector.h"
 
-using namespace std;
+using std::cout;
+using std::cerr;
+using std::endl;
 
 string cmdvars::getStrGenfilename() const
 {
@@ -128,11 +130,12 @@ char* cmdvars::getPhefilename() const
     return phefilename;
 }
 
+
 void cmdvars::set_variables(int argc, char * argv[])
 {
     int next_option;
     const char * const short_options = "p:i:d:m:n:c:o:s:t:g:a:erlhb:vu";
-    //b - interaction parameter
+    // b - interaction parameter
     // ADD --fv FLAG (FILEVECTOR), IN WHICH CASE USE ALTERNATIVE
     // CONSTRUCTOR FOR GENDATA
     const struct option long_options[] =
@@ -203,7 +206,14 @@ void cmdvars::set_variables(int argc, char * argv[])
             ngpreds = atoi(optarg);
             break;
         case 'a':
-            sep = optarg;
+            if (std::string(optarg) == std::string("\\t"))
+            {
+                sep = '\t';
+            }
+            else
+            {
+                sep = optarg;
+            }
             break;
         case 'e':
             nohead = 1;
@@ -233,15 +243,17 @@ void cmdvars::set_variables(int argc, char * argv[])
             break;
         default:
             abort();
-        } // end of switch
-    } while (next_option != -1);
-} // end of function
+        }  // end of switch
+    } while (next_option != -1);  // end of while
+}  // end of function
+
 
 bool cmdvars::isIsInteractionExcluded() const
 {
     return is_interaction_excluded;
 }
 
+
 void cmdvars::printinfo()
 {
     print_version();
@@ -265,7 +277,8 @@ void cmdvars::printinfo()
         }
         cerr << endl;
 
-        cout << "One or more required command line options appear to be missing."
+        cout << "One or more required command line options "
+             << "appear to be missing."
              << endl
              << "Run " << program_name
              << " --help for more information on the available options\n";
@@ -345,7 +358,7 @@ void cmdvars::printinfo()
 
     if (interaction_excluded != 0)
     {
-        interaction = interaction_excluded; //ups
+        interaction = interaction_excluded;  // ups
         is_interaction_excluded = true;
     }
     if (outfilename.compare("") == 0)
@@ -367,6 +380,7 @@ void cmdvars::printinfo()
              << endl;
         exit(1);
     }
+
     if (robust)
     {
         cerr << "ERROR: robust standard errors not implemented "
@@ -375,4 +389,5 @@ void cmdvars::printinfo()
         exit(1);
     }
 #endif
+    cout << endl;
 }
diff --git a/src/command_line_settings.h b/src/command_line_settings.h
index 4e82257..f53c913 100644
--- a/src/command_line_settings.h
+++ b/src/command_line_settings.h
@@ -9,11 +9,11 @@
 #define COMMAND_LINE_SETTINGS_H_
 #include <string>
 
-using namespace std;
+using std::string;
 
 class cmdvars
 {
-private:
+ private:
     char * program_name;
 
     char *phefilename;
@@ -42,7 +42,7 @@ private:
     int skipd;
     int allcov;
 
-public:
+ public:
     cmdvars()
     {
         program_name = NULL;
diff --git a/src/config.h.in b/src/config.h.in
index 04c9dd8..4fc07a4 100644
--- a/src/config.h.in
+++ b/src/config.h.in
@@ -39,10 +39,6 @@
 /* Define to 1 if you have the <limits.h> header file. */
 #undef HAVE_LIMITS_H
 
-/* Define to 1 if your system has a GNU libc compatible `malloc' function, and
-   to 0 otherwise. */
-#undef HAVE_MALLOC
-
 /* Define to 1 if you have the <memory.h> header file. */
 #undef HAVE_MEMORY_H
 
@@ -158,9 +154,6 @@
 #undef inline
 #endif
 
-/* Define to rpl_malloc if the replacement function should be used. */
-#undef malloc
-
 /* Define to `long int' if <sys/types.h> does not define. */
 #undef off_t
 
diff --git a/src/coxfit2.c b/src/coxfit2.c
index ea1a321..f57eb96 100644
--- a/src/coxfit2.c
+++ b/src/coxfit2.c
@@ -439,7 +439,6 @@ void coxfit2(int *maxiter, int *nusedx, int *nvarx, double *time, int *status,
             loglik[1] = newlk;
             chsolve2(imat, nvar, u);
 
-            j = 0;
             for (i = 0; i < nvar; i++)
             {
                 beta[i] = newbeta[i];
diff --git a/src/coxph_data.cpp b/src/coxph_data.cpp
index 926521d..9ffc15d 100644
--- a/src/coxph_data.cpp
+++ b/src/coxph_data.cpp
@@ -44,17 +44,19 @@ int cmpfun(const void *a, const void *b)
     return -9;
 }
 
-coxph_data::coxph_data(const coxph_data &obj) : sstat(obj.sstat)
+coxph_data::coxph_data(const coxph_data &obj) : sstat(obj.sstat),
+                                                offset(obj.offset),
+                                                strata(obj.strata),
+                                                X(obj.X),
+                                                order(obj.order)
 {
     nids        = obj.nids;
     ncov        = obj.ncov;
     ngpreds     = obj.ngpreds;
     weights     = obj.weights;
     stime       = obj.stime;
-    offset      = obj.offset;
-    strata      = obj.strata;
-    X           = obj.X;
-    order       = obj.order;
+    gcount      = 0;
+    freq        = 0;
     masked_data = new unsigned short int[nids];
 
     for (int i = 0; i < nids; i++)
@@ -65,16 +67,25 @@ coxph_data::coxph_data(const coxph_data &obj) : sstat(obj.sstat)
 
 coxph_data::coxph_data(phedata &phed, gendata &gend, const int snpnum)
 {
-    nids = gend.nids;
+    freq        = 0;
+    gcount      = 0;
+    nids        = gend.nids;
     masked_data = new unsigned short int[nids];
+
     for (int i = 0; i < nids; i++)
+    {
         masked_data[i] = 0;
+    }
 
     ngpreds = gend.ngpreds;
     if (snpnum >= 0)
+    {
         ncov = phed.ncov + ngpreds;
+    }
     else
+    {
         ncov = phed.ncov;
+    }
 
     if (phed.noutcomes != 2)
     {
@@ -94,7 +105,7 @@ coxph_data::coxph_data(phedata &phed, gendata &gend, const int snpnum)
     {
         //          X.put(1.,i,0);
         stime[i] = (phed.Y).get(i, 0);
-        sstat[i] = int((phed.Y).get(i, 1));
+        sstat[i] = static_cast<int>((phed.Y).get(i, 1));
         if (sstat[i] != 1 && sstat[i] != 0)
         {
             std::cerr << "coxph_data: status not 0/1 "
@@ -114,10 +125,13 @@ coxph_data::coxph_data(phedata &phed, gendata &gend, const int snpnum)
     {
         for (int j = 0; j < ngpreds; j++)
         {
-            double snpdata[nids];
+            double *snpdata = new double[nids];
             gend.get_var(snpnum * ngpreds + j, snpdata);
             for (int i = 0; i < nids; i++)
+            {
                 X.put(snpdata[i], i, (ncov - ngpreds + j));
+            }
+            delete[] snpdata;
         }
     }
 
@@ -129,8 +143,8 @@ coxph_data::coxph_data(phedata &phed, gendata &gend, const int snpnum)
     }
 
     // sort by time
-    double tmptime[nids];
-    int passed_sorted[nids];
+    double *tmptime = new double[nids];
+    int *passed_sorted = new int[nids];
 
     for (int i = 0; i < nids; i++)
     {
@@ -177,50 +191,74 @@ coxph_data::coxph_data(phedata &phed, gendata &gend, const int snpnum)
     // weights.print();
     // stime.print();
     // sstat.print();
+
+    delete[] tmptime;
+    delete[] passed_sorted;
 }
 
-void coxph_data::update_snp(gendata &gend, const int snpnum)
-{
-  /**
-   * This is the main part of the fix of bug #1846
-   * (C) of the fix:
-   *   UMC St Radboud Nijmegen,
-   *   Dept of Epidemiology & Biostatistics,
-   *   led by Prof. B. Kiemeney
-   *
-   * Note this sorts by "order"!!!
-   * Here we deal with transposed X, hence last two arguments are swapped
-   * compared to the other 'update_snp'
-   * Also, the starting column-1 is not necessary for cox X therefore
-   * 'ncov-j' changes to 'ncov-j-1'
-   **/
-
-    for (int j = 0; j < ngpreds; j++)
-    {
-        double snpdata[nids];
-        for (int i = 0; i < nids; i++)
-        {
+void coxph_data::update_snp(gendata *gend, const int snpnum) {
+    /**
+     * This is the main part of the fix of bug #1846
+     * (C) of the fix:
+     *   UMC St Radboud Nijmegen,
+     *   Dept of Epidemiology & Biostatistics,
+     *   led by Prof. B. Kiemeney
+     *
+     * Note this sorts by "order"!!!
+     * Here we deal with transposed X, hence last two arguments are swapped
+     * compared to the other 'update_snp'
+     * Also, the starting column-1 is not necessary for cox X therefore
+     * 'ncov-j' changes to 'ncov-j-1'
+     **/
+
+    // reset counter for frequency since it is a new snp
+    gcount = 0;
+    freq   = 0.0;
+
+    for (int j = 0; j < ngpreds; j++) {
+        double *snpdata = new double[nids];
+        for (int i = 0; i < nids; i++) {
             masked_data[i] = 0;
         }
 
-        gend.get_var(snpnum * ngpreds + j, snpdata);
+        gend->get_var(snpnum * ngpreds + j, snpdata);
 
-        for (int i = 0; i < nids; i++)
-        {
+        for (int i = 0; i < nids; i++) {
             X.put(snpdata[i], (ncov - j - 1), order[i]);
-            if (isnan(snpdata[i]))
+            if (std::isnan(snpdata[i])) {
                 masked_data[order[i]] = 1;
-        }
-    }
+                // snp not masked
+            } else {
+                // check for first predictor
+                if (j == 0) {
+                    gcount++;
+                    if (ngpreds == 1) {
+                        freq += snpdata[i] * 0.5;
+                    } else if (ngpreds == 2) {
+                        freq += snpdata[i];
+                    }
+                } else if (j == 1) {
+                    // add second genotype in two predicor data form
+                    freq += snpdata[i] * 0.5;
+                }
+            }    // end std::isnan(snpdata[i]) snp
+        }    // end i for loop
+
+        delete[] snpdata;
+    }    // end ngpreds loop
+
+    freq /= static_cast<double>(gcount);  // Allele frequency
 }
 
 
+/**
+ * update_snp() adds SNP information to the design matrix. This
+ * function allows you to strip that information from X again. This
+ * is used for example when calculating the null model.
+ *
+ */
 void coxph_data::remove_snp_from_X()
 {
-    // update_snp() adds SNP information to the design matrix. This
-    // function allows you to strip that information from X again.
-    // This is used for example when calculating the null model.
-
     if (ngpreds == 1)
     {
         X.delete_row(X.nrow -1);
@@ -250,9 +288,10 @@ coxph_data::~coxph_data()
     //      delete order;
 }
 
+
 coxph_data coxph_data::get_unmasked_data()
 {
-    coxph_data to; // = coxph_data(*this);
+    coxph_data to;  // = coxph_data(*this);
 
     // filter missing data
     int nmeasured = 0;
@@ -263,6 +302,7 @@ coxph_data coxph_data::get_unmasked_data()
             nmeasured++;
         }
     }
+
     to.nids = nmeasured;
     to.ncov = ncov;
     to.ngpreds = ngpreds;
@@ -304,6 +344,7 @@ coxph_data coxph_data::get_unmasked_data()
     return (to);
 }
 
+
 coxph_reg::coxph_reg(coxph_data &cdatain)
 {
     coxph_data cdata = cdatain.get_unmasked_data();
@@ -315,10 +356,13 @@ coxph_reg::coxph_reg(coxph_data &cdatain)
     niter = 0;
 }
 
-void coxph_reg::estimate(coxph_data &cdatain, int verbose, int maxiter,
-                         double eps, double tol_chol, int model,
-                         int interaction, int ngpreds, bool iscox,
-                         int nullmodel)
+
+void coxph_reg::estimate(coxph_data &cdatain, const int verbose,
+                        int maxiter, double eps,
+                        double tol_chol, const int model,
+                        const int interaction, const int ngpreds,
+                        const bool iscox, const int nullmodel,
+                        const mlinfo &snpinfo, const int cursnp)
 {
     coxph_data cdata = cdatain.get_unmasked_data();
 
@@ -332,6 +376,8 @@ void coxph_reg::estimate(coxph_data &cdatain, int verbose, int maxiter,
         (cdata.offset).column_mean(0);
     mematrix<double> means(X.nrow, 1);
 
+    int maxiterinput = maxiter;
+
     for (int i = 0; i < X.nrow; i++)
     {
         beta[i] = 0.;
@@ -340,9 +386,14 @@ void coxph_reg::estimate(coxph_data &cdatain, int verbose, int maxiter,
     mematrix<double> u(X.nrow, 1);
     mematrix<double> imat(X.nrow, X.nrow);
 
-    double work[X.ncol * 2 + 2 * (X.nrow) * (X.nrow) + 3 * (X.nrow)];
+    double *work = new double[X.ncol * 2 +
+                              2 * (X.nrow) * (X.nrow) +
+                              3 * (X.nrow)];
     double loglik_int[2];
     int flag;
+
+    // Use Efron method of handling ties (for Breslow: 0.0), like in
+    // R's coxph()
     double sctest = 1.0;
 
     // When using Eigen coxfit2 needs to be called in a slightly
@@ -363,16 +414,69 @@ void coxph_reg::estimate(coxph_data &cdatain, int verbose, int maxiter,
             &sctest);
 #endif
 
+    niter = maxiter;
+
+    // Check the results of the Cox fit; mirrored from the same checks
+    // in coxph_fit.S from the R survival package
+
+    bool setToZero = false;
+
+    if (flag < X.nrow && maxiter > 0) {
+        cerr << "Warning for " << snpinfo.name[cursnp]
+             << ": X matrix deemed to be singular,"
+             << " setting beta and se to 'nan'\n";
+        setToZero = true;
+    }
+
+    if (niter >= maxiterinput)
+    {
+        cerr << "Warning for " << snpinfo.name[cursnp]
+             << ": nr of iterations > MAXITER (" << maxiterinput << "): "
+             << niter << endl;
+    }
+
     if (flag == 1000)
     {
-        cerr << "Error: Cox regression did not converge\n";
+        cerr << "Warning for " << snpinfo.name[cursnp]
+             << ": Cox regression ran out of iterations and did not converge,"
+             << " setting beta and se to 'nan'\n";
+        setToZero = true;
+    } else {
+#if EIGEN
+        VectorXd ueigen = u.data;
+        MatrixXd imateigen = imat.data;
+        VectorXd infs = ueigen.transpose() * imateigen;
+        VectorXd betaeigen = beta.data;
+        if ( infs.norm() > eps ||
+            infs.norm() > sqrt(eps) * betaeigen.norm() )
+        {
+            cerr << "Warning for " << snpinfo.name[cursnp]
+                 << ": beta may be infinite,"
+                 << " setting beta and se to 'nan'\n";
+
+            setToZero = true;
+        }
+#else
+        cerr << "Warning for " << snpinfo.name[cursnp]
+             << ": can't check for infinite betas."
+             << " Please compile ProbABEL with Eigen support to fix this."
+             << endl;
+#endif
     }
 
     for (int i = 0; i < X.nrow; i++)
     {
-        sebeta[i] = sqrt(imat.get(i, i));
+        if (setToZero)
+        {
+            // Cox regression failed
+            sebeta[i] = NAN;
+            beta[i]   = NAN;
+            loglik    = NAN;
+        } else {
+            sebeta[i] = sqrt(imat.get(i, i));
+            loglik = loglik_int[1];
+        }
     }
 
-    loglik = loglik_int[1];
-    niter = maxiter;
+    delete[] work;
 }
diff --git a/src/coxph_data.h b/src/coxph_data.h
index 1503b2a..aa55d56 100644
--- a/src/coxph_data.h
+++ b/src/coxph_data.h
@@ -16,31 +16,36 @@
 #include "mematri1.h"
 #endif
 
+#include "data.h"
 #include "reg1.h"
 #include "gendata.h"
 #include "phedata.h"
 
 class coxph_data {
-public:
+ public:
     coxph_data get_unmasked_data();
 
     coxph_data()
     {
-        nids = 0;
-        ncov = 0;
-        ngpreds = 0;
+        nids        = 0;
+        ncov        = 0;
+        ngpreds     = 0;
         masked_data = NULL;
+        gcount      = 0;
+        freq        = 0;
     }
 
     coxph_data(const coxph_data &obj);
     coxph_data(phedata &phed, gendata &gend, const int snpnum);
-    void update_snp(gendata &gend, const int snpnum);
+    void update_snp(gendata *gend, const int snpnum);
     void remove_snp_from_X();
     ~coxph_data();
 
     int nids;
     int ncov;
     int ngpreds;
+    unsigned int gcount;
+    double freq;
     mematrix<double> weights;
     mematrix<double> stime;
     mematrix<int>    sstat;
@@ -51,8 +56,9 @@ public:
     unsigned short int * masked_data;
 };
 
+
 class coxph_reg {
-public:
+ public:
     mematrix<double> beta;
     mematrix<double> sebeta;
     mematrix<double> residuals;
@@ -62,9 +68,10 @@ public:
     int niter;
 
     coxph_reg(coxph_data &cdatain);
-    void estimate(coxph_data &cdatain, int verbose, int maxiter, double eps,
-                  double tol_chol, int model, int interaction, int ngpreds,
-                  bool iscox, int nullmodel);
+    void estimate(coxph_data &cdatain, const int verbose, int maxiter,
+                  double eps, double tol_chol, const int model,
+                  const int interaction, const int ngpreds, const bool iscox,
+                  const int nullmodel, const mlinfo &snpinfo, const int cursnp);
 };
 
 #endif /* COXPH_DATA_H_ */
diff --git a/src/data.cpp b/src/data.cpp
index 0d2ed54..0b3aa09 100644
--- a/src/data.cpp
+++ b/src/data.cpp
@@ -24,7 +24,6 @@
 #endif
 #include "utilities.h"
 
-using namespace std;
 
 unsigned int Nmeasured(char * fname, int nphenocols, int npeople)
 {
@@ -67,9 +66,17 @@ unsigned int Nmeasured(char * fname, int nphenocols, int npeople)
     return (nids);
 }
 
+
+/**
+ * Read SNP information from an mlinfo file generated by the
+ * imputation software.
+ *
+ * \param filename Name of the mlinfo file
+ * \param mapname Name of the map file
+ */
 mlinfo::mlinfo(char * filename, char * mapname)
 {
-    char tmp[100];
+    char tmp[1048576];
     unsigned int nlin = 0;
     std::ifstream infile(filename);
     if (infile.is_open())
@@ -80,8 +87,7 @@ mlinfo::mlinfo(char * filename, char * mapname)
             nlin++;
         }
         nlin--; // Subtract one, the previous loop added 1 too much
-    } else
-    {
+    } else {
         std::cerr << "mlinfo: cannot open info file " << filename << endl;
         exit(1);
     }
@@ -92,7 +98,7 @@ mlinfo::mlinfo(char * filename, char * mapname)
         std::cerr << "mlinfo: number of columns != 7 in " << filename << endl;
         exit(1);
     }
-    nsnps = int(nlin / 7) - 1;
+    nsnps = static_cast<int>((nlin / 7) - 1);
     std::cout << "Number of SNPs = " << nsnps << endl;
     name    = new std::string[nsnps];
     A1      = new std::string[nsnps];
@@ -136,23 +142,32 @@ mlinfo::mlinfo(char * filename, char * mapname)
     if (mapname != NULL)
     {
         std::ifstream instr(mapname);
-        int BFS = 1000;
-        char line[BFS], tmp[BFS];
+        int BFS = 1048576;
+        char *line = new char[BFS];
+        char *tmp  = new char[BFS];
+
         if (!instr.is_open())
         {
             std::cerr << "mlinfo: cannot open map file " << mapname << endl;
             exit(1);
         }
+
         instr.getline(line, BFS);
+
         for (int i = 0; i < nsnps; i++)
         {
             instr.getline(line, BFS);
             std::stringstream line_stream(line);
             line_stream >> tmp >> map[i];
         }
+
         instr.close();
+
+        delete[] line;
+        delete[] tmp;
     }
 }
+
 mlinfo::~mlinfo()
 {
     delete[] mlinfo::name;
@@ -211,12 +226,10 @@ InvSigma::InvSigma(const char * filename_, phedata * phe) : filename(filename_)
                 myfile.close();
                 exit(1);
             }
-            col = 0;
             row++;
         }
         myfile.close();
-    } else
-    {
+    } else {
         std::cerr << "error: inv file: cannot open file '"
                   << filename_ << "'\n";
     }
diff --git a/src/data.h b/src/data.h
index 0c9449b..3375ea1 100644
--- a/src/data.h
+++ b/src/data.h
@@ -1,8 +1,8 @@
-/*
- * data.h
+/**
+ * \file   data.h
+ * \author mkooyman
  *
- *  Created on: Mar 8, 2012
- *      Author: mkooyman
+ * \brief Contains several classes we didn't put somewhere else yet
  */
 
 #ifndef DATA_H_
@@ -15,17 +15,21 @@ unsigned int Nmeasured(char * fname, int nphenocols, int npeople);
 #include "phedata.h"
 #include "gendata.h"
 
+/**
+ * \brief Data from the mlinfo file.
+ *
+ */
 class mlinfo {
-public:
-    int nsnps;
-    std::string * name;
-    std::string * A1;
-    std::string * A2;
+ public:
+    int nsnps;                  /**< Number of SNPs */
+    std::string * name;         /**< Array of SNP names */
+    std::string * A1;           /**< Array with the first allele */
+    std::string * A2;           /**< Array with the second allele */
     double * Freq1;
-    double * MAF;
-    double * Quality;
-    double * Rsq;
-    std::string * map;
+    double * MAF;               /**< The minor allele frequency */
+    double * Quality;           /**< The imputation quality metric */
+    double * Rsq;               /**< The imputation \f$R^2\f$ */
+    std::string * map;          /**< Array with the SNP positions */
     mlinfo()
     {
         Freq1 = NULL;
@@ -43,13 +47,13 @@ public:
 };
 
 class InvSigma {
-private:
+ private:
     static const unsigned MAXIMUM_PEOPLE_AMOUNT = 1000000;
     unsigned int npeople;       /* number of people */
     std::string filename;
     mematrix<double> matrix;    /* file is stored here */
 
-public:
+ public:
     InvSigma(const char * filename_, phedata * phe);
     mematrix<double> & get_matrix();
     ~InvSigma();
diff --git a/src/eigen_mematrix.cpp b/src/eigen_mematrix.cpp
index 2affde1..ff910c2 100644
--- a/src/eigen_mematrix.cpp
+++ b/src/eigen_mematrix.cpp
@@ -66,19 +66,19 @@ DT & mematrix<DT>::operator[](const int i)
         exit(1);
     }
     int column = i % ncol;
-    int row = (int) floor((double) i / ncol);
+    int row = static_cast<int>( floor(static_cast<double>(i / ncol)) );
 
     return data(row, column);
 }
 
-//template<class DT>
-//mematrix<DT> mematrix<DT>::operator+(DT toadd)
-//{
-//    mematrix<DT> temp(nrow, ncol);
-//    for (int i = 0; i < nelements; i++)
-//        temp.data[i] = data[i] + toadd;
-//    return temp;
-//}
+// template<class DT>
+// mematrix<DT> mematrix<DT>::operator+(DT toadd)
+// {
+//     mematrix<DT> temp(nrow, ncol);
+//     for (int i = 0; i < nelements; i++)
+//         temp.data[i] = data[i] + toadd;
+//     return temp;
+// }
 
 template<class DT>
 mematrix<DT> mematrix<DT>::operator+(const mematrix<DT> &M)
@@ -309,23 +309,23 @@ mematrix<DT> reorder(const mematrix<DT> &M, const mematrix<int> order)
         exit(1);
     }
     mematrix<DT> temp(M.nrow, M.ncol);
-    int source;
+
     for (int i = 0; i < temp.nrow; i++)
     {
-        source = order.data(i, 0);
+        int source = order.data(i, 0);
         temp.data.row(source) = M.data.row(i);
     }
     return temp;
 }
 
-//template<class DT>
-//mematrix<double> todouble(mematrix<DT> &M)
-//{
-//    mematrix<double> temp(M.nrow, M.ncol);
-//    for (int i = 0; i < temp.nelements; i++)
-//        temp.data[i] = double(M.data[i]);
-//    return temp;
-//}
+// template<class DT>
+// mematrix<double> todouble(mematrix<DT> &M)
+// {
+//     mematrix<double> temp(M.nrow, M.ncol);
+//     for (int i = 0; i < temp.nelements; i++)
+//         temp.data[i] = double(M.data[i]);
+//     return temp;
+// }
 
 template<class DT>
 mematrix<DT> invert(const mematrix<DT> &M)
@@ -345,14 +345,15 @@ mematrix<DT> invert(const mematrix<DT> &M)
 template<class DT>
 mematrix<DT> productMatrDiag(const mematrix<DT> &M, const mematrix<DT> &D)
 {
-    //multiply all rows of M by value of first row of D
+    // multiply all rows of M by value of first row of D
     if (M.ncol != D.nrow)
     {
         std::cerr << "productMatrDiag: wrong dimensions";
         exit(1);
     }
     mematrix<DT> temp = M;
-    //make a array of the first row of D in the same way orientation as M.data.row(i).array()
+    // make an array of the first row of D in the same way orientation as
+    // M.data.row(i).array()
     Array<DT, Dynamic, Dynamic> row = D.data.block(0, 0, M.ncol, 1).transpose();
 
     for (int i = 0; i < temp.nrow; i++)
diff --git a/src/eigen_mematrix.h b/src/eigen_mematrix.h
index 8987093..f671998 100644
--- a/src/eigen_mematrix.h
+++ b/src/eigen_mematrix.h
@@ -5,10 +5,12 @@
 #include <iostream>
 
 using namespace Eigen;
-using namespace std;
+using std::cout;
+using std::cerr;
+
 
 template<class DT> class mematrix {
-public:
+ public:
     int nrow;
     int ncol;
     int nelements;
diff --git a/src/extract-snp.cpp b/src/extract-snp.cpp
index dab38ec..afc4f2b 100644
--- a/src/extract-snp.cpp
+++ b/src/extract-snp.cpp
@@ -27,7 +27,9 @@
 #include <fstream>
 #include <map>
 
-using namespace std;
+using std::cout;
+using std::cerr;
+using std::endl;
 
 #include "fvlib/Logger.h"
 #include "fvlib/FileVector.h"
@@ -78,7 +80,8 @@ int main(int argc, char* argv[])
     string snpname = "";
     do
     {
-        next_option = getopt_long(argc, argv, short_options, long_options, NULL);
+        next_option = getopt_long(argc, argv,
+                                  short_options, long_options, NULL);
         switch (next_option)
         {
         case 'h':
@@ -99,8 +102,7 @@ int main(int argc, char* argv[])
         case '?': break;
         case -1 : break;
         }
-    }
-    while (next_option != -1);
+    } while (next_option != -1);
 
     if (snpname.compare("") == 0)
     {
diff --git a/src/fvlib/AbstractMatrix.cpp b/src/fvlib/AbstractMatrix.cpp
index 993a4b8..b207676 100644
--- a/src/fvlib/AbstractMatrix.cpp
+++ b/src/fvlib/AbstractMatrix.cpp
@@ -3,18 +3,18 @@
 set<string> AbstractMatrix::fileNamesOpenForWriting;
 
 void AbstractMatrix::checkOpenForWriting(const string fileName){
-    deepDbg << "checkOpenForWriting("<< fileName << ")" << endl;
-    if (AbstractMatrix::fileNamesOpenForWriting.find(fileName) != fileNamesOpenForWriting.end()) {
+    deepDbg << "checkOpenForWriting(" << fileName << ")" << endl;
+    if (AbstractMatrix::fileNamesOpenForWriting.find(fileName) !=
+        fileNamesOpenForWriting.end()) {
         errorLog << "File " << fileName << " is already opened." <<  endl;
         throw 1;
     } else {
         AbstractMatrix::fileNamesOpenForWriting.insert(fileName);
     }
 }
+
+
 void AbstractMatrix::closeForWriting(const string fileName){
-    fmDbg << "closeForWriting("<< fileName << ")" << endl;
+    fmDbg << "closeForWriting(" << fileName << ")" << endl;
     AbstractMatrix::fileNamesOpenForWriting.erase(fileName);
 }
-
-
-
diff --git a/src/fvlib/AbstractMatrix.h b/src/fvlib/AbstractMatrix.h
index 4ff3cb8..0081617 100644
--- a/src/fvlib/AbstractMatrix.h
+++ b/src/fvlib/AbstractMatrix.h
@@ -14,48 +14,52 @@ using namespace std;
 // See filteredMatrix.h for detailed comments
 
 class AbstractMatrix {
-public:
+ public:
     virtual ~AbstractMatrix(){};
 
     template <class DT>
-    void writeVariableAs(unsigned long varIdx, DT * outvec)
+        void writeVariableAs(unsigned long varIdx, DT * outvec)
     {
         char* tmp = new (nothrow) char [getNumObservations()*getElementSize()];
-        if(!tmp)
+        if (!tmp)
             errorLog << "writeVariableAs allocation error" << errorExit;
-        for(unsigned long int i = 0; i< getNumObservations();i++){
-            performCast(&tmp[i*getElementSize()],outvec[i],getElementType(), warningIsShown);
+        for (unsigned long int i = 0; i < getNumObservations(); i++){
+            performCast(&tmp[i * getElementSize()], outvec[i], getElementType(),
+                        warningIsShown);
         }
         writeVariable(varIdx, tmp);
         delete[] tmp;
     }
 
     template <class DT>
-    void addVariableAs(DT * outvec, string varname)
+        void addVariableAs(DT * outvec, string varname)
     {
         char* tmp = new (nothrow) char [getNumObservations()*getElementSize()];
-        if(!tmp)
+        if (!tmp)
             errorLog << "add_variable_as allocation error" << errorExit;
-        for(unsigned long int i = 0; i< getNumObservations();i++){
-            performCast(&tmp[i*getElementSize()],outvec[i],getElementType(), warningIsShown);
+        for (unsigned long int i = 0; i < getNumObservations(); i++){
+            performCast(&tmp[i * getElementSize()], outvec[i], getElementType(),
+                        warningIsShown);
         }
-        addVariable (tmp, varname);
+        addVariable (tmp,  varname);
         delete[] tmp;
     }
 
     template<class DT>
-    void readVariableAs(unsigned long varIdx, DT * outvec)
+        void readVariableAs(unsigned long varIdx, DT * outvec)
     {
-       char * tmp = new (nothrow) char[getNumObservations()*getElementSize()];
-       readVariable(varIdx, tmp);
-       for(unsigned long int i = 0; i< getNumObservations();i++) {
-            performCast(outvec[i],&tmp[i*getElementSize()],getElementType(),warningIsShown);
-       }
-       delete[] tmp;
+        char * tmp = new (nothrow) char[getNumObservations()*getElementSize()];
+        readVariable(varIdx, tmp);
+        for (unsigned long int i = 0; i < getNumObservations(); i++) {
+            performCast(outvec[i], &tmp[i*getElementSize()], getElementType(),
+                        warningIsShown);
+        }
+        delete[] tmp;
     }
 
     template<class DT>
-    void readElementAs(unsigned long varNumber, unsigned long obsNumber, DT & element){
+        void readElementAs(unsigned long varNumber, unsigned long obsNumber,
+                           DT & element){
         char *ret= new char [getElementSize()];
         readElement(varNumber, obsNumber, ret);
         performCast(element, ret, getElementType(), warningIsShown);
@@ -63,14 +67,16 @@ public:
     }
 
     template <class DT>
-    void writeElementAs(unsigned long varNumber, unsigned long obsNumber, DT& element){
-       deepDbg << "AbstractMatrix.writeElementAs(" << varNumber << "," << obsNumber << "," << element <<")";
-       deepDbg << "Alloc getElementSize() = " << getElementSize() << endl;
-       char *ret = new char [getElementSize()];
-       deepDbg << "Perform cast" << endl;
-       performCast(ret, element, getElementType(), warningIsShown);
-       writeElement(varNumber, obsNumber, ret);
-       delete [] ret;
+        void writeElementAs(unsigned long varNumber, unsigned long obsNumber,
+                            DT& element){
+        deepDbg << "AbstractMatrix.writeElementAs(" << varNumber << ","
+                << obsNumber << "," << element <<")";
+        deepDbg << "Alloc getElementSize() = " << getElementSize() << endl;
+        char *ret = new char [getElementSize()];
+        deepDbg << "Perform cast" << endl;
+        performCast(ret, element, getElementType(), warningIsShown);
+        writeElement(varNumber, obsNumber, ret);
+        delete [] ret;
     }
 
     virtual string getFileName() = 0;
@@ -78,18 +84,23 @@ public:
     virtual unsigned long getNumVariables() = 0;
     virtual unsigned long getNumObservations() = 0;
 
-	virtual void saveAs( string newFilename ) = 0;
-	virtual void saveVariablesAs( string newFilename, unsigned long nvars, unsigned long * varindexes) = 0;
-   	virtual void saveObservationsAs( string newFilename, unsigned long nobss, unsigned long * obsindexes) = 0;
+    virtual void saveAs(string newFilename) = 0;
+    virtual void saveVariablesAs(string newFilename, unsigned long nvars,
+                                 unsigned long * varindexes) = 0;
+    virtual void saveObservationsAs(string newFilename, unsigned long nobss,
+                                    unsigned long * obsindexes) = 0;
 
-    virtual void saveAs(string newFilename, unsigned long nvars, unsigned long nobss, unsigned long * varindexes, unsigned long * obsindexes) = 0;
-    virtual void saveAsText(string newFilename, bool saveVarNames, bool saveObsNames, string nanString) = 0;
+    virtual void saveAs(string newFilename, unsigned long nvars,
+                        unsigned long nobss, unsigned long * varindexes,
+                        unsigned long * obsindexes) = 0;
+    virtual void saveAsText(string newFilename, bool saveVarNames,
+                            bool saveObsNames, string nanString) = 0;
 
     virtual void readObservation(unsigned long obsIdx, void * outvec) = 0;
     virtual void writeObservation(unsigned long obsIdx, void * invec) = 0;
 
-    virtual void writeVariableName(unsigned long varIdx, FixedChar newname) = 0;  // todo loooong future -- control that name is unique
-    virtual void writeObservationName(unsigned long obsIdx, FixedChar newname)= 0;  //todo loooong future -- control that name is unique!
+    virtual void writeVariableName(unsigned long varIdx, FixedChar newname) = 0;    // todo loooong future -- control that name is unique
+    virtual void writeObservationName(unsigned long obsIdx, FixedChar newname)= 0;   //todo loooong future -- control that name is unique!
 
     virtual unsigned long getCacheSizeInMb() = 0;
     virtual void setCacheSizeInMb( unsigned long cachesizeMb ) = 0;
@@ -99,25 +110,27 @@ public:
     virtual void cacheAllNames(bool) = 0;
 
     virtual void setUpdateNamesOnWrite(bool bUpdate) = 0;
-	virtual short unsigned getElementSize() = 0;
-	virtual short unsigned getElementType() = 0;
-	virtual void readVariable(unsigned long varIdx, void * outvec) = 0;
-	virtual void readElement(unsigned long varIdx, unsigned long obsIdx, void * elem) = 0;
-	virtual void writeVariable(unsigned long varIdx, void * datavec) = 0;
-	virtual void writeElement(unsigned long varIdx, unsigned long obsIdx, void * data) = 0;
-	virtual AbstractMatrix* castToAbstractMatrix() = 0;
-	virtual bool setReadOnly(bool readOnly) = 0;
-
-	static set<string> fileNamesOpenForWriting;
-	static void checkOpenForWriting(const string fileName);
-	static void closeForWriting(const string fileName);
-
-	bool &getWarningIsShown(){ return warningIsShown;}
-private:
+    virtual short unsigned getElementSize() = 0;
+    virtual short unsigned getElementType() = 0;
+    virtual void readVariable(unsigned long varIdx, void * outvec) = 0;
+    virtual void readElement(unsigned long varIdx, unsigned long obsIdx,
+                             void * elem) = 0;
+    virtual void writeVariable(unsigned long varIdx, void * datavec) = 0;
+    virtual void writeElement(unsigned long varIdx, unsigned long obsIdx,
+                              void * data) = 0;
+    virtual AbstractMatrix* castToAbstractMatrix() = 0;
+    virtual bool setReadOnly(bool readOnly) = 0;
+
+    static set<string> fileNamesOpenForWriting;
+    static void checkOpenForWriting(const string fileName);
+    static void closeForWriting(const string fileName);
+
+    bool &getWarningIsShown(){ return warningIsShown;}
+ private:
 
     // HIGH -- here I see the possibility to make these functions faster then "random" access functions
     // adds variable at the end = writeVariable with varIdx=NVARS?
-	// todo loooong future -- control that name is unique!
+    // todo loooong future -- control that name is unique!
     virtual void addVariable(void * invec, string varname) = 0;
     //    virtual void add_observation(void * invec, string obsname) = 0;
     // write single element
@@ -126,5 +139,3 @@ private:
 };
 
 #endif
-
-
diff --git a/src/fvlib/CastUtils.cpp b/src/fvlib/CastUtils.cpp
index 161f254..d2c6c95 100644
--- a/src/fvlib/CastUtils.cpp
+++ b/src/fvlib/CastUtils.cpp
@@ -5,6 +5,9 @@
 
 using namespace std;
 
+#ifndef _NOT_R_FILEVECTOR
+#include <R.h>
+#endif
 #include "frutil.h"
 #include "CastUtils.h"
 
@@ -16,110 +19,119 @@ char CHAR_NAN;
 unsigned char UNSIGNED_CHAR_NAN;
 char const* parseFormats[9];
 
+
 int initConsts(){
-  int i;
-  sscanf("32767","%hi",&SHORT_INT_NAN);
-  sscanf("65535","%hu",&UNSIGNED_SHORT_INT_NAN);
-  sscanf("2147483647","%i",&INT_NAN);
-  sscanf("4294967295","%u",&UNSIGNED_INT_NAN);
-  sscanf("127","%i",&i); CHAR_NAN = i;
-  sscanf("255","%u",&i); UNSIGNED_CHAR_NAN = i;
-
-  parseFormats[UNSIGNED_SHORT_INT] = "%hu";
-  parseFormats[SHORT_INT] = "%hd";
-  parseFormats[UNSIGNED_INT] = "%u";
-  parseFormats[INT] = "%d";
-  parseFormats[FLOAT] = "%f";
-  parseFormats[DOUBLE] = "%lf";
-  parseFormats[SIGNED_CHAR] = "%i";
-  parseFormats[UNSIGNED_CHAR] = "%i";
-  return 0;
+    int i;
+    unsigned int ui;
+    sscanf("32767", "%hi", &SHORT_INT_NAN);
+    sscanf("65535", "%hu", &UNSIGNED_SHORT_INT_NAN);
+    sscanf("2147483647", "%i", &INT_NAN);
+    sscanf("4294967295", "%u", &UNSIGNED_INT_NAN);
+    sscanf("127", "%i", &i); CHAR_NAN = i;
+    sscanf("255", "%u", &ui); UNSIGNED_CHAR_NAN = ui;
+
+    parseFormats[UNSIGNED_SHORT_INT] = "%hu";
+    parseFormats[SHORT_INT] = "%hd";
+    parseFormats[UNSIGNED_INT] = "%u";
+    parseFormats[INT] = "%d";
+    parseFormats[FLOAT] = "%f";
+    parseFormats[DOUBLE] = "%lf";
+    parseFormats[SIGNED_CHAR] = "%i";
+    parseFormats[UNSIGNED_CHAR] = "%i";
+    return 0;
 }
 
+
 int dummy = initConsts();
 
-void parseStringToArbType(string s, int destType, void *destData, string nanString) {
+
+void parseStringToArbType(string s, int destType, void *destData,
+                          string nanString) {
+
     char const *format = parseFormats[destType];
 
-	int result;
-	// no proper format specifier exists for char
-	if (destType == SIGNED_CHAR || destType == UNSIGNED_CHAR) {
-	    int i;
-	    result = sscanf(s.c_str(), format, &i);
-    	if (nanString == s || result !=1){
-	        setNan(destData, destType);
-		    return;
-	    } else {
-	        if (destType == SIGNED_CHAR) *(char*) destData = i;
-	        if (destType == UNSIGNED_CHAR) *(unsigned char*) destData = i;	        	        
-	    }
-
-	} else {
-	    result = sscanf(s.c_str(), format, destData);
-    	if (nanString == s || result !=1){
-	        setNan(destData, destType);
-		    return;
-	    }
-	}
+    int result;
+    // no proper format specifier exists for char
+    if (destType == SIGNED_CHAR || destType == UNSIGNED_CHAR) {
+        int i;
+        result = sscanf(s.c_str(), format, &i);
+        if (nanString == s || result !=1){
+            setNan(destData, destType);
+            return;
+        } else {
+            if (destType == SIGNED_CHAR) *(char*) destData = i;
+            if (destType == UNSIGNED_CHAR) *(unsigned char*) destData = i;
+        }
+
+    } else {
+        result = sscanf(s.c_str(), format, destData);
+        if (nanString == s || result !=1){
+            setNan(destData, destType);
+            return;
+        }
+    }
 }
 
+
 unsigned short int dataTypeFromString(string type){
-	if (type == "UNSIGNED_SHORT_INT") return 1;
-	if (type == "SHORT_INT") return 2;
-	if (type == "UNSIGNED_INT") return 3;
-	if (type == "INT") return 4;
-	if (type == "FLOAT") return 5;
-	if (type == "DOUBLE") return 6;
-	if (type == "CHAR") return 7;
-	if (type == "UNSIGNED_CHAR") return 8;
-	return 0;
+    if (type == "UNSIGNED_SHORT_INT") return 1;
+    if (type == "SHORT_INT") return 2;
+    if (type == "UNSIGNED_INT") return 3;
+    if (type == "INT") return 4;
+    if (type == "FLOAT") return 5;
+    if (type == "DOUBLE") return 6;
+    if (type == "CHAR") return 7;
+    if (type == "UNSIGNED_CHAR") return 8;
+    return 0;
 }
 
+
 string dataTypeToString(int type){
-	if (type == 1) return "UNSIGNED_SHORT_INT";
-	if (type == 2) return "SHORT_INT";
-	if (type == 3) return "UNSIGNED_INT";
-	if (type == 4) return "INT";
-	if (type == 5) return "FLOAT";
-	if (type == 6) return "DOUBLE";
-	if (type == 7) return "CHAR";
-	if (type == 8) return "UNSIGNED_CHAR";
-	return 0;
+    if (type == 1) return "UNSIGNED_SHORT_INT";
+    if (type == 2) return "SHORT_INT";
+    if (type == 3) return "UNSIGNED_INT";
+    if (type == 4) return "INT";
+    if (type == 5) return "FLOAT";
+    if (type == 6) return "DOUBLE";
+    if (type == 7) return "CHAR";
+    if (type == 8) return "UNSIGNED_CHAR";
+    return 0;
 }
 
+
 string bufToString(short int dataType, char *data, string nanString){
-	char ret[500];
-	switch(dataType){
-	case UNSIGNED_SHORT_INT:
-		sprintf(ret, "%hu", *(unsigned short int*)data);
-		break;
-	case SHORT_INT:
-		sprintf(ret, "%hd", *(short int*)data);
-		break;
-	case UNSIGNED_INT:
-		sprintf(ret, "%u", *(unsigned int*)data);
-		break;
-	case INT:
-		sprintf(ret, "%d", *(int*)data);
-		break;
-	case FLOAT:
-		sprintf(ret, "%f", *(float*)data);
-		break;
-	case DOUBLE: // changed to "%f" from %lf [not ISO C++]
-		sprintf(ret, "%f", *(double*)data);
-		break;
-	case SIGNED_CHAR: // changed to "%f" from %lf [not ISO C++]
-		sprintf(ret, "%d", (int)*(char*)data);
-		break;
-	case UNSIGNED_CHAR: // changed to "%f" from %lf [not ISO C++]
-		sprintf(ret, "%d", (int)*(unsigned char*)data);
-		break;
-	}
-	if (checkNan(data,dataType)) {
-	    return nanString;	
-	}
-
-	return string(ret);
+    char ret[500];
+    switch(dataType){
+    case UNSIGNED_SHORT_INT:
+        sprintf(ret, "%hu", *(unsigned short int*)data);
+        break;
+    case SHORT_INT:
+        sprintf(ret, "%hd", *(short int*)data);
+        break;
+    case UNSIGNED_INT:
+        sprintf(ret, "%u", *(unsigned int*)data);
+        break;
+    case INT:
+        sprintf(ret, "%d", *(int*)data);
+        break;
+    case FLOAT:
+        sprintf(ret, "%f", *(float*)data);
+        break;
+    case DOUBLE: // changed to "%f" from %lf [not ISO C++]
+        sprintf(ret, "%f", *(double*)data);
+        break;
+    case SIGNED_CHAR: // changed to "%f" from %lf [not ISO C++]
+        sprintf(ret, "%d", (int)*(char*)data);
+        break;
+    case UNSIGNED_CHAR: // changed to "%f" from %lf [not ISO C++]
+        sprintf(ret, "%d", (int)*(unsigned char*)data);
+        break;
+    }
+    if (checkNan(data,dataType)) {
+        return nanString;
+    }
+
+    return string(ret);
 }
 
 void setNan(unsigned short int &i){setNan(&i, UNSIGNED_SHORT_INT);}
@@ -143,60 +155,73 @@ bool checkNan(unsigned char i){return checkNan(&i, UNSIGNED_CHAR);}
 void setNan(void *data, int dataType){
     double dZero = 0.;
     float fZero = 0.;
+
     switch (dataType) {
-        case UNSIGNED_SHORT_INT:
-    	    (*(unsigned short int*) data) = UNSIGNED_SHORT_INT_NAN;
-    		break;
-    	case SHORT_INT:
-    	    (*(short int*) data) = SHORT_INT_NAN;
-    		break;
-    	case UNSIGNED_INT:
-    	    (*(unsigned int*) data) = UNSIGNED_INT_NAN;
-    		break;
-    	case INT:
-    	    (*(int*) data) = INT_NAN;
-    		break;
-    	case FLOAT:
-    	    (*(float*) data) = fZero/fZero;
-    		break;
-    	case DOUBLE:
-    	    (*(double*) data) = dZero/dZero;
-    		break;
-    	case SIGNED_CHAR:
-    	    (*(char*) data) = CHAR_NAN;
-    		break;
-    	case UNSIGNED_CHAR:
-    	    (*(unsigned char*) data) = UNSIGNED_CHAR_NAN;
-    		break;
-    	default:
-    		errorLog << "file contains data of unknown type " << dataType << endl << errorExit;
-   }
+    case UNSIGNED_SHORT_INT:
+        (*(unsigned short int*) data) = UNSIGNED_SHORT_INT_NAN;
+        break;
+    case SHORT_INT:
+        (*(short int*) data) = SHORT_INT_NAN;
+        break;
+    case UNSIGNED_INT:
+        (*(unsigned int*) data) = UNSIGNED_INT_NAN;
+        break;
+    case INT:
+        (*(int*) data) = INT_NAN;
+        break;
+    case FLOAT:
+        (*(float*) data) = fZero/fZero;
+        break;
+    case DOUBLE:
+        (*(double*) data) = dZero/dZero;
+        break;
+    case SIGNED_CHAR:
+        (*(char*) data) = CHAR_NAN;
+        break;
+    case UNSIGNED_CHAR:
+        (*(unsigned char*) data) = UNSIGNED_CHAR_NAN;
+        break;
+    default:
+        errorLog << "file contains data of unknown type " << dataType
+                 << endl << errorExit;
+    }
 }
 
+
 bool checkNan(void *data, int dataType){
     switch (dataType) {
-        case UNSIGNED_SHORT_INT:
-    	    return (*(unsigned short int*) data) == UNSIGNED_SHORT_INT_NAN;
-    	case SHORT_INT:
-    	    return (*(short int*) data) == SHORT_INT_NAN;
-    	case UNSIGNED_INT:
-    	    return (*(unsigned int*) data) == UNSIGNED_INT_NAN;
-    	case INT:
-    	    return (*(int*) data) == INT_NAN;
-    	case FLOAT:
-    	    return isnan(*(float*) data);
-    	case DOUBLE:
-    	    return isnan(*(double*) data);
-    	case UNSIGNED_CHAR:
-    	    return (*(unsigned char*) data) == UNSIGNED_CHAR_NAN;
-    	case SIGNED_CHAR:
-    	    return (*(char*) data) == CHAR_NAN;
-    	default:
-    		errorLog << "file contains data of unknown type " << dataType << endl << errorExit;
-    		return false;
-   }
+    case UNSIGNED_SHORT_INT:
+        return (*(unsigned short int*) data) == UNSIGNED_SHORT_INT_NAN;
+    case SHORT_INT:
+        return (*(short int*) data) == SHORT_INT_NAN;
+    case UNSIGNED_INT:
+        return (*(unsigned int*) data) == UNSIGNED_INT_NAN;
+    case INT:
+        return (*(int*) data) == INT_NAN;
+    case FLOAT:
+#ifdef _NOT_R_FILEVECTOR
+        return std::isnan(*(float*) data);
+#else
+        return ISNAN(*(float*) data);
+#endif
+    case DOUBLE:
+#ifdef _NOT_R_FILEVECTOR
+        return std::isnan(*(double*)data);
+#else
+        return ISNAN(*(double*)data);
+#endif
+    case UNSIGNED_CHAR:
+        return (*(unsigned char*) data) == UNSIGNED_CHAR_NAN;
+    case SIGNED_CHAR:
+        return (*(char*) data) == CHAR_NAN;
+    default:
+        errorLog << "file contains data of unknown type " << dataType
+                 << endl << errorExit;
+        return false;
+    }
 }
 
+
 int getDataType(unsigned short int){return UNSIGNED_SHORT_INT;}
 int getDataType(short int){return SHORT_INT;}
 int getDataType(unsigned int){return UNSIGNED_INT;}
diff --git a/src/fvlib/CastUtils.h b/src/fvlib/CastUtils.h
index 1826bcc..751f2a0 100644
--- a/src/fvlib/CastUtils.h
+++ b/src/fvlib/CastUtils.h
@@ -35,89 +35,96 @@ extern char CHAR_NAN;
 extern unsigned char UNSIGNED_CHAR_NAN;
 
 
-#define COPY_AND_COMPARE(dest,src,warningIsShown)                                                 \
- dest=src;                                                                                        \
- if(warningIsShown == false && (dest!=src || checkNan(dest) != checkNan(src)))                    \
- {                                                                                                \
-    errorLog << "Loss of precision / loss of data during conversion from ";                       \
-    errorLog << dataTypeToString(getDataType(src)) << " to ";                                     \
-    errorLog << dataTypeToString(getDataType(dest)) << "." << endl;                               \
-    errorLog << "Futher conversion warnings omitted." << endl;                                    \
-    warningIsShown = true;                                                                        \
- }                                                                                                
+#define COPY_AND_COMPARE(dest,src,warningIsShown)                       \
+    dest=src;                                                           \
+    if(warningIsShown == false && (dest!=src || checkNan(dest) != checkNan(src))) \
+    {                                                                   \
+        errorLog << "Loss of precision / loss of data during conversion from "; \
+        errorLog << dataTypeToString(getDataType(src)) << " to ";       \
+        errorLog << dataTypeToString(getDataType(dest)) << "." << endl; \
+        errorLog << "Futher conversion warnings omitted." << endl;      \
+        warningIsShown = true;                                          \
+    }
 
-template <class DT> void performCast(DT &dest, void*src, int srcType, bool &warningIsShown) {
-    if (checkNan(src,srcType)){
+template <class DT> void performCast(DT &dest, void*src, int srcType,
+                                     bool &warningIsShown) {
+    if (checkNan(src, srcType)){
         setNan(dest);
         return;
     }
+
     switch (srcType) {
-        case UNSIGNED_SHORT_INT:
-    	    COPY_AND_COMPARE(dest, (DT)*((unsigned short int*) src), warningIsShown);
-    		break;
-    	case SHORT_INT:
-    		COPY_AND_COMPARE(dest, (DT)*((short int*) src), warningIsShown);
-    		break;
-    	case UNSIGNED_INT:
-    		COPY_AND_COMPARE(dest, (DT)*((unsigned int*) src), warningIsShown);
-    		break;
-    	case INT:
-    		COPY_AND_COMPARE(dest, (DT)*((int*) src), warningIsShown);
-    		break;
-    	case FLOAT:
-    		COPY_AND_COMPARE(dest, (DT)*((float*) src), warningIsShown);
-    		break;
-    	case DOUBLE:
-    		COPY_AND_COMPARE(dest, (DT)*((double*) src), warningIsShown);
-    		break;
-    	case SIGNED_CHAR:
-    		COPY_AND_COMPARE(dest, (DT)*((char*) src), warningIsShown);
-    		break;
-    	case UNSIGNED_CHAR:
-    		COPY_AND_COMPARE(dest, (DT)*((unsigned char*) src), warningIsShown);
-    		break;
-    	default:
-    		errorLog << "file contains data of unknown type " << srcType << endl << errorExit;
-   	}
+    case UNSIGNED_SHORT_INT:
+        COPY_AND_COMPARE(dest, (DT)*((unsigned short int*) src), warningIsShown);
+        break;
+    case SHORT_INT:
+        COPY_AND_COMPARE(dest, (DT)*((short int*) src), warningIsShown);
+        break;
+    case UNSIGNED_INT:
+        COPY_AND_COMPARE(dest, (DT)*((unsigned int*) src), warningIsShown);
+        break;
+    case INT:
+        COPY_AND_COMPARE(dest, (DT)*((int*) src), warningIsShown);
+        break;
+    case FLOAT:
+        COPY_AND_COMPARE(dest, (DT)*((float*) src), warningIsShown);
+        break;
+    case DOUBLE:
+        COPY_AND_COMPARE(dest, (DT)*((double*) src), warningIsShown);
+        break;
+    case SIGNED_CHAR:
+        COPY_AND_COMPARE(dest, (DT)*((char*) src), warningIsShown);
+        break;
+    case UNSIGNED_CHAR:
+        COPY_AND_COMPARE(dest, (DT)*((unsigned char*) src), warningIsShown);
+        break;
+    default:
+        errorLog << "file contains data of unknown type " << srcType
+                 << endl << errorExit;
+    }
 }
 
 
-template <class DT> void performCast(void*dest, DT&src, int destType, bool &warningIsShown) {
+template <class DT> void performCast(void*dest, DT&src, int destType,
+                                     bool &warningIsShown) {
     if (checkNan(src)){
         setNan(dest,destType);
         return;
     }
+
     switch (destType) {
-        case UNSIGNED_SHORT_INT:
-    	    COPY_AND_COMPARE(*((unsigned short int*)dest), src, warningIsShown);
-    	    break;
-    	case SHORT_INT:
-    	    COPY_AND_COMPARE(*((short int*)dest), src, warningIsShown);
-    	    break;
-    	case UNSIGNED_INT:
-            COPY_AND_COMPARE(*((unsigned int*)dest), src, warningIsShown);
-        	break;
-    	case INT:
-    	    COPY_AND_COMPARE(*((int*)dest), src, warningIsShown);
-    	    break;
-    	case FLOAT:
-    	    COPY_AND_COMPARE(*((float*)dest), src, warningIsShown);
-    	    break;
-    	case DOUBLE:
-        	COPY_AND_COMPARE(*((double*)dest), src, warningIsShown);
-        	break;
-    	case SIGNED_CHAR:
-        	COPY_AND_COMPARE(*((char*)dest), src, warningIsShown);
-        	break;
-    	case UNSIGNED_CHAR:
-        	COPY_AND_COMPARE(*((unsigned char*)dest), src, warningIsShown);
-        	break;
-    	default:
-    	    errorLog << "file contains data of unknown type " << destType << endl << errorExit;
+    case UNSIGNED_SHORT_INT:
+        COPY_AND_COMPARE(*((unsigned short int*)dest), src, warningIsShown);
+        break;
+    case SHORT_INT:
+        COPY_AND_COMPARE(*((short int*)dest), src, warningIsShown);
+        break;
+    case UNSIGNED_INT:
+        COPY_AND_COMPARE(*((unsigned int*)dest), src, warningIsShown);
+        break;
+    case INT:
+        COPY_AND_COMPARE(*((int*)dest), src, warningIsShown);
+        break;
+    case FLOAT:
+        COPY_AND_COMPARE(*((float*)dest), src, warningIsShown);
+        break;
+    case DOUBLE:
+        COPY_AND_COMPARE(*((double*)dest), src, warningIsShown);
+        break;
+    case SIGNED_CHAR:
+        COPY_AND_COMPARE(*((char*)dest), src, warningIsShown);
+        break;
+    case UNSIGNED_CHAR:
+        COPY_AND_COMPARE(*((unsigned char*)dest), src, warningIsShown);
+        break;
+    default:
+        errorLog << "file contains data of unknown type " << destType
+                 << endl << errorExit;
     }
 }
 
-void parseStringToArbType(string s, int destType, void *destData, string nanString);
+void parseStringToArbType(string s, int destType, void *destData,
+                          string nanString);
 unsigned short int dataTypeFromString(string type);
 string bufToString(short int dataType, char *data, string nanString);
 
diff --git a/src/fvlib/FileVector.cpp b/src/fvlib/FileVector.cpp
index 004b8fe..824f962 100644
--- a/src/fvlib/FileVector.cpp
+++ b/src/fvlib/FileVector.cpp
@@ -7,183 +7,222 @@ using namespace std;
 #include "FileVector.h"
 #include "frutil.h"
 
-void FileVector::saveIndexFile() {
 
+void FileVector::saveIndexFile() {
     if (readOnly)
         return;
 
-	indexFile.fseek(0);
-	indexFile.blockWriteOrRead(sizeof(fileHeader),(char*)&fileHeader, true);
-	indexFile.fseek(sizeof(fileHeader));
-
-	if (observationNames && variableNames) {
-		indexFile.blockWriteOrRead(sizeof(FixedChar)*fileHeader.numObservations,(char*)observationNames,true);
-		indexFile.fseek(sizeof(fileHeader)+sizeof(FixedChar)*fileHeader.numObservations);
-		indexFile.blockWriteOrRead(sizeof(FixedChar)*fileHeader.numVariables,(char*)variableNames,true);
-	}
+    indexFile.fseek(0);
+    indexFile.blockWriteOrRead(sizeof(fileHeader), (char*)&fileHeader, true);
+    indexFile.fseek(sizeof(fileHeader));
+
+    if (observationNames && variableNames) {
+        indexFile.blockWriteOrRead(sizeof(FixedChar) * fileHeader.numObservations,
+                                   (char*)observationNames, true);
+        indexFile.fseek(sizeof(fileHeader) + sizeof(FixedChar) *
+                        fileHeader.numObservations);
+        indexFile.blockWriteOrRead(sizeof(FixedChar) * fileHeader.numVariables,
+                                   (char*)variableNames, true);
+    }
 }
 
+
 void FileVector::deInitialize(){
-	saveIndexFile();
-	delete [] cacheBuffer;
-	cacheBuffer = 0;
-	delete [] observationNames;
-	observationNames = 0;
-	delete [] variableNames;
-	variableNames = 0;
-	indexFile.close();
-	dataFile.close();
-	AbstractMatrix::closeForWriting(filename);
+    saveIndexFile();
+    delete [] cacheBuffer;
+    cacheBuffer = 0;
+    delete [] observationNames;
+    observationNames = 0;
+    delete [] variableNames;
+    variableNames = 0;
+    indexFile.close();
+    dataFile.close();
+    AbstractMatrix::closeForWriting(filename);
 }
 
+
 FileVector::~FileVector() {
-	deInitialize();
+    deInitialize();
 }
 
+
 void FileVector::initialize(unsigned long cachesizeMb) {
-	//Rprintf("initialize, open file %s\n",filename.c_str());
-	dbg << "Opening FileVector '" << filename.c_str() <<"'."<< endl;
+    //Rprintf("initialize, open file %s\n",filename.c_str());
+    dbg << "Opening FileVector '" << filename.c_str() <<"'."<< endl;
 
-	if (!readOnly) {
-		AbstractMatrix::checkOpenForWriting(filename);
-	}
+    if (!readOnly) {
+        AbstractMatrix::checkOpenForWriting(filename);
+    }
 
-	indexFilename = extract_base_file_name(filename) + FILEVECTOR_INDEX_FILE_SUFFIX;
-	dataFilename = extract_base_file_name(filename) + FILEVECTOR_DATA_FILE_SUFFIX;
+    indexFilename = extract_base_file_name(filename) +
+        FILEVECTOR_INDEX_FILE_SUFFIX;
+    dataFilename = extract_base_file_name(filename) +
+        FILEVECTOR_DATA_FILE_SUFFIX;
 
-	if(!file_exists(indexFilename)) {
-		errorLog <<"Index file not exists: " <<  indexFilename << endl << errorExit;
-	}
+    if (!file_exists(indexFilename)) {
+        errorLog << "Index file not exists: " <<  indexFilename
+                 << endl << errorExit;
+    }
 
-	dataFilename = extract_base_file_name(filename) + FILEVECTOR_DATA_FILE_SUFFIX;
-	if(!file_exists(dataFilename))
-		errorLog <<"Data file not exists: " <<  dataFilename.c_str() << endl <<errorExit;
+    dataFilename = extract_base_file_name(filename) + FILEVECTOR_DATA_FILE_SUFFIX;
+    if (!file_exists(dataFilename))
+        errorLog << "Data file not exists: " <<  dataFilename.c_str()
+                 << endl <<errorExit;
 
-	struct stat data_filestatus;
-	stat(dataFilename.c_str(), &data_filestatus);
+    struct stat data_filestatus;
+    stat(dataFilename.c_str(), &data_filestatus);
 
-	struct stat index_filestatus;
-	stat(indexFilename.c_str(), &index_filestatus);
+    struct stat index_filestatus;
+    stat(indexFilename.c_str(), &index_filestatus);
 
     indexFile = ReusableFileHandle::getHandle(indexFilename, readOnly);
 
-	if (!indexFile) {
-		errorLog << "Opening file "<< indexFilename <<" for write & read failed\n" << errorExit;
-	}
+    if (!indexFile) {
+        errorLog << "Opening file " << indexFilename
+                 << " for write & read failed\n" << errorExit;
+    }
 
     dataFile = ReusableFileHandle::getHandle(dataFilename, readOnly);
 
-	if (!dataFile) {
-		errorLog << "Opening file "<< dataFilename << " for write & read failed\n" << errorExit;
-	}
-
-	indexFile.blockWriteOrRead(sizeof(fileHeader),(char*)&fileHeader, false);
-	if (!indexFile){
-		errorLog << "Failed to read datainfo from file:" << indexFilename << endl;
-	}
-
-	// some integrity checks
-	if (getElementSize() != fileHeader.bytesPerRecord) {
-		errorLog << "System data type size ("<<getElementSize();
-		errorLog <<") and file data type size ("<<fileHeader.bytesPerRecord<<") do not match.\n";
-	}
-
-	//!!! nelements should actually be long to ensure !!!
-	if (fileHeader.nelements != (fileHeader.numObservations*fileHeader.numVariables)) {
-		errorLog << "Number of variables ("<<fileHeader.numVariables;
-		errorLog << ") and observations ("<<fileHeader.numObservations<<") do not multiply to nelements";
-		errorLog << "("<< fileHeader.nelements<<") (file integrity issue?)\n";
-		errorLog << errorExit;
-	}
-
-	if ((fileHeader.bytesPerRecord != (fileHeader.bitsPerRecord/8)) ||
-			((fileHeader.bitsPerRecord % 8) != 0) || (fileHeader.bitsPerRecord < 8)) {
-		errorLog << "Size in bytes/bits do not match or bit-size of char !=8 or ";
-		errorLog << "non-byte recods (file integrity issue?)" << errorExit;
-	}
-
-	unsigned long indexSize = sizeof(fileHeader) + sizeof(FixedChar)*(fileHeader.numVariables+fileHeader.numObservations);
-	if(indexSize != (unsigned long) index_filestatus.st_size) {
-		errorLog << "Index file "<<indexFilename<<" size(" << (int) index_filestatus.st_size << ") differs from the expected(";
-		errorLog << indexSize <<")" << endl << errorExit;
-	}
-
-	// temp fix because nelements is not yet long ... !!!
-	//	unsigned long estimated_size = data_type.bytes_per_record*data_type.nelements + headerSize;
-	unsigned long estimated_size =
-			(unsigned long) fileHeader.bytesPerRecord *
-			(unsigned long) fileHeader.numVariables *
-			(unsigned long) fileHeader.numObservations;
-
-	if (estimated_size != (unsigned long) data_filestatus.st_size) {
-		errorLog << "Data file size (" << (int) data_filestatus.st_size;
-		errorLog << ") differs from the expected ("<<estimated_size<<")"<<endl<<" [";
-		errorLog << fileHeader.numVariables<<","<<fileHeader.numObservations<<"]" << endl;
-		errorLog << errorExit;
-	}
-
-	variableNames = 0;
-	observationNames = 0;
-
-	setCacheSizeInMb(cachesizeMb);
-	updateCache(0);
-	dbg << "Filevector " << filename << " opened." << endl;
+    if (!dataFile) {
+        errorLog << "Opening file " << dataFilename
+                 << " for write & read failed\n" << errorExit;
+    }
+
+    indexFile.blockWriteOrRead(sizeof(fileHeader), (char*)&fileHeader, false);
+    if (!indexFile){
+        errorLog << "Failed to read datainfo from file:"
+                 << indexFilename << endl;
+    }
+
+    // some integrity checks
+    if (getElementSize() != fileHeader.bytesPerRecord) {
+        errorLog << "System data type size (" << getElementSize();
+        errorLog <<") and file data type size ("
+                 << fileHeader.bytesPerRecord <<") do not match.\n";
+    }
+
+    //!!! nelements should actually be long to ensure !!!
+    if (fileHeader.nelements !=
+        (fileHeader.numObservations * fileHeader.numVariables)) {
+        errorLog << "Number of variables (" << fileHeader.numVariables;
+        errorLog << ") and observations (" << fileHeader.numObservations
+                 << ") do not multiply to nelements";
+        errorLog << "(" << fileHeader.nelements << ") (file integrity issue?)\n";
+        errorLog << errorExit;
+    }
+
+    if ((fileHeader.bytesPerRecord != (fileHeader.bitsPerRecord/8)) ||
+        ((fileHeader.bitsPerRecord % 8) != 0) || (fileHeader.bitsPerRecord < 8)) {
+        errorLog << "Size in bytes/bits do not match or bit-size of char !=8 or ";
+        errorLog << "non-byte recods (file integrity issue?)" << errorExit;
+    }
+
+    unsigned long indexSize = sizeof(fileHeader) + sizeof(FixedChar) *
+        (fileHeader.numVariables + fileHeader.numObservations);
+    if(indexSize != (unsigned long) index_filestatus.st_size) {
+        errorLog << "Index file " << indexFilename << " size("
+                 << (int) index_filestatus.st_size
+                 << ") differs from the expected(";
+        errorLog << indexSize <<")" << endl << errorExit;
+    }
+
+    // temp fix because nelements is not yet long ... !!!
+    //	unsigned long estimated_size = data_type.bytes_per_record*data_type.nelements + headerSize;
+    unsigned long estimated_size =
+        (unsigned long) fileHeader.bytesPerRecord *
+        (unsigned long) fileHeader.numVariables *
+        (unsigned long) fileHeader.numObservations;
+
+    if (estimated_size != (unsigned long) data_filestatus.st_size) {
+        errorLog << "Data file size (" << (int) data_filestatus.st_size;
+        errorLog << ") differs from the expected (" << estimated_size << ")"
+                 << endl << " [";
+        errorLog << fileHeader.numVariables << ","
+                 << fileHeader.numObservations<<"]" << endl;
+        errorLog << errorExit;
+    }
+
+    variableNames = 0;
+    observationNames = 0;
+
+    setCacheSizeInMb(cachesizeMb);
+    updateCache(0);
+    dbg << "Filevector " << filename << " opened." << endl;
 }
 
+
 // read in variable and observation names
 void FileVector::readNames() {
-	if (variableNames) delete[]variableNames;
-	if (observationNames) delete[]observationNames;
-
-	variableNames = new (nothrow) FixedChar [fileHeader.numVariables];
-	if (!variableNames) errorLog << "can not get RAM for variable names" << errorExit;
-	observationNames = new (nothrow) FixedChar [fileHeader.numObservations];
-	if (!observationNames) errorLog << "can not get RAM for observation names" << errorExit;
+    if (variableNames) delete[] variableNames;
+    if (observationNames) delete[] observationNames;
+
+    variableNames = new (nothrow) FixedChar [fileHeader.numVariables];
+    if (!variableNames)
+        errorLog << "can not get RAM for variable names" << errorExit;
+
+    observationNames = new (nothrow) FixedChar [fileHeader.numObservations];
+    if (!observationNames)
+        errorLog << "can not get RAM for observation names" << errorExit;
+
+    indexFile.fseek(sizeof(fileHeader));
+    for (unsigned long i = 0; i < fileHeader.numObservations; i++)
+    {
+        indexFile.blockWriteOrRead(sizeof(FixedChar),
+                                   (char*)(observationNames+i), false);
+    }
 
-	indexFile.fseek(sizeof(fileHeader));
-	for (unsigned long i=0;i<fileHeader.numObservations;i++)
-		indexFile.blockWriteOrRead(sizeof(FixedChar), (char*)(observationNames+i), false);
-	for (unsigned long i=0;i<fileHeader.numVariables;i++)
-		indexFile.blockWriteOrRead(sizeof(FixedChar), (char*)(variableNames+i), false);
+    for (unsigned long i = 0; i < fileHeader.numVariables; i++)
+        indexFile.blockWriteOrRead(sizeof(FixedChar),
+                                   (char*)(variableNames+i), false);
 }
 
 unsigned long FileVector::getCacheSizeInMb() {
-	return cache_size_Mb;
+    return cache_size_Mb;
 }
 
 void FileVector::setCacheSizeInMb( unsigned long cachesizeMb ) {
-	// figure out cache size
-	cache_size_Mb = cachesizeMb;
-	cache_size_nvars = (unsigned long) 1024*1024*cache_size_Mb/(fileHeader.numObservations*fileHeader.bytesPerRecord);
-	if (cache_size_nvars<1) {
-		cache_size_Mb = (unsigned long) ceil(
-				(float) fileHeader.numObservations*fileHeader.bytesPerRecord/(1024.*1024.)
-		);
-		cache_size_nvars = 1;
-	} else if (cache_size_nvars>fileHeader.numVariables) {
-		cache_size_Mb = (unsigned long) ceil(
-				(float) fileHeader.numVariables*fileHeader.numObservations*fileHeader.bytesPerRecord/(1024.*1024.)
-		);
-		cache_size_nvars = fileHeader.numVariables;
-	}
-	cache_size_bytes = cache_size_nvars*fileHeader.bytesPerRecord*fileHeader.numObservations*sizeof(char);
-
-	//free previously allocated memory
-	if(cacheBuffer !=0 )
-		delete []cacheBuffer;
-	// get memory for the cache
-	cacheBuffer = new (nothrow) char [cache_size_bytes];
-	if (!cacheBuffer)
-		errorLog << "failed to get memory for cache" << endl << errorExit;
-	max_buffer_size_bytes = INT_MAX;
-
-	//don't read cache after resizing,
-	//it will be updated on next read operation from desired position
-	cacheBegin = 1;
-	cacheEnd = 0;
-}
-
-void FileVector::calcCachePos(unsigned long newCenterPos, unsigned long &cacheBeginRef, unsigned long &cacheEndRef){
+    // figure out cache size
+    cache_size_Mb = cachesizeMb;
+    cache_size_nvars = (unsigned long) 1024 * 1024 * cache_size_Mb /
+        (fileHeader.numObservations * fileHeader.bytesPerRecord);
+
+    if (cache_size_nvars < 1) {
+        cache_size_Mb = (unsigned long) ceil(
+            (float) fileHeader.numObservations * fileHeader.bytesPerRecord /
+            (1024.*1024.)
+            );
+        cache_size_nvars = 1;
+    } else if (cache_size_nvars > fileHeader.numVariables) {
+        cache_size_Mb = (unsigned long) ceil(
+            (float) fileHeader.numVariables * fileHeader.numObservations *
+            fileHeader.bytesPerRecord / (1024. * 1024.)
+            );
+        cache_size_nvars = fileHeader.numVariables;
+    }
+    cache_size_bytes = cache_size_nvars * fileHeader.bytesPerRecord *
+        fileHeader.numObservations * sizeof(char);
+
+    //free previously allocated memory
+    if(cacheBuffer !=0 )
+        delete[] cacheBuffer;
+    // get memory for the cache
+    cacheBuffer = new (nothrow) char [cache_size_bytes];
+    if (!cacheBuffer)
+        errorLog << "failed to get memory for cache" << endl << errorExit;
+
+    max_buffer_size_bytes = INT_MAX;
+
+    //don't read cache after resizing,
+    //it will be updated on next read operation from desired position
+    cacheBegin = 1;
+    cacheEnd = 0;
+}
+
+
+void FileVector::calcCachePos(unsigned long newCenterPos,
+                              unsigned long &cacheBeginRef,
+                              unsigned long &cacheEndRef){
     if (cache_size_nvars == getNumVariables()) {
         cacheBeginRef = 0;
         cacheEndRef = getNumVariables();
@@ -194,7 +233,7 @@ void FileVector::calcCachePos(unsigned long newCenterPos, unsigned long &cacheBe
     cacheEndRef = cacheBeginRef + cache_size_nvars;
 
     //cacheBeginRef < 0 ?
-    if (newCenterPos < cache_size_nvars/2) {
+    if (newCenterPos < cache_size_nvars / 2) {
         cacheBeginRef = 0;
         cacheEndRef = cacheBeginRef + cache_size_nvars;
         return;
@@ -206,15 +245,16 @@ void FileVector::calcCachePos(unsigned long newCenterPos, unsigned long &cacheBe
     }
 }
 
+
 void FileVector::updateCache(unsigned long varIdx) {
     // first load ?
-    if (cacheEnd==0 && cacheBegin==1){
+    if (cacheEnd == 0 && cacheBegin == 1){
         calcCachePos(varIdx, cacheBegin, cacheEnd);
         dataFile.fseek(cacheBegin);
         dbg << "First time cache load." << endl;
         dataFile.blockWriteOrRead(cache_size_bytes, cacheBuffer, false);
         if (!dataFile){
-            errorLog << "Inner error reading file."<< endl << errorExit;
+            errorLog << "Inner error reading file." << endl << errorExit;
         }
         return;
     }
@@ -243,7 +283,7 @@ void FileVector::updateCache(unsigned long varIdx) {
     unsigned long newCacheEnd;
 
     calcCachePos(newCenter, newCacheBegin, newCacheEnd);
-    
+
     // update cache ?
     if (newCacheBegin == cacheBegin) {
         return;
@@ -273,449 +313,564 @@ void FileVector::updateCache(unsigned long varIdx) {
     memMoveSize = cache_size_nvars - hddReadSize;
 
     if (memMoveSize>0){
-        memmove(cacheBuffer + newPos * getElementSize() * getNumObservations(), cacheBuffer + oldPos * getElementSize() * getNumObservations(),  memMoveSize * getElementSize() * getNumObservations());    
+        memmove(cacheBuffer + newPos * getElementSize() * getNumObservations(),
+                cacheBuffer + oldPos * getElementSize() * getNumObservations(),
+                memMoveSize * getElementSize() * getNumObservations());
     }
 
     dataFile.fseek(loadPos * getElementSize() * getNumObservations());
-    dataFile.blockWriteOrRead( hddReadSize* getElementSize() * getNumObservations(), cacheBuffer+inMemLoadPos* getElementSize() * getNumObservations(), false);
+    dataFile.blockWriteOrRead(hddReadSize * getElementSize() *
+                              getNumObservations(),
+                              cacheBuffer + inMemLoadPos * getElementSize() *
+                              getNumObservations(), false);
     if (!dataFile){
-        errorLog << "Inner error reading file."<< endl << errorExit;
+        errorLog << "Inner error reading file." << endl << errorExit;
     }
 
     cacheBegin = newCacheBegin;
     cacheEnd = newCacheEnd;
 }
 
+
 void FileVector::setUpdateNamesOnWrite(bool bUpdate) {
-	updateNamesOnWrite = bUpdate;
+    updateNamesOnWrite = bUpdate;
 }
 
+
 void FileVector::cacheAllNames(bool doCache) {
-	if (doCache) {
-		if (variableNames || observationNames) {
-			dbg << "FileVector.cacheAllNames(true) called while variable names are already cached." << endl;
-			return;
-		}
-		readNames();
-	} else {
-		if (variableNames) {
-			delete[] variableNames;
-			variableNames = 0;
-		}
-		if (observationNames) {
-			delete [] observationNames;
-			observationNames = 0;
-		}
-	}
+    if (doCache) {
+        if (variableNames || observationNames) {
+            dbg << "FileVector.cacheAllNames(true) called while variable "
+                << "names are already cached." << endl;
+            return;
+        }
+        readNames();
+    } else {
+        if (variableNames) {
+            delete[] variableNames;
+            variableNames = 0;
+        }
+        if (observationNames) {
+            delete[] observationNames;
+            observationNames = 0;
+        }
+    }
 }
 
+
 void FileVector::writeVariableName(unsigned long varIdx, FixedChar name) {
-	if (varIdx >= fileHeader.numVariables) {
-		errorLog << "Trying to set name of obs out of range (" << varIdx << ")\n\n" << endl << errorExit;
-	}
-	if ((updateNamesOnWrite||variableNames == 0)&&!readOnly){
-		indexFile.fseek(sizeof(fileHeader) + sizeof(FixedChar)*(varIdx + fileHeader.numObservations));
-		indexFile.blockWriteOrRead(sizeof(FixedChar),(char*)&name, true);
-		indexFile.flush();
-	}
-	if (variableNames) {
-		variableNames[varIdx] = name;
-	}
+    if (varIdx >= fileHeader.numVariables) {
+        errorLog << "Trying to set name of obs out of range (" << varIdx
+                 << ")\n\n" << endl << errorExit;
+    }
+
+    if ((updateNamesOnWrite || variableNames == 0) && !readOnly){
+        indexFile.fseek(sizeof(fileHeader) + sizeof(FixedChar) *
+                        (varIdx + fileHeader.numObservations));
+        indexFile.blockWriteOrRead(sizeof(FixedChar), (char*)&name, true);
+        indexFile.flush();
+    }
+
+    if (variableNames) {
+        variableNames[varIdx] = name;
+    }
 }
 
+
 void FileVector::writeObservationName(unsigned long obsIdx, FixedChar name) {
-	if (obsIdx >= fileHeader.numObservations) {
-		errorLog << "Trying to set name of vars out of range (" << obsIdx << ")\n\n" << endl << errorExit;
-	}
-	if ((updateNamesOnWrite || observationNames == 0)&&!readOnly){
-		indexFile.fseek(sizeof(fileHeader) + sizeof(FixedChar)*(obsIdx));
-		indexFile.blockWriteOrRead(sizeof(FixedChar),(char*)&name, true);
-		indexFile.flush();
-	}
-	if (observationNames) {
-		observationNames[obsIdx] = name;
-	}
+    if (obsIdx >= fileHeader.numObservations) {
+        errorLog << "Trying to set name of vars out of range (" << obsIdx
+                 << ")\n\n" << endl << errorExit;
+    }
+
+    if ((updateNamesOnWrite || observationNames == 0) && !readOnly){
+        indexFile.fseek(sizeof(fileHeader) + sizeof(FixedChar) * (obsIdx));
+        indexFile.blockWriteOrRead(sizeof(FixedChar), (char*)&name, true);
+        indexFile.flush();
+    }
+
+    if (observationNames) {
+        observationNames[obsIdx] = name;
+    }
 }
 
+
 FixedChar FileVector::readVariableName(unsigned long varIdx) {
-	if (varIdx>=fileHeader.numVariables) {
-		errorLog << "trying to get name of var out of range" << errorExit;
-	}
+    if (varIdx >= fileHeader.numVariables) {
+        errorLog << "trying to get name of var out of range" << errorExit;
+    }
 
-	if (!variableNames) {
-		FixedChar ret;
-		indexFile.fseek(sizeof(fileHeader) + sizeof(FixedChar)*(varIdx+fileHeader.numObservations));
-		indexFile.blockWriteOrRead(sizeof(FixedChar),(char*)&ret, false);
-		return ret;
-	}
+    if (!variableNames) {
+        FixedChar ret;
+        indexFile.fseek(sizeof(fileHeader) +
+                        sizeof(FixedChar) * (varIdx+fileHeader.numObservations));
+        indexFile.blockWriteOrRead(sizeof(FixedChar), (char*)&ret, false);
+        return ret;
+    }
 
-	return variableNames[varIdx];
+    return variableNames[varIdx];
 }
 
+
 FixedChar FileVector::readObservationName(unsigned long obsIdx) {
-	if (obsIdx >= fileHeader.numObservations) {
-		errorLog << "trying to get name of obs out of range" << errorExit;
-	}
+    if (obsIdx >= fileHeader.numObservations) {
+        errorLog << "trying to get name of obs out of range" << errorExit;
+    }
 
-	if (!observationNames) {
-		FixedChar ret;
-		indexFile.fseek(sizeof(fileHeader) + sizeof(FixedChar)*(obsIdx));
-		indexFile.blockWriteOrRead( sizeof(FixedChar),(char*)&ret,false);
-		return ret;
-	}
+    if (!observationNames) {
+        FixedChar ret;
+        indexFile.fseek(sizeof(fileHeader) + sizeof(FixedChar)*(obsIdx));
+        indexFile.blockWriteOrRead(sizeof(FixedChar), (char*)&ret, false);
+        return ret;
+    }
 
-	return observationNames[obsIdx];
+    return observationNames[obsIdx];
 }
 
+
 // can read single variable
 void FileVector::readVariable(unsigned long varIdx, void * outvec) {
-	if (varIdx>=fileHeader.numVariables) {
-		errorLog << "Variable number out of range (" << varIdx << " >= " << fileHeader.numVariables <<")"<<endl << errorExit;
-	}
-	updateCache(varIdx);
-	unsigned long offset = (varIdx - cacheBegin)*fileHeader.numObservations*getElementSize();
-	memcpy(outvec,cacheBuffer+offset,getElementSize()*(fileHeader.numObservations));
+    if (varIdx >= fileHeader.numVariables) {
+        errorLog << "Variable number out of range (" << varIdx
+                 << " >= " << fileHeader.numVariables << ")"
+                 << endl << errorExit;
+    }
+    updateCache(varIdx);
+    unsigned long offset = (varIdx - cacheBegin) *
+        fileHeader.numObservations * getElementSize();
+    memcpy(outvec, cacheBuffer+offset,
+           getElementSize() * (fileHeader.numObservations));
 }
 
-void FileVector::readObservation(unsigned long obsIdx, void *outvec) {
-	char * tmpdata = new (nothrow) char [getNumObservations()*getElementSize()];
-	if(!tmpdata)
-		errorLog << "readObservation: cannot allocate tmpdata" << errorExit;
 
-	for(unsigned long int i = 0; i< getNumVariables(); i++)
-	{
-		readVariable(i, tmpdata);
-		memcpy((char*)outvec+i*getElementSize(),tmpdata+getElementSize()*obsIdx,getElementSize());
-	}
-	delete[] tmpdata;
+void FileVector::readObservation(unsigned long obsIdx, void *outvec) {
+    char * tmpdata = new (nothrow) char [getNumObservations()*getElementSize()];
+    if (!tmpdata)
+        errorLog << "readObservation: cannot allocate tmpdata" << errorExit;
+
+    for (unsigned long int i = 0; i< getNumVariables(); i++)
+    {
+        readVariable(i, tmpdata);
+        memcpy((char*)outvec + i * getElementSize(),
+               tmpdata + getElementSize() * obsIdx,
+               getElementSize());
+    }
+    delete[] tmpdata;
 }
 
+
 void FileVector::writeObservation(unsigned long obsIdx, void * invec) {
-	if (readOnly) {
-		errorLog << "Trying to write to the readonly file." << errorExit;
-	}
-	for(unsigned long int i = 0; i< getNumVariables(); i++)	{
-		writeElement( i, obsIdx, (char*)invec+ i*getElementSize() );
-	}
+    if (readOnly) {
+        errorLog << "Trying to write to the readonly file." << errorExit;
+    }
+    for (unsigned long int i = 0; i < getNumVariables(); i++)	{
+        writeElement(i, obsIdx, (char*)invec + i * getElementSize() );
+    }
 }
 
+
 // can write single variable
 void FileVector::writeVariable(unsigned long varIdx, void * datavec) {
-	if (readOnly) {
-		errorLog << "Trying to write to the readonly file." << errorExit;
-	}
-	unsigned long pos = nrnc_to_nelem(varIdx, 0);
-	dataFile.fseek(pos*getElementSize());
-	dataFile.blockWriteOrRead(getElementSize()*fileHeader.numObservations, (char*)datavec, true);
-	dataFile.flush();
-	if (!dataFile) {
-		errorLog <<"failed to write to data file\n"<<errorExit;
-	}
-
-	if (varIdx >= cacheBegin && varIdx < cacheEnd)
-	{
-		unsigned long offset = (varIdx - cacheBegin)*fileHeader.numObservations*getElementSize();
-		memcpy(cacheBuffer + offset,datavec,getElementSize()*fileHeader.numObservations);
-	}
-}
-
-unsigned long FileVector::nrnc_to_nelem(unsigned long varIdx, unsigned long obsIdx) {
-	if (varIdx >= fileHeader.numVariables) {
-		errorLog << "Variable number out of bounds (" << varIdx << " >= " <<  fileHeader.numVariables << ")" << endl << errorExit;
-	}
-	if (obsIdx >= fileHeader.numObservations) {
-		errorLog << "Observation number out of bounds (" << obsIdx << " >= " <<  fileHeader.numVariables << ")" << endl << errorExit;
-	}
-	return( varIdx * fileHeader.numObservations + obsIdx );
+    if (readOnly) {
+        errorLog << "Trying to write to the readonly file." << errorExit;
+    }
+    unsigned long pos = nrnc_to_nelem(varIdx, 0);
+    dataFile.fseek(pos * getElementSize());
+    dataFile.blockWriteOrRead(getElementSize() * fileHeader.numObservations,
+                              (char*)datavec, true);
+    dataFile.flush();
+    if (!dataFile) {
+        errorLog << "failed to write to data file\n" << errorExit;
+    }
+
+    if (varIdx >= cacheBegin && varIdx < cacheEnd)
+    {
+        unsigned long offset = (varIdx - cacheBegin) *
+            fileHeader.numObservations * getElementSize();
+        memcpy(cacheBuffer + offset,
+               datavec,
+               getElementSize() * fileHeader.numObservations);
+    }
+}
+
+
+unsigned long FileVector::nrnc_to_nelem(unsigned long varIdx,
+                                        unsigned long obsIdx) {
+    if (varIdx >= fileHeader.numVariables) {
+        errorLog << "Variable number out of bounds (" << varIdx
+                 << " >= " <<  fileHeader.numVariables << ")"
+                 << endl << errorExit;
+    }
+
+    if (obsIdx >= fileHeader.numObservations) {
+        errorLog << "Observation number out of bounds (" << obsIdx
+                 << " >= " <<  fileHeader.numVariables << ")"
+                 << endl << errorExit;
+    }
+    return( varIdx * fileHeader.numObservations + obsIdx );
 }
 
-// should only be used for reading single random elements!
 
-void FileVector::readElement(unsigned long varIdx, unsigned long obsIdx, void* out) {
-	unsigned long pos = nrnc_to_nelem(varIdx, obsIdx);
-	deepDbg << "FileVector.readElement(" << varIdx << "," << obsIdx << "), pos = " << pos << ", ";
-	dataFile.fseek(pos*getElementSize());
-	dataFile.blockWriteOrRead(getElementSize(), (char*)out, false);
+// should only be used for reading single random elements!
+void FileVector::readElement(unsigned long varIdx, unsigned long obsIdx,
+                             void* out) {
+    unsigned long pos = nrnc_to_nelem(varIdx, obsIdx);
+    deepDbg << "FileVector.readElement(" << varIdx << "," << obsIdx
+            << "), pos = " << pos << ", ";
+    dataFile.fseek(pos * getElementSize());
+    dataFile.blockWriteOrRead(getElementSize(), (char*)out, false);
 }
 
-void FileVector::writeElement(unsigned long varIdx, unsigned long obsIdx, void* data) {
-	if (readOnly) {
-		errorLog << "Trying to write to the readonly file." << errorExit;
-	}
-	deepDbg << "FileVector.writeElement(" << varIdx << "," << obsIdx << ");" << endl;
-	unsigned long pos = nrnc_to_nelem(varIdx, obsIdx);
-	dataFile.fseek(pos*getElementSize());
-	dataFile.blockWriteOrRead(getElementSize(),(char*)data, true);
-	dataFile.flush();
 
-	if (varIdx >= cacheBegin && varIdx < cacheEnd) {
-		unsigned long offset = (varIdx - cacheBegin)*fileHeader.numObservations*getElementSize() + obsIdx *getElementSize();
-		memcpy(cacheBuffer+offset,data,getElementSize() );
-	}
+void FileVector::writeElement(unsigned long varIdx, unsigned long obsIdx,
+                              void* data) {
+    if (readOnly) {
+        errorLog << "Trying to write to the readonly file." << errorExit;
+    }
+    deepDbg << "FileVector.writeElement(" << varIdx << "," << obsIdx << ");"
+            << endl;
+    unsigned long pos = nrnc_to_nelem(varIdx, obsIdx);
+    dataFile.fseek(pos * getElementSize());
+    dataFile.blockWriteOrRead(getElementSize(), (char*)data, true);
+    dataFile.flush();
+
+    if (varIdx >= cacheBegin && varIdx < cacheEnd) {
+        unsigned long offset = (varIdx - cacheBegin) *
+            fileHeader.numObservations * getElementSize() +
+            obsIdx *getElementSize();
+        memcpy(cacheBuffer+offset, data, getElementSize() );
+    }
 }
 
+
 unsigned long FileVector::getNumVariables() {
-	return fileHeader.numVariables;
+    return fileHeader.numVariables;
 }
 
+
 unsigned long FileVector::getNumObservations() {
-	return fileHeader.numObservations;
+    return fileHeader.numObservations;
 }
 
-void FileVector::saveAs( string newFilename ) {
-	initializeEmptyFile( (char *)newFilename.c_str(), getNumVariables(), getNumObservations(), fileHeader.type, true);
-	FileVector *outdata = new FileVector( newFilename, 64 );//todo which size for cache to use?
 
-	// copy observation names from the first object
-	for (unsigned long i=0;i<getNumObservations();i++)
-		outdata->writeObservationName( i, readObservationName( i ) );
+void FileVector::saveAs( string newFilename ) {
+    initializeEmptyFile( (char *)newFilename.c_str(),
+                         getNumVariables(), getNumObservations(),
+                         fileHeader.type, true);
+    FileVector *outdata = new FileVector( newFilename, 64 );  //todo which size for cache to use?
+
+    // copy observation names from the first object
+    for (unsigned long i = 0; i < getNumObservations(); i++)
+        outdata->writeObservationName( i, readObservationName(i) );
+
+    char * tmpvariable =
+        new (nothrow) char[getNumObservations() * getElementSize()];
+
+    if (!tmpvariable)
+        errorLog << "can not allocate memory for tmpvariable"
+                 << endl << endl << errorExit;
+
+    for (unsigned long i = 0; i < getNumVariables(); i++)
+    {
+        //write var names
+        outdata->writeVariableName(i, readVariableName(i));
+        //write variables
+        readVariable(i, tmpvariable);
+        outdata->writeVariable(i, tmpvariable);
+    }
+    delete outdata;
+    delete [] tmpvariable;
+}
 
-	char * tmpvariable = new (nothrow) char[getNumObservations()*getElementSize()];
-	if (!tmpvariable) errorLog << "can not allocate memory for tmpvariable" << endl << endl << errorExit;
 
-	for (unsigned long i=0 ; i<getNumVariables();i++)
-	{
-		//write var names
-		outdata->writeVariableName( i, readVariableName(i));
-		//write variables
-		readVariable(i,tmpvariable);
-		outdata->writeVariable(i,tmpvariable);
-	}
-	delete outdata;
-	delete [] tmpvariable;
-}
+void FileVector::saveVariablesAs(string newFilename, unsigned long nvars,
+                                 unsigned long *varindexes) {
+    initializeEmptyFile( (char *)newFilename.c_str(), nvars,
+                         getNumObservations(), fileHeader.type, true);
+    FileVector outdata( newFilename, 64 );  //todo which size for cache to use?
 
-void FileVector::saveVariablesAs( string newFilename, unsigned long nvars, unsigned long *varindexes) {
-	initializeEmptyFile( (char *)newFilename.c_str(), nvars, getNumObservations(), fileHeader.type, true);
-	FileVector outdata( newFilename, 64 );//todo which size for cache to use?
+    // copy observation names from the first object
+    for (unsigned long i = 0; i < getNumObservations(); i++)
+        outdata.writeObservationName(i, readObservationName(i) );
 
-	// copy observation names from the first object
-	for (unsigned long i=0;i<getNumObservations();i++)
-		outdata.writeObservationName( i, readObservationName( i ) );
+    char * tmpvariable =
+        new (nothrow) char[getNumObservations() * getElementSize()];
 
-	char * tmpvariable = new (nothrow) char[getNumObservations()*getElementSize()];
-	if (!tmpvariable) errorLog << "can not allocate memory for tmpvariable" << endl << endl << errorExit;
+    if (!tmpvariable)
+        errorLog << "can not allocate memory for tmpvariable"
+                 << endl << endl << errorExit;
 
-	for ( unsigned long i=0 ; i<nvars ; i++ )
-	{
-		unsigned long selected_index =  varindexes[i];
-		//write var names
-		outdata.writeVariableName( i, readVariableName(selected_index ));
-		//write variables
-		readVariable(selected_index,tmpvariable);
-		outdata.writeVariable(i,tmpvariable);
-	}
+    for (unsigned long i = 0; i < nvars; i++ )
+    {
+        unsigned long selected_index =  varindexes[i];
+        //write var names
+        outdata.writeVariableName(i, readVariableName(selected_index));
+        //write variables
+        readVariable(selected_index, tmpvariable);
+        outdata.writeVariable(i, tmpvariable);
+    }
 
-	delete [] tmpvariable;
+    delete [] tmpvariable;
 }
 
+
 string FileVector::getFileName() {
     return filename;
 }
 
 
-void FileVector::saveObservationsAs( string newFilename, unsigned long nobss, unsigned long *obsindexes) {
-	if (headerOrDataExists(newFilename))
-	{
-		errorLog << "File " << newFilename <<" already exists" << endl << errorExit;
-	}
-	initializeEmptyFile( (char *)newFilename.c_str(), getNumVariables(), nobss, fileHeader.type,true);
-	FileVector outdata( newFilename, 64 );//todo which size for cache to use?
-
-	// copy observation names from the first object
-	for( unsigned long i=0 ; i < nobss ; i++ )
-		outdata.writeObservationName( i, readObservationName( obsindexes[i] ) );
-
-	char * in_variable = new (nothrow) char[getNumObservations()*getElementSize()];
-	if (!in_variable) errorLog << "can not allocate memory for tmpvariable" << endl << endl << errorExit;
+void FileVector::saveObservationsAs( string newFilename, unsigned long nobss,
+                                     unsigned long *obsindexes) {
+    if (headerOrDataExists(newFilename))
+    {
+        errorLog << "File " << newFilename <<" already exists"
+                 << endl << errorExit;
+    }
 
-	char * out_variable = new (nothrow) char[nobss*getElementSize()];
-	if (!out_variable) errorLog << "can not allocate memory for tmpvariable" << endl << endl << errorExit;
-	for ( unsigned long i=0 ; i<getNumVariables() ; i++ )
-	{
-		//write var names
-		outdata.writeVariableName( i, readVariableName(i));
-		//write variables
-		readVariable(i, in_variable);
-		copyVariable(out_variable, in_variable, nobss, obsindexes);
-		outdata.writeVariable(i,out_variable);
-	}
+    initializeEmptyFile( (char *)newFilename.c_str(), getNumVariables(),
+                         nobss, fileHeader.type, true);
+    FileVector outdata( newFilename, 64 );  //todo which size for cache to use?
+
+    // copy observation names from the first object
+    for (unsigned long i = 0; i < nobss; i++ )
+        outdata.writeObservationName(i, readObservationName( obsindexes[i] ) );
+
+    char * in_variable =
+        new (nothrow) char[getNumObservations() * getElementSize()];
+
+    if (!in_variable)
+        errorLog << "can not allocate memory for tmpvariable"
+                 << endl << endl << errorExit;
+
+    char * out_variable = new (nothrow) char[nobss*getElementSize()];
+    if (!out_variable)
+        errorLog << "can not allocate memory for tmpvariable"
+                 << endl << endl << errorExit;
+
+    for (unsigned long i = 0; i < getNumVariables(); i++)
+    {
+        //write var names
+        outdata.writeVariableName(i, readVariableName(i));
+        //write variables
+        readVariable(i, in_variable);
+        copyVariable(out_variable, in_variable, nobss, obsindexes);
+        outdata.writeVariable(i, out_variable);
+    }
 
-	delete [] in_variable;
-	delete [] out_variable;
+    delete [] in_variable;
+    delete [] out_variable;
 }
 
+
 /*
  * copy elements from "from" array to "to" array, according to "n" and "indexes" parameters
  */
-void FileVector::copyVariable(char* to, char* from, int n, unsigned long * indexes ) {
-	for ( int j=0 ; j<n ; j++ )	{
-		//copy only selected observations to out_variable  from in_variable
-		unsigned long int read_offset = indexes[j]*getElementSize();
-		if(read_offset + getElementSize() > getNumObservations() * getElementSize()) {
-			errorLog << "When saving selected observations: index in obsindexes(" <<indexes[j];
-			errorLog << ") is out of range, source obsIdx is " << getNumObservations()<< endl;
-			errorLog << errorExit;
-		}
-		memcpy(to + j*getElementSize(),from + read_offset,getElementSize());
-	}
-}
-
-void FileVector::saveAs(string newFilename, unsigned long nvars, unsigned long nobss, unsigned long *varindexes, unsigned long *obsindexes) {
-	if (headerOrDataExists(newFilename)) {
-		errorLog << "File "<< newFilename <<" already exists." << endl << errorExit;
-	}
-	initializeEmptyFile( (char *)newFilename.c_str(), nvars, nobss, fileHeader.type, true);
-	FileVector outdata( newFilename, 64 );//todo which size for cache to use?
-
-	// copy observation names from the first object
-	for( unsigned long i=0 ; i < nobss ; i++ ) {
-		//cout << nobss << " " << i << "-" << obsindexes[i] << ";";
-		outdata.writeObservationName( i, readObservationName( obsindexes[i] ) );
-	}
-
-	char * out_variable = new (nothrow) char[nobss*getElementSize()];
-	if (!out_variable) errorLog << "can not allocate memory for out_variable" << endl << errorExit;
-
-	char * in_variable = new (nothrow) char[getNumObservations()*getElementSize()];
-	if (!in_variable) errorLog << "can not allocate memory for in_variable" << endl << errorExit;
-
-	for( unsigned long i=0 ; i<nvars ; i++ ) {
-		unsigned long selected_index =  varindexes[i];
-		//write var names
-		outdata.writeVariableName( i, readVariableName(selected_index ));
-		//write variables
-		readVariable(selected_index,in_variable);
-		copyVariable(out_variable, in_variable, nobss, obsindexes);
-		outdata.writeVariable(i,out_variable );
-	}
-
-	delete[] in_variable;
-	delete[] out_variable;
-}
-
-void FileVector::saveAsText(string newFilename, bool saveVarNames, bool saveObsNames, string nanString) {
-
-	ofstream textfile(newFilename.c_str(), ios::out);
-
-	// copy observation names from the first object
-	if (saveObsNames) {
-    	for( unsigned long i=0 ; i < getNumObservations() ; i++ ) {
-	    	FixedChar fc = readObservationName( i ) ;
-		    textfile << fc.name << " ";
-	    }
-
-	    textfile << endl;
-	}
-
-	char * in_variable = new (nothrow) char[getNumObservations()*getElementSize()];
-	if (!in_variable)
-		errorLog << "can not allocate memory for in_variable" << endl << endl << errorExit;
-
-	for(unsigned long i=0; i<getNumVariables(); i++) {
-		dbg << "Writing var " << i << " of " << getNumVariables()<< endl;
-		//write var names
-		FixedChar fc = readVariableName(i);
-		if (saveVarNames) {
-		    textfile << fc.name << " ";
-		}
-		//write variables
-		readVariable(i, in_variable);
-
-		for(unsigned long j=0; j<getNumObservations(); j++) {
-		    string s  = bufToString(getElementType(),&in_variable[j*getElementSize()], nanString);
-			textfile << s << " ";
-		}
-		textfile << endl;
-	}
-
-	delete[] in_variable;
+void FileVector::copyVariable(char* to, char* from, int n,
+                              unsigned long * indexes ) {
+    for (int j = 0; j < n; j++ ) {
+        //copy only selected observations to out_variable  from in_variable
+        unsigned long int read_offset = indexes[j] * getElementSize();
+        if(read_offset + getElementSize() >
+           getNumObservations() * getElementSize()) {
+            errorLog << "When saving selected observations: index in obsindexes("
+                     << indexes[j];
+            errorLog << ") is out of range, source obsIdx is "
+                     << getNumObservations() << endl;
+            errorLog << errorExit;
+        }
+        memcpy(to + j*getElementSize(),from + read_offset,getElementSize());
+    }
+}
+
+
+void FileVector::saveAs(string newFilename, unsigned long nvars,
+                        unsigned long nobss, unsigned long *varindexes,
+                        unsigned long *obsindexes) {
+    if (headerOrDataExists(newFilename)) {
+        errorLog << "File "<< newFilename <<" already exists."
+                 << endl << errorExit;
+    }
+    initializeEmptyFile( (char *)newFilename.c_str(), nvars, nobss,
+                         fileHeader.type, true);
+    FileVector outdata(newFilename, 64);  //todo which size for cache to use?
+
+    // copy observation names from the first object
+    for (unsigned long i = 0; i < nobss; i++) {
+        //cout << nobss << " " << i << "-" << obsindexes[i] << ";";
+        outdata.writeObservationName(i, readObservationName(obsindexes[i]) );
+    }
+
+    char * out_variable = new (nothrow) char[nobss*getElementSize()];
+    if (!out_variable)
+        errorLog << "can not allocate memory for out_variable"
+                 << endl << errorExit;
+
+    char * in_variable =
+        new (nothrow) char[getNumObservations()*getElementSize()];
+
+    if (!in_variable)
+        errorLog << "can not allocate memory for in_variable"
+                 << endl << errorExit;
+
+    for (unsigned long i= 0; i < nvars; i++) {
+        unsigned long selected_index =  varindexes[i];
+        //write var names
+        outdata.writeVariableName(i, readVariableName(selected_index));
+        //write variables
+        readVariable(selected_index,in_variable);
+        copyVariable(out_variable, in_variable, nobss, obsindexes);
+        outdata.writeVariable(i,out_variable );
+    }
+
+    delete[] in_variable;
+    delete[] out_variable;
+}
+
+
+void FileVector::saveAsText(string newFilename, bool saveVarNames,
+                            bool saveObsNames, string nanString) {
+
+    ofstream textfile(newFilename.c_str(), ios::out);
+
+    // copy observation names from the first object
+    if (saveObsNames) {
+        for (unsigned long i = 0; i < getNumObservations(); i++ ) {
+            FixedChar fc = readObservationName(i) ;
+            textfile << fc.name << " ";
+        }
+
+        textfile << endl;
+    }
+
+    char * in_variable =
+        new (nothrow) char[getNumObservations() * getElementSize()];
+
+    if (!in_variable)
+        errorLog << "can not allocate memory for in_variable"
+                 << endl << endl << errorExit;
+
+    for(unsigned long i = 0; i < getNumVariables(); i++) {
+        dbg << "Writing var " << i << " of " << getNumVariables() << endl;
+        //write var names
+        FixedChar fc = readVariableName(i);
+        if (saveVarNames) {
+            textfile << fc.name << " ";
+        }
+        //write variables
+        readVariable(i, in_variable);
+
+        for (unsigned long j = 0; j < getNumObservations(); j++) {
+            string s  = bufToString(getElementType(),
+                                    &in_variable[j * getElementSize()],
+                                    nanString);
+            textfile << s << " ";
+        }
+        textfile << endl;
+    }
+
+    delete[] in_variable;
 }
 
+
 short unsigned FileVector::getElementSize() {
-	return calcDataSize(fileHeader.type);
+    return calcDataSize(fileHeader.type);
 }
 
+
 short unsigned FileVector::getElementType() {
-	return fileHeader.type;
+    return fileHeader.type;
 }
 
+
 void FileVector::addVariable(void *invec, string varName) {
-	deepDbg << "addVariable(" << varName << ")" << endl;
-	if (readOnly) {
-		errorLog << "Trying to write to the readonly file." << errorExit;
-	}
-
-	fileHeader.numVariables++;
-	//recalculate
-	fileHeader.nelements = fileHeader.numVariables*fileHeader.numObservations;
-
-	FixedChar _fc_varname(varName);
-
-	// are names loaded from disk ?
-	if (variableNames && observationNames) {
-
-		FixedChar * newVariablesNames = new (nothrow)FixedChar[fileHeader.numVariables];
-		if (!newVariablesNames) {
-			errorLog << "Can not allocate memory in addVariable()" << errorExit;
-		}
-
-		//reallocate greater array for var names
-		memcpy(newVariablesNames, variableNames, sizeof(FixedChar)*(fileHeader.numVariables-1));
-		newVariablesNames[fileHeader.numVariables - 1] = _fc_varname;
-		FixedChar *oldvar_names = variableNames;
-		variableNames = newVariablesNames;
-		delete[] oldvar_names;
-		if (updateNamesOnWrite) {
-			indexFile.fseek(sizeof(fileHeader) + sizeof(FixedChar)*(fileHeader.numVariables - 1 + fileHeader.numObservations));
-			indexFile.blockWriteOrRead(sizeof(FixedChar), (char*)&_fc_varname.name, true);
-		}
-	} else { // not loaded
-		indexFile.fseek(sizeof(fileHeader) + sizeof(FixedChar)*(fileHeader.numVariables - 1 + fileHeader.numObservations));
-		indexFile.blockWriteOrRead(sizeof(FixedChar), (char*)&_fc_varname.name, true);
-	}
-	writeVariable(fileHeader.numVariables - 1, invec);
-}
-
-void FileVector::getPrivateCacheData(unsigned long* cacheSizeNVars, unsigned long *pCacheBegin, unsigned long *pCacheEnd ) {
-	*cacheSizeNVars = cache_size_nvars;
-	*pCacheBegin = cacheBegin;
-	*pCacheEnd = cacheEnd;
-}
+    deepDbg << "addVariable(" << varName << ")" << endl;
+    if (readOnly) {
+        errorLog << "Trying to write to the readonly file." << errorExit;
+    }
 
-bool FileVector::setReadOnly(bool iReadOnly){
-	if (iReadOnly) {
-		if (!this->readOnly) {
-			deInitialize();
-			this->readOnly = iReadOnly;
-			initialize(this->cache_size_Mb);
-		}
-	} else {
-		if (this->readOnly) {
-			bool canOpen;
-			{
-				ofstream indexFileTest(indexFilename.c_str(),ios::out|ios::in|ios::binary);
-				ofstream dataFileTest(dataFilename.c_str(),ios::out|ios::in|ios::binary);
-				canOpen = indexFileTest.good() && dataFileTest.good();
-			}
-
-			if (canOpen) {
-				deInitialize();
-				this->readOnly = iReadOnly;
-				initialize(this->cache_size_Mb);
-			} else {
-				errorLog << "Can't open " << filename << "for writing. " << endl;
-				return false;
-			}
-
-		}
-	}
-	return true;
+    fileHeader.numVariables++;
+    //recalculate
+    fileHeader.nelements = fileHeader.numVariables * fileHeader.numObservations;
+
+    FixedChar _fc_varname(varName);
+
+    // are names loaded from disk ?
+    if (variableNames && observationNames) {
+
+        FixedChar * newVariablesNames =
+            new (nothrow)FixedChar[fileHeader.numVariables];
+
+        if (!newVariablesNames) {
+            errorLog << "Can not allocate memory in addVariable()" << errorExit;
+        }
+
+        //reallocate greater array for var names
+        memcpy(newVariablesNames, variableNames,
+               sizeof(FixedChar)*(fileHeader.numVariables-1));
+        newVariablesNames[fileHeader.numVariables - 1] = _fc_varname;
+        FixedChar *oldvar_names = variableNames;
+        variableNames = newVariablesNames;
+        delete[] oldvar_names;
+
+        if (updateNamesOnWrite) {
+            indexFile.fseek(sizeof(fileHeader) +
+                            sizeof(FixedChar) * (fileHeader.numVariables - 1 +
+                                                 fileHeader.numObservations));
+            indexFile.blockWriteOrRead(sizeof(FixedChar),
+                                       (char*)&_fc_varname.name, true);
+        }
+    } else { // not loaded
+        indexFile.fseek(sizeof(fileHeader) +
+                        sizeof(FixedChar) * (fileHeader.numVariables - 1 +
+                                             fileHeader.numObservations));
+        indexFile.blockWriteOrRead(sizeof(FixedChar),
+                                   (char*)&_fc_varname.name, true);
+    }
+    writeVariable(fileHeader.numVariables - 1, invec);
 }
 
-AbstractMatrix* FileVector::castToAbstractMatrix(){
-	return this;
+
+void FileVector::getPrivateCacheData(unsigned long* cacheSizeNVars,
+                                     unsigned long *pCacheBegin,
+                                     unsigned long *pCacheEnd ) {
+    *cacheSizeNVars = cache_size_nvars;
+    *pCacheBegin = cacheBegin;
+    *pCacheEnd = cacheEnd;
 }
 
 
+bool FileVector::setReadOnly(bool iReadOnly){
+    if (iReadOnly) {
+        if (!this->readOnly) {
+            deInitialize();
+            this->readOnly = iReadOnly;
+            initialize(this->cache_size_Mb);
+        }
+    } else {
+        if (this->readOnly) {
+            bool canOpen;
+            {
+                ofstream indexFileTest(indexFilename.c_str(),
+                                       ios::out|ios::in|ios::binary);
+                ofstream dataFileTest(dataFilename.c_str(),
+                                      ios::out|ios::in|ios::binary);
+                canOpen = indexFileTest.good() && dataFileTest.good();
+            }
+
+            if (canOpen) {
+                deInitialize();
+                this->readOnly = iReadOnly;
+                initialize(this->cache_size_Mb);
+            } else {
+                errorLog << "Can't open " << filename << "for writing. " << endl;
+                return false;
+            }
+        }
+    }
+    return true;
+}
+
 
+AbstractMatrix* FileVector::castToAbstractMatrix(){
+    return this;
+}
diff --git a/src/fvlib/FileVector.h b/src/fvlib/FileVector.h
index aa74304..3be2095 100644
--- a/src/fvlib/FileVector.h
+++ b/src/fvlib/FileVector.h
@@ -27,129 +27,139 @@ using namespace std;
 #define DB_EXCL 2
 #define DB_RDONLY 4
 
+
 class FileVector: public AbstractMatrix {
-private:
+ private:
     const string filename;
-	string dataFilename;
+    string dataFilename;
     string indexFilename;
-	ReusableFileHandle dataFile;
-	ReusableFileHandle indexFile;
-	FileHeader fileHeader;
-	// row and column names
-	FixedChar *variableNames;
-	FixedChar *observationNames;
-	// size of header (descriptives + var/obs names)
-	unsigned long headerSize;
-	// cache size (Mb) requested by user
-	unsigned long cache_size_Mb;
-	// cache size internal; these ones are exact and used internaly
-	unsigned long cache_size_nvars;
-	unsigned long cache_size_bytes;
-	unsigned long max_buffer_size_bytes;
-	// which variables are now in cache
-	unsigned long cacheBegin;
-	unsigned long cacheEnd;
-	char * cacheBuffer;
-	bool readOnly;
-	bool updateNamesOnWrite;
-		
-public:
-	FileVector();
-	~FileVector();
-	
-	FileVector(string iFilename, unsigned long cachesizeMb) : filename (iFilename) {
-		readOnly = false;
-		updateNamesOnWrite = false;
-		cacheBuffer = 0;
-		initialize(cachesizeMb);
-		getWarningIsShown() = false;
-	}
-
-	FileVector(string iFilename, unsigned long cachesizeMb, bool iReadOnly) : filename(iFilename), readOnly(iReadOnly) {
-		updateNamesOnWrite = false;
-		cacheBuffer = 0;
-		initialize(cachesizeMb);
-		getWarningIsShown() = false;
+    ReusableFileHandle dataFile;
+    ReusableFileHandle indexFile;
+    FileHeader fileHeader;
+    // row and column names
+    FixedChar *variableNames;
+    FixedChar *observationNames;
+    // size of header (descriptives + var/obs names)
+    unsigned long headerSize;
+    // cache size (Mb) requested by user
+    unsigned long cache_size_Mb;
+    // cache size internal; these ones are exact and used internaly
+    unsigned long cache_size_nvars;
+    unsigned long cache_size_bytes;
+    unsigned long max_buffer_size_bytes;
+    // which variables are now in cache
+    unsigned long cacheBegin;
+    unsigned long cacheEnd;
+    char * cacheBuffer;
+    bool readOnly;
+    bool updateNamesOnWrite;
+
+ public:
+    FileVector();
+    ~FileVector();
+
+FileVector(string iFilename, unsigned long cachesizeMb) : filename (iFilename) {
+        readOnly = false;
+        updateNamesOnWrite = false;
+        cacheBuffer = 0;
+        initialize(cachesizeMb);
+        getWarningIsShown() = false;
     }
 
-	FileVector(char *iFilename, unsigned long cachesizeMb) : filename(string(iFilename)){
-		updateNamesOnWrite = false;
-		readOnly = false;
-		cacheBuffer = 0;
-		initialize(cachesizeMb);
-		getWarningIsShown() = false;
-	}
-
-	FileVector(char *iFilename, unsigned long cachesizeMb, bool iReadOnly) : filename(string(iFilename)), readOnly(iReadOnly) {
-		updateNamesOnWrite = false;
-		cacheBuffer = 0;
-		initialize(cachesizeMb);
+FileVector(string iFilename, unsigned long cachesizeMb, bool iReadOnly) :
+    filename(iFilename), readOnly(iReadOnly) {
+        updateNamesOnWrite = false;
+        cacheBuffer = 0;
+        initialize(cachesizeMb);
         getWarningIsShown() = false;
-	}
-	// for testing purposes
-	void getPrivateCacheData(unsigned long* cacheSizeNVars, unsigned long *inCachFrom, unsigned long *cacheEnd );
+    }
 
-	// these ones are the actual used to initialize and free up
-	void initialize(unsigned long cachesizeMb);
-	void deInitialize();
-	// this one updates cache
-	void updateCache(unsigned long from_var);
+FileVector(char *iFilename, unsigned long cachesizeMb) :
+    filename(string(iFilename)){
+        updateNamesOnWrite = false;
+        readOnly = false;
+        cacheBuffer = 0;
+        initialize(cachesizeMb);
+        getWarningIsShown() = false;
+    }
 
-	// gives element number from varIdx & obsIdx
-	unsigned long nrnc_to_nelem(unsigned long varIdx, unsigned long obsIdx);
+FileVector(char *iFilename, unsigned long cachesizeMb, bool iReadOnly) :
+    filename(string(iFilename)), readOnly(iReadOnly) {
+        updateNamesOnWrite = false;
+        cacheBuffer = 0;
+        initialize(cachesizeMb);
+        getWarningIsShown() = false;
+    }
+    // for testing purposes
+    void getPrivateCacheData(unsigned long* cacheSizeNVars,
+                             unsigned long *inCachFrom, unsigned long *cacheEnd);
+
+    // these ones are the actual used to initialize and free up
+    void initialize(unsigned long cachesizeMb);
+    void deInitialize();
+    // this one updates cache
+    void updateCache(unsigned long from_var);
+
+    // gives element number from varIdx & obsIdx
+    unsigned long nrnc_to_nelem(unsigned long varIdx, unsigned long obsIdx);
 
-	// getting and setting var/col names
-	void writeVariableName(unsigned long varIdx, FixedChar name);
-	void writeObservationName(unsigned long obsIdx, FixedChar name);
+    // getting and setting var/col names
+    void writeVariableName(unsigned long varIdx, FixedChar name);
+    void writeObservationName(unsigned long obsIdx, FixedChar name);
 
     virtual string getFileName();
-	virtual unsigned long getNumVariables();
-	virtual unsigned long getNumObservations();
+    virtual unsigned long getNumVariables();
+    virtual unsigned long getNumObservations();
 
-	FixedChar readVariableName(unsigned long varIdx);
-	FixedChar readObservationName(unsigned long obsIdx);
+    FixedChar readVariableName(unsigned long varIdx);
+    FixedChar readObservationName(unsigned long obsIdx);
 
-	// USER FUNCTIONS
-	// can read single variable
-	void readVariable(unsigned long varIdx, void * outvec);
+    // USER FUNCTIONS
+    // can read single variable
+    void readVariable(unsigned long varIdx, void * outvec);
 
-	void addVariable(void * invec, string varname);
+    void addVariable(void * invec, string varname);
 
-	// should only be used for reading single random elements!
-	void readElement(unsigned long varIdx, unsigned long obsIdx, void * data);
-	void writeVariable(unsigned long varIdx, void * datavec);
-	void writeElement(unsigned long varIdx, unsigned long obsIdx, void * data);
+    // should only be used for reading single random elements!
+    void readElement(unsigned long varIdx, unsigned long obsIdx, void * data);
+    void writeVariable(unsigned long varIdx, void * datavec);
+    void writeElement(unsigned long varIdx, unsigned long obsIdx, void * data);
 
-	void readObservation(unsigned long obsIdx, void * outvec);
-	void writeObservation(unsigned long obsIdx, void * outvec);
+    void readObservation(unsigned long obsIdx, void * outvec);
+    void writeObservation(unsigned long obsIdx, void * outvec);
     void cacheAllNames(bool);
     void readNames();
 
-	void saveAs( string newFilename );
-	void saveVariablesAs( string newFilename, unsigned long nvars, unsigned long * varindexes);
-	void saveObservationsAs( string newFilename, unsigned long nobss, unsigned long * obsindexes);
-	void saveAs(string newFilename, unsigned long nvars, unsigned long nobss, unsigned long * varindexes, unsigned long * obsindexes);
-	void saveAsText(string newFilename, bool saveVarNames, bool saveObsNames, string nanString);
+    void saveAs( string newFilename );
+    void saveVariablesAs(string newFilename, unsigned long nvars,
+                         unsigned long * varindexes);
+    void saveObservationsAs(string newFilename, unsigned long nobss,
+                            unsigned long * obsindexes);
+    void saveAs(string newFilename, unsigned long nvars, unsigned long nobss,
+                unsigned long * varindexes, unsigned long * obsindexes);
+    void saveAsText(string newFilename, bool saveVarNames, bool saveObsNames,
+                    string nanString);
 
-	unsigned long getCacheSizeInMb();
-	void setCacheSizeInMb( unsigned long cachesizeMb );
+    unsigned long getCacheSizeInMb();
+    void setCacheSizeInMb( unsigned long cachesizeMb );
 
-	virtual short unsigned getElementSize();
-	virtual short unsigned getElementType();
-	void saveIndexFile();
+    virtual short unsigned getElementSize();
+    virtual short unsigned getElementType();
+    void saveIndexFile();
 
-	virtual void setUpdateNamesOnWrite(bool bUpdate);
+    virtual void setUpdateNamesOnWrite(bool bUpdate);
     virtual AbstractMatrix* castToAbstractMatrix();
     virtual bool setReadOnly(bool readOnly);
-    
-	// FOR FUTURE:
-	// very slow one!
-	//	DT * readObservation(unsigned long obsIdx);
-	// should only be used for reading single random elements!
-	//	DT readElement(unsigned long nelment);
-private :
-	void copyVariable(char * to, char * from, int n, unsigned long * indexes );
-    void calcCachePos(unsigned long newPos, unsigned long &cacheBegin, unsigned long &cacheEnd);
+
+    // FOR FUTURE:
+    // very slow one!
+    //	DT * readObservation(unsigned long obsIdx);
+    // should only be used for reading single random elements!
+    //	DT readElement(unsigned long nelment);
+ private :
+    void copyVariable(char * to, char * from, int n, unsigned long * indexes );
+    void calcCachePos(unsigned long newPos, unsigned long &cacheBegin,
+                      unsigned long &cacheEnd);
 };
 
 //global variables
@@ -157,4 +167,3 @@ const string FILEVECTOR_DATA_FILE_SUFFIX = ".fvd";
 const string FILEVECTOR_INDEX_FILE_SUFFIX = ".fvi";
 
 #endif
-
diff --git a/src/fvlib/FilteredMatrix.cpp b/src/fvlib/FilteredMatrix.cpp
index 7289c8c..935c92f 100644
--- a/src/fvlib/FilteredMatrix.cpp
+++ b/src/fvlib/FilteredMatrix.cpp
@@ -11,179 +11,226 @@ using namespace std;
 #include "frutil.h"
 
 unsigned long FilteredMatrix::getCacheSizeInMb() {
-	return nestedMatrix->getCacheSizeInMb();
+        return nestedMatrix->getCacheSizeInMb();
 }
 
+
 void FilteredMatrix::setCacheSizeInMb( unsigned long cachesizeMb ) {
     nestedMatrix->setCacheSizeInMb(cachesizeMb);
 }
 
+
 void FilteredMatrix::setUpdateNamesOnWrite(bool bUpdate) {
     nestedMatrix->setUpdateNamesOnWrite(bUpdate);
 }
 
+
 void FilteredMatrix::writeVariableName(unsigned long varIdx, FixedChar name) {
     nestedMatrix->writeVariableName(filteredToRealRowIdx[varIdx], name);
 }
 
+
 void FilteredMatrix::writeObservationName(unsigned long obsIdx, FixedChar name) {
     nestedMatrix->writeObservationName(filteredToRealColIdx[obsIdx], name);
 }
 
+
 FixedChar FilteredMatrix::readVariableName(unsigned long varIdx) {
     return nestedMatrix->readVariableName(filteredToRealRowIdx[varIdx]);
 }
 
+
 FixedChar FilteredMatrix::readObservationName(unsigned long obsIdx) {
     return nestedMatrix->readObservationName(filteredToRealColIdx[obsIdx]);
 }
 
+
 void FilteredMatrix::readVariable(unsigned long varIdx, void * outvec) {
     unsigned long i;
-    fmDbg << "readVariable(" << varIdx << "), numObservations="<<getNumObservations()<<";" << endl;
-    char* data = new (nothrow) char[getElementSize() * nestedMatrix->getNumObservations()];
+    fmDbg << "readVariable(" << varIdx << "), numObservations="
+          << getNumObservations() <<";" << endl;
+    char* data =
+        new (nothrow) char[getElementSize() * nestedMatrix->getNumObservations()];
+
     nestedMatrix->readVariable(this->filteredToRealRowIdx[varIdx], data);
-    for(i=0; i < this->filteredToRealColIdx.size(); i++){
-        memcpy(&((char*)outvec)[i*getElementSize()],
-         &data[this->filteredToRealColIdx[i]*getElementSize()],getElementSize());
+
+    for (i = 0; i < this->filteredToRealColIdx.size(); i++){
+        memcpy(&((char*)outvec)[i * getElementSize()],
+               &data[this->filteredToRealColIdx[i] * getElementSize()],
+               getElementSize());
     }
     delete [] data;
 }
 
+
 void FilteredMatrix::readObservation(unsigned long obsIdx, void * outvec) {
     unsigned long i;
     fmDbg << "readObservation(" << obsIdx << ");" << endl;
-    for(i=0;i<getNumVariables();i++){
-        readElement( i, obsIdx, (char*)outvec + i * getElementSize());
+    for (i = 0; i < getNumVariables(); i++){
+        readElement(i, obsIdx, (char*)outvec + i * getElementSize());
     }
 }
 
+
 void FilteredMatrix::writeObservation(unsigned long obsIdx, void * invec) {
     unsigned long i;
-    for(i=0;i<getNumObservations();i++){
-        writeElement( i, obsIdx, (char*)invec + i * getElementSize());
+    for (i = 0; i < getNumObservations(); i++){
+        writeElement(i, obsIdx, (char*)invec + i * getElementSize());
     }
 }
 
+
 void FilteredMatrix::writeVariable(unsigned long varIdx, void *datavec) {
     unsigned long i;
     fmDbg << "FilteredMatrix.writeVariable(" << varIdx << ")" << endl;
-    double p = (double)getNumObservations()/nestedMatrix->getNumObservations();
+    double p = (double)getNumObservations() / nestedMatrix->getNumObservations();
 
     if (p > WRITE_SPEED_PROPORTION) {
-        char *ptr = new char[getElementSize()*nestedMatrix->getNumObservations()];
+        char *ptr = new char[getElementSize() *
+                             nestedMatrix->getNumObservations()];
         // no filter
         if (getNumObservations() != nestedMatrix->getNumObservations()) {
             nestedMatrix->readVariable(this->filteredToRealRowIdx[varIdx], ptr);
         }
-        for(i=0;i<getNumObservations();i++){
-            memcpy(&ptr[getElementSize()*this->filteredToRealColIdx[i]],&((char*)datavec)[getElementSize()*i],
+        for (i = 0; i < getNumObservations(); i++){
+            memcpy(&ptr[getElementSize() * this->filteredToRealColIdx[i]],
+                   &((char*)datavec)[getElementSize() * i],
             getElementSize());
         }
 
         nestedMatrix->writeVariable(this->filteredToRealRowIdx[varIdx], ptr);
         delete[] ptr;
     }else {
-        for(i=0;i<getNumObservations();i++){
+        for (i = 0; i < getNumObservations(); i++){
             this->writeElement(varIdx, i, (char*)datavec + i * getElementSize());
         }
     }
 }
 
-void FilteredMatrix::readElement(unsigned long varIdx, unsigned long obsIdx, void * out) {
+
+void FilteredMatrix::readElement(unsigned long varIdx, unsigned long obsIdx,
+                                 void * out) {
     fmDbg << "FilteredMatrix::readElement(" << varIdx << "," << obsIdx<<") = ";
-    nestedMatrix->readElement(filteredToRealRowIdx[varIdx], filteredToRealColIdx[obsIdx], out);
+    nestedMatrix->readElement(filteredToRealRowIdx[varIdx],
+                              filteredToRealColIdx[obsIdx], out);
     fmDbg << bufToString(getElementType(), (char*)out, string("NAN")) << endl;
 }
 
-void FilteredMatrix::writeElement(unsigned long varIdx, unsigned long obsIdx, void* data) {
-    fmDbg << "FilteredMatrix.writeElement (" << varIdx << "," << obsIdx << ")" << endl;
-    nestedMatrix->writeElement(filteredToRealRowIdx[varIdx], filteredToRealColIdx[obsIdx], data);
+
+void FilteredMatrix::writeElement(unsigned long varIdx, unsigned long obsIdx,
+                                  void* data) {
+    fmDbg << "FilteredMatrix.writeElement (" << varIdx << "," << obsIdx << ")"
+          << endl;
+    nestedMatrix->writeElement(filteredToRealRowIdx[varIdx],
+                               filteredToRealColIdx[obsIdx], data);
 }
 
+
 string FilteredMatrix::getFileName(){
-    return nestedMatrix->getFileName(); 
+    return nestedMatrix->getFileName();
 }
 
 
-unsigned long FilteredMatrix::getNumVariables() {
+unsigned long FilteredMatrix::getNumVariables(){
    return filteredToRealRowIdx.size();
 }
 
+
 unsigned long FilteredMatrix::getNumObservations() {
    return filteredToRealColIdx.size();
 }
 
+
 void FilteredMatrix::saveAs(string newFilename) {
     nestedMatrix->saveAs(newFilename, this->filteredToRealRowIdx.size(),
-    this->filteredToRealColIdx.size(), &this->filteredToRealRowIdx[0], &this->filteredToRealColIdx[0]);
+                         this->filteredToRealColIdx.size(),
+                         &this->filteredToRealRowIdx[0],
+                         &this->filteredToRealColIdx[0]);
 }
 
-void FilteredMatrix::saveVariablesAs( string newFilename, unsigned long nvars, unsigned long *varIndexes) {
+
+void FilteredMatrix::saveVariablesAs(string newFilename, unsigned long nvars,
+                                     unsigned long *varIndexes) {
     vector<unsigned long> recodedColIndexes;
     vector<unsigned long> recodedRowIndexes;
 
     unsigned long *obsIndexes = new unsigned long[this->getNumObservations()];
 
     unsigned long i;
-    for(i=0;i<this->getNumObservations();i++){
+    for (i = 0; i < this->getNumObservations(); i++){
         obsIndexes[i]=i;
     }
 
-    filterIdxList(obsIndexes, this->getNumObservations(), recodedColIndexes, filteredToRealColIdx);
+    filterIdxList(obsIndexes, this->getNumObservations(), recodedColIndexes,
+                  filteredToRealColIdx);
     filterIdxList(varIndexes, nvars, recodedRowIndexes, filteredToRealRowIdx);
-    delete obsIndexes;
+    delete[] obsIndexes;
 }
 
-void FilteredMatrix::saveObservationsAs( string newFilename, unsigned long nobss, unsigned long * obsIndexes) {
+
+void FilteredMatrix::saveObservationsAs(string newFilename, unsigned long nobss,
+                                        unsigned long * obsIndexes) {
     vector<unsigned long> recodedColIndexes;
     vector<unsigned long> recodedRowIndexes;
 
     unsigned long *varIndexes = new unsigned long[this->getNumVariables()];
 
     unsigned long i;
-    for(i=0;i<this->getNumObservations();i++){
+    for (i = 0; i < this->getNumObservations(); i++){
         varIndexes[i]=i;
     }
 
     filterIdxList(obsIndexes, nobss, recodedColIndexes, filteredToRealColIdx);
-    filterIdxList(varIndexes, getNumVariables(), recodedRowIndexes, filteredToRealRowIdx);
+    filterIdxList(varIndexes, getNumVariables(), recodedRowIndexes,
+                  filteredToRealRowIdx);
     delete obsIndexes;
 }
 
-void FilteredMatrix::saveAs(string newFilename, unsigned long nvars, unsigned long nobss, unsigned long *varIndexes, unsigned long *obsIndexes) {
+
+void FilteredMatrix::saveAs(string newFilename, unsigned long nvars,
+                            unsigned long nobss, unsigned long *varIndexes,
+                            unsigned long *obsIndexes) {
     vector<unsigned long> recodedColIndexes;
     vector<unsigned long> recodedRowIndexes;
     filterIdxList(obsIndexes, nobss, recodedColIndexes, filteredToRealColIdx);
     filterIdxList(varIndexes, nvars, recodedRowIndexes, filteredToRealRowIdx);
-    nestedMatrix->saveAs(newFilename, nvars, nobss, &recodedRowIndexes[0], &recodedColIndexes[0]);
+    nestedMatrix->saveAs(newFilename, nvars, nobss, &recodedRowIndexes[0],
+                         &recodedColIndexes[0]);
 }
 
-void FilteredMatrix::saveAsText(string newFilename, bool showVarNames, bool showObsNames, string nanString) {
+
+void FilteredMatrix::saveAsText(string newFilename, bool showVarNames,
+                                bool showObsNames, string nanString) {
     nestedMatrix->saveAsText(newFilename, showVarNames, showObsNames, nanString);
 }
 
+
 short unsigned FilteredMatrix::getElementSize() {
     return nestedMatrix->getElementSize();
 }
 
+
 short unsigned FilteredMatrix::getElementType() {
     return nestedMatrix->getElementType();
 }
 
+
 void FilteredMatrix::addVariable(void * invec, string varname) {
-    errorLog << "FilteredMatrix doesn't support addVariable." << endl << errorExit;
+    errorLog << "FilteredMatrix doesn't support addVariable."
+             << endl << errorExit;
 }
 
+
 void FilteredMatrix::cacheAllNames(bool doCache) {
     nestedMatrix->cacheAllNames(doCache);
 }
 
+
 AbstractMatrix* FilteredMatrix::castToAbstractMatrix(){
     return this;
 }
 
+
 bool FilteredMatrix::setReadOnly(bool iReadOnly){
     return nestedMatrix->setReadOnly(iReadOnly);
 }
-
diff --git a/src/fvlib/FilteredMatrix.h b/src/fvlib/FilteredMatrix.h
index 4488707..11340d3 100644
--- a/src/fvlib/FilteredMatrix.h
+++ b/src/fvlib/FilteredMatrix.h
@@ -3,14 +3,15 @@
 
 #include <map>
 
- //todo add comments
+//todo add comments
 
 using namespace std;
 
 #include "AbstractMatrix.h"
 /*
-* "Cols" are observations and "Rows" are variables  
-*/
+ * "Cols" are observations and "Rows" are variables
+ */
+
 class FilteredMatrix : public AbstractMatrix {
     AbstractMatrix *nestedMatrix;
 
@@ -18,41 +19,45 @@ class FilteredMatrix : public AbstractMatrix {
     vector<unsigned long> filteredToRealRowIdx;
 
     void filterIdxList(unsigned long *iIndexes, unsigned long numIndexes,
-    vector<unsigned long> &oIndexes, vector<unsigned long> &filter) {
+                       vector<unsigned long> &oIndexes,
+                       vector<unsigned long> &filter) {
         oIndexes.reserve(numIndexes);
 
         unsigned long i;
-        for(i=0; i<numIndexes; i++) {
+        for (i = 0; i < numIndexes; i++) {
             oIndexes.push_back(filter[iIndexes[i]]);
         }
     }
-    
-public:
+
+ public:
     // makes this matrix not filter any cells
     void setNoFiltering(){
         unsigned long i;
         filteredToRealRowIdx.reserve(nestedMatrix->getNumVariables());
-        for(i=0;i<nestedMatrix->getNumVariables();i++) {
+        for (i = 0; i < nestedMatrix->getNumVariables(); i++) {
             filteredToRealRowIdx.push_back(i);
         }
 
         filteredToRealColIdx.reserve(nestedMatrix->getNumObservations());
-        for(i=0;i<nestedMatrix->getNumObservations();i++) {
+        for (i = 0; i < nestedMatrix->getNumObservations(); i++) {
             filteredToRealColIdx.push_back(i);
         }
     }
+
     // set filter for Filterematrix
-    void setFilteredArea(vector<unsigned long> &rowMask, vector<unsigned long> &colMask){
+    void setFilteredArea(vector<unsigned long> &rowMask,
+                         vector<unsigned long> &colMask){
         fmDbg << "setFilteredArea()" << endl;
         this->filteredToRealRowIdx = vector<unsigned long>(rowMask);
         this->filteredToRealColIdx = vector<unsigned long>(colMask);
     }
 
     /**
-    * Constructs FilteredMatrix wrapper from AbstractMatrix object
-    **/
-    FilteredMatrix(AbstractMatrix &matrix) : nestedMatrix(&matrix) {
-        dbg << "Constructing FilteredMatrix from AbstractMatrix, ptr = " << (void *)this << endl;
+     * Constructs FilteredMatrix wrapper from AbstractMatrix object
+     **/
+FilteredMatrix(AbstractMatrix &matrix) : nestedMatrix(&matrix) {
+        dbg << "Constructing FilteredMatrix from AbstractMatrix, ptr = "
+            << (void *)this << endl;
         setNoFiltering();
         getWarningIsShown() = false;
     }
@@ -60,138 +65,144 @@ public:
     string getFileName();
 
     /**
-    * Returns number of variables
-    **/
+     * Returns number of variables
+     **/
     unsigned long getNumVariables();
 
     /**
-    * Returns number of observations
-    **/
+     * Returns number of observations
+     **/
     unsigned long getNumObservations();
 
     /**
-    * If argument is true, DatABEL reads all variables/observations' names from files into memory.
-    * Calling this function with false causes name cache freeing
-    **/
+     * If argument is true, DatABEL reads all variables/observations'
+     * names from files into memory.
+     * Calling this function with false causes name cache freeing
+     **/
     void cacheAllNames(bool);
 
     /**
-    * Returns pointer to AbstractMatrix that is wrapped by current object
-    **/
+     * Returns pointer to AbstractMatrix that is wrapped by current object
+     **/
     AbstractMatrix* getNestedMatrix() {return nestedMatrix;}
 
     /**
-    * Saves current DatABEL object to another file
-    **/
-	void saveAs(string newFilename);
+     * Saves current DatABEL object to another file
+     **/
+    void saveAs(string newFilename);
 
     /**
-    * Saves selected variables to another file
-    **/
-	void saveVariablesAs(string newFilename, unsigned long nvars, unsigned long * varindexes);
+     * Saves selected variables to another file
+     **/
+    void saveVariablesAs(string newFilename, unsigned long nvars,
+                         unsigned long * varindexes);
 
     /**
-    * Saves selected observations to another file
-    **/
-   	void saveObservationsAs(string newFilename, unsigned long nobss, unsigned long * obsindexes);
+     * Saves selected observations to another file
+     **/
+    void saveObservationsAs(string newFilename, unsigned long nobss,
+                            unsigned long * obsindexes);
 
     /**
-    * Saves selected observations to another file
-    **/
-    void saveAs(string newFilename, unsigned long nvars, unsigned long nobss, unsigned long * varindexes, unsigned long * obsindexes);
+     * Saves selected observations to another file
+     **/
+    void saveAs(string newFilename, unsigned long nvars, unsigned long nobss,
+                unsigned long * varindexes, unsigned long * obsindexes);
 
     /**
-    * Saves current object as text
-    **/
-    void saveAsText(string newFilename, bool saveVarNames, bool saveObsNames, string nanString);
+     * Saves current object as text
+     **/
+    void saveAsText(string newFilename, bool saveVarNames, bool saveObsNames,
+                    string nanString);
 
     /**
-    * Get single observation
-    **/
+     * Get single observation
+     **/
     void readObservation(unsigned long obsIdx, void * outvec);
 
     /**
-    * Write single observation
-    **/
+     * Write single observation
+     **/
     void writeObservation(unsigned long obsIdx, void * invec);
 
     /**
-    * Set variable name
-    **/
+     * Set variable name
+     **/
     void writeVariableName(unsigned long varIdx, FixedChar newname);  // todo loooong future -- control that name is unique
 
     /**
-    * Set observation name
-    **/
+     * Set observation name
+     **/
     void writeObservationName(unsigned long obsIdx, FixedChar newname);  //todo loooong future -- control that name is unique!
 
     /**
-    * Get cache size in Mbs
-    **/
+     * Get cache size in Mbs
+     **/
     unsigned long getCacheSizeInMb();
 
     /**
-    * Set cache size in Mbs
-    **/
+     * Set cache size in Mbs
+     **/
     void setCacheSizeInMb( unsigned long cachesizeMb );
 
     /**
-    * Get observation name
-    **/
+     * Get observation name
+     **/
     FixedChar readObservationName(unsigned long obsIdx);
 
     /**
-    * Get variable name
-    **/
+     * Get variable name
+     **/
     FixedChar readVariableName(unsigned long varIdx);
 
     /**
-    * If bUpdate is false and var/obs names are cached, changing var/obs name doesn't cause disk write.
-    * Invoking this method with true forces update on each var/obs change.
-    **/
+     * If bUpdate is false and var/obs names are cached, changing var/obs name doesn't cause disk write.
+     * Invoking this method with true forces update on each var/obs change.
+     **/
     void setUpdateNamesOnWrite(bool bUpdate);
 
     /**
-    * Returns number of bytes per element
-    **/
-	short unsigned getElementSize();
+     * Returns number of bytes per element
+     **/
+    short unsigned getElementSize();
 
     /**
-    * Returns elements type
-    **/
-	short unsigned getElementType();
+     * Returns elements type
+     **/
+    short unsigned getElementType();
 
     /**
-    * Read a single variable
-    **/
-	void readVariable(unsigned long varIdx, void * outvec);
+     * Read a single variable
+     **/
+    void readVariable(unsigned long varIdx, void * outvec);
 
     /**
-    * Read a single element
-    **/
-	void readElement(unsigned long varIdx, unsigned long obsIdx, void * elem);
+     * Read a single element
+     **/
+    void readElement(unsigned long varIdx, unsigned long obsIdx, void * elem);
 
     /**
-    * Set a single variable
-    **/
-	void writeVariable(unsigned long varIdx, void * datavec);
+     * Set a single variable
+     **/
+    void writeVariable(unsigned long varIdx, void * datavec);
 
     /**
-    * Set a single element
-    **/
-	void writeElement(unsigned long varIdx, unsigned long obsIdx, void * data);
+     * Set a single element
+     **/
+    void writeElement(unsigned long varIdx, unsigned long obsIdx, void * data);
 
     /**
-    * Returns ptr to current object as AbstractMatrix
-    **/
+     * Returns ptr to current object as AbstractMatrix
+     **/
     virtual AbstractMatrix* castToAbstractMatrix();
 
     /**
-    * Enables readonly mode. Only one instance of Filtered matrix can access data in write mode.   
-    **/
+     * Enables readonly mode. Only one instance of Filtered matrix can
+     * access data in write mode.
+     **/
     virtual bool setReadOnly(bool readOnly);
-    
-private:
+
+ private:
     void addVariable(void * invec, string varname);
 };
 
diff --git a/src/fvlib/Logger.cpp b/src/fvlib/Logger.cpp
index cccb170..edf605d 100644
--- a/src/fvlib/Logger.cpp
+++ b/src/fvlib/Logger.cpp
@@ -1,6 +1,6 @@
 #include "Logger.h"
 
-                    
+
 ErrorExit errorExit;
 
 #define all true
@@ -13,8 +13,3 @@ Logger deepDbg(DEBUG_LEVEL,false);
 Logger fmDbg(DEBUG_LEVEL,false);
 Logger wrapperLog(DEBUG_LEVEL,false);
 Logger errorLog(ERROR_LEVEL,all);
-
-
-
-
-
diff --git a/src/fvlib/Logger.h b/src/fvlib/Logger.h
index 5b474eb..801dc73 100644
--- a/src/fvlib/Logger.h
+++ b/src/fvlib/Logger.h
@@ -19,13 +19,14 @@ using namespace std;
 
 class ErrorExit {};
 class Logger {
-public:
+ public:
 //    enum ErrorLevel {Message, Debug, Error};
     int errorLevel;
     bool enabled;
 
-    Logger(int iErrorLevel) : errorLevel(iErrorLevel), enabled(true) {}
-    Logger(int iErrorLevel, bool iEnabled) : errorLevel(iErrorLevel), enabled(iEnabled) {}
+Logger(int iErrorLevel) : errorLevel(iErrorLevel), enabled(true) {}
+Logger(int iErrorLevel, bool iEnabled) : errorLevel(iErrorLevel),
+        enabled(iEnabled) {}
     Logger &operator << (const char* s){
         sendString(s);
         return *this;
@@ -42,27 +43,28 @@ public:
         sendString("\n");
         return *this;
     }
-    Logger &operator<< (ErrorExit&) {
-        #ifdef R_R_H
-            throw 1;
-        #else
-	        exit(EXIT_FAILURE);
-        #endif
+    Logger &operator << (ErrorExit&) {
+#ifdef R_R_H
+        throw 1;
+#else
+        exit(EXIT_FAILURE);
+#endif
         return *this;
     }
-private:
+
+ private:
     void sendString(string s){
         if (!enabled)
             return;
-        #ifdef R_R_H
-            Rprintf("%s",s.c_str());
-        #else
+#ifdef R_R_H
+        Rprintf("%s",s.c_str());
+#else
         if (errorLevel == ERROR_LEVEL) {
             cerr << s;
         } else {
             cout << s;
         }
-        #endif
+#endif
     }
 };
 
diff --git a/src/fvlib/RealHandlerWrapper.cpp b/src/fvlib/RealHandlerWrapper.cpp
index 1eb9eb4..c1f23e6 100644
--- a/src/fvlib/RealHandlerWrapper.cpp
+++ b/src/fvlib/RealHandlerWrapper.cpp
@@ -5,23 +5,24 @@
 bool RealHandlerWrapper::open(const string &iFileName, bool iReadOnly) {
     fileName = iFileName;
     if (useCount > 0) {
-        useCount++;    
+        useCount++;
         return true;
     }
 
-	if (iReadOnly) {
-		stream.open(fileName.c_str(), ios::in | ios::binary);
-	} else {
-		stream.open(fileName.c_str(), ios::out | ios::in | ios::binary);
-	}
+    if (iReadOnly) {
+        stream.open(fileName.c_str(), ios::in | ios::binary);
+    } else {
+        stream.open(fileName.c_str(), ios::out | ios::in | ios::binary);
+    }
 
     readOnly = iReadOnly;
 
-	useCount = 1;
+    useCount = 1;
 
-	return !!(stream);
+    return !!(stream);
 }
 
+
 void RealHandlerWrapper::close(){
     if (useCount > 1) {
         useCount--;
@@ -31,7 +32,9 @@ void RealHandlerWrapper::close(){
     }
 }
 
-void RealHandlerWrapper::blockWriteOrRead(unsigned long iLength, char* data, bool writeAction) {
+
+void RealHandlerWrapper::blockWriteOrRead(unsigned long iLength, char* data,
+                                          bool writeAction) {
     ::blockWriteOrRead(stream, iLength, data, writeAction);
 }
 
diff --git a/src/fvlib/RealHandlerWrapper.h b/src/fvlib/RealHandlerWrapper.h
index 3fdab1d..610bb53 100644
--- a/src/fvlib/RealHandlerWrapper.h
+++ b/src/fvlib/RealHandlerWrapper.h
@@ -1,7 +1,7 @@
 #ifndef __RealHandlerWrapper__
 #define __RealHandlerWrapper__
 
-class ReusableFileHandle; 
+class ReusableFileHandle;
 
 #include <string>
 #include <map>
@@ -11,15 +11,15 @@ class ReusableFileHandle;
 using namespace std;
 
 class RealHandlerWrapper {
-private:
+ private:
     int useCount;
     fstream stream;
     string fileName;
-    
+
     bool readOnly;
 
-public:
-    RealHandlerWrapper(): useCount(0) {}
+ public:
+RealHandlerWrapper(): useCount(0) {}
 
     void blockWriteOrRead(unsigned long length, char* data, bool writeAction);
     void fseek(unsigned long pos);
diff --git a/src/fvlib/ReusableFileHandle.cpp b/src/fvlib/ReusableFileHandle.cpp
index 4b22b4f..c7ca7de 100644
--- a/src/fvlib/ReusableFileHandle.cpp
+++ b/src/fvlib/ReusableFileHandle.cpp
@@ -7,14 +7,15 @@
 map<string, RealHandlerWrapper*> ReusableFileHandle::openHandles;
 
 int ReusableFileHandle::testGetNumHandles(){
-    return ReusableFileHandle::openHandles.size(); 
+    return ReusableFileHandle::openHandles.size();
 }
 
-ReusableFileHandle ReusableFileHandle::getHandle(string fileName, bool readOnly){
 
+ReusableFileHandle ReusableFileHandle::getHandle(string fileName, bool readOnly){
     string key = string((readOnly ? "R" : "*")) + fileName;
 
-    if (ReusableFileHandle::openHandles.find(key) != ReusableFileHandle::openHandles.end()) {
+    if (ReusableFileHandle::openHandles.find(key) !=
+        ReusableFileHandle::openHandles.end()) {
         RealHandlerWrapper *rhw = ReusableFileHandle::openHandles[key];
 
         rhw->open(fileName, readOnly);
@@ -28,21 +29,22 @@ ReusableFileHandle ReusableFileHandle::getHandle(string fileName, bool readOnly)
 
         if (success) {
             ReusableFileHandle::openHandles[key] = newHandleWrapper;
-		} else {
-			delete newHandleWrapper;
-			newHandleWrapper = 0;
-		}
+        } else {
+            delete newHandleWrapper;
+            newHandleWrapper = 0;
+        }
 
         ReusableFileHandle ret(newHandleWrapper, success, fileName, readOnly);
         return ret;
     }
 }
 
-void ReusableFileHandle::close() {
 
+void ReusableFileHandle::close() {
     string key = string((readOnly ? "R" : "*")) + fileName;
 
-    if (ReusableFileHandle::openHandles.find(key) == ReusableFileHandle::openHandles.end())
+    if (ReusableFileHandle::openHandles.find(key) ==
+        ReusableFileHandle::openHandles.end())
         return;
 
     RealHandlerWrapper *rhw = ReusableFileHandle::openHandles[key];
@@ -50,25 +52,26 @@ void ReusableFileHandle::close() {
     rhw->close();
 
     if (rhw->getUseCount() == 0) {
-		delete rhw;
+        delete rhw;
         ReusableFileHandle::openHandles.erase(key);
     }
 }
 
-void ReusableFileHandle::blockWriteOrRead(unsigned long length, char* data, bool writeAction){
+
+void ReusableFileHandle::blockWriteOrRead(unsigned long length, char* data,
+                                          bool writeAction){
     realHandlerWrapper->fseek(curPos);
     realHandlerWrapper->blockWriteOrRead(length, data, writeAction);
 
     curPos += length;
 }
 
+
 void ReusableFileHandle::flush(){
     realHandlerWrapper->flush();
 }
 
+
 void ReusableFileHandle::fseek(unsigned long pos){
     curPos = pos;
 }
-
-
-
diff --git a/src/fvlib/ReusableFileHandle.h b/src/fvlib/ReusableFileHandle.h
index d651728..f60f153 100644
--- a/src/fvlib/ReusableFileHandle.h
+++ b/src/fvlib/ReusableFileHandle.h
@@ -9,45 +9,45 @@
 using namespace std;
 
 class ReusableFileHandle {
-private:
+ private:
     bool isOk;
     unsigned long curPos;
     string fileName;
     bool readOnly;
-    
+
     RealHandlerWrapper *realHandlerWrapper;
 
     static map<string, RealHandlerWrapper*> openHandles;
 
-public:
-    ReusableFileHandle(RealHandlerWrapper *iRealHandlerWrapper, bool iIsOk,
-        const string& iFileName, bool iReadOnly ):
-        isOk(iIsOk), curPos(0),
+ public:
+ReusableFileHandle(RealHandlerWrapper *iRealHandlerWrapper, bool iIsOk,
+                   const string& iFileName, bool iReadOnly ):
+    isOk(iIsOk), curPos(0),
         fileName(iFileName), readOnly(iReadOnly),
         realHandlerWrapper(iRealHandlerWrapper){
-    }
+        }
 
-    ReusableFileHandle(const ReusableFileHandle &rfh) :
-        isOk(rfh.isOk), curPos(rfh.curPos),fileName(rfh.fileName),
+ReusableFileHandle(const ReusableFileHandle &rfh) :
+    isOk(rfh.isOk), curPos(rfh.curPos),fileName(rfh.fileName),
         readOnly(rfh.readOnly),    realHandlerWrapper(rfh.realHandlerWrapper)  {
     }
 
-    void operator=(const ReusableFileHandle &rfh){
+    void operator = (const ReusableFileHandle &rfh){
         isOk = rfh.isOk;
         curPos = rfh.curPos;
         fileName = rfh.fileName;
         readOnly = rfh.readOnly;
         realHandlerWrapper = rfh.realHandlerWrapper;
     }
-    
-    ReusableFileHandle() : isOk(false),curPos(0),
+
+ReusableFileHandle() : isOk(false),curPos(0),
         fileName(), readOnly(false)  {
     }
 
     operator bool(){
-        return isOk;    
+        return isOk;
     }
-    
+
     void blockWriteOrRead(unsigned long length, char* data, bool writeAction);
     void fseek(unsigned long pos);
     void flush();
diff --git a/src/fvlib/Transposer.cpp b/src/fvlib/Transposer.cpp
index f667298..900c9a2 100644
--- a/src/fvlib/Transposer.cpp
+++ b/src/fvlib/Transposer.cpp
@@ -17,33 +17,40 @@ void Transposer::process(string filename) {
     process(filename, string(""), false );
 }
 
-void Transposer::process(string filename, string destFileName, bool forceOverwrite) {
+
+void Transposer::process(string filename, string destFileName,
+                         bool forceOverwrite) {
     FileVector* src_fv = new FileVector(filename,1);
     unsigned long src_nvars = src_fv->getNumVariables();
     unsigned long src_nobss = src_fv->getNumObservations();
     unsigned int data_size = src_fv->getElementSize();
 
     string dest_file_name;
-    string src_data_file_name; 
-    string dest_data_file_name; 
-    
-    if (destFileName=="") { 
-	    // legacy
-    	dest_file_name = extract_base_file_name(filename) + "_transposed";
-	    src_data_file_name = extract_base_file_name(filename) + FILEVECTOR_DATA_FILE_SUFFIX;
-	    dest_data_file_name = extract_base_file_name(filename) + "_transposed" + FILEVECTOR_DATA_FILE_SUFFIX;
+    string src_data_file_name;
+    string dest_data_file_name;
+
+    if (destFileName == "") {
+        // legacy
+        dest_file_name = extract_base_file_name(filename) + "_transposed";
+        src_data_file_name = extract_base_file_name(filename) +
+            FILEVECTOR_DATA_FILE_SUFFIX;
+        dest_data_file_name = extract_base_file_name(filename) + "_transposed" +
+            FILEVECTOR_DATA_FILE_SUFFIX;
     } else {
-	    dest_file_name = destFileName;   
-	    src_data_file_name = filename + FILEVECTOR_DATA_FILE_SUFFIX;
-	    dest_data_file_name = destFileName + FILEVECTOR_DATA_FILE_SUFFIX;
+        dest_file_name = destFileName;
+        src_data_file_name = filename + FILEVECTOR_DATA_FILE_SUFFIX;
+        dest_data_file_name = destFileName + FILEVECTOR_DATA_FILE_SUFFIX;
     }
 
 
     if (!forceOverwrite && headerOrDataExists(dest_file_name)) {
-        errorLog << "File already exists: " << dest_file_name << endl << errorExit;
+        errorLog << "File already exists: " << dest_file_name
+                 << endl << errorExit;
     }
 
-    initializeEmptyFile(dest_file_name, src_fv->getNumObservations(), src_fv->getNumVariables(), src_fv->getElementType(),true);
+    initializeEmptyFile(dest_file_name, src_fv->getNumObservations(),
+                        src_fv->getNumVariables(), src_fv->getElementType(),
+                        true);
 
     FileVector* dest_fv = new FileVector(dest_file_name,1);
     dbg << "Copying var/obs names...";
@@ -51,113 +58,141 @@ void Transposer::process(string filename, string destFileName, bool forceOverwri
 
     delete src_fv;
     delete dest_fv;
-    dbg << "done"<< endl;
+    dbg << "done" << endl;
 
-    copy_data(src_data_file_name,dest_data_file_name,src_nvars,src_nobss,data_size);
+    copy_data(src_data_file_name, dest_data_file_name, src_nvars, src_nobss,
+              data_size);
     dbg << "done"<< endl;
 }
 
+
 void Transposer::write_var_obs_names(FileVector *src_fv, FileVector *dest_fv) {
-   // copy observations and variables names
-   for( unsigned long i=0 ; i < src_fv->getNumVariables(); i++ )
-     dest_fv->writeObservationName( i, src_fv->readVariableName(i) );
+    // copy observations and variables names
+    for (unsigned long i = 0 ; i < src_fv->getNumVariables(); i++ )
+        dest_fv->writeObservationName( i, src_fv->readVariableName(i) );
 
-   for( unsigned long i=0 ; i < src_fv->getNumObservations(); i++ )
-     dest_fv->writeVariableName( i, src_fv->readObservationName(i) );
+    for (unsigned long i = 0 ; i < src_fv->getNumObservations(); i++ )
+        dest_fv->writeVariableName( i, src_fv->readObservationName(i) );
 }
 
 
-void Transposer::copy_data(string src_data_file_name,string dest_data_file_name, unsigned long src_nvars,
-unsigned long src_nobss, unsigned int data_size) {
-  dbg<< "Copying data..."<< src_nobss << "x"<< src_nvars << endl;
-
-  unsigned long obs_pages = src_nobss / square_size;
-  if(src_nobss % square_size > 0) obs_pages++;
-
-  unsigned long var_pages = src_nvars / square_size;
-  if(src_nvars % square_size > 0) var_pages++;
-
-  ifstream * src_stream = new ifstream();
-  src_stream->open(src_data_file_name.c_str(),ios::in | ios::binary);
-
-  ofstream * dest_stream = new ofstream;
-  dest_stream->open(dest_data_file_name.c_str(),ios::out | ios::binary);
-
-  for( unsigned long i =0; i< var_pages;i++) {
-      for( unsigned long j =0; j< obs_pages;j++) {
-          unsigned long obs_length = square_size;
-          if((j + 1 )* square_size > src_nobss)
-              obs_length = src_nobss % square_size;
-
-          unsigned long var_length = square_size;
-          if((i + 1 )* square_size > src_nvars)
-              var_length = src_nvars % square_size;
-
-          char * data_part = new (nothrow) char[var_length*obs_length*data_size];
-          if(!data_part) errorLog << "can not allocate memory for data_part" << errorExit;
-          char * data_part_transposed = new (nothrow) char[var_length*obs_length*data_size];
-          if(!data_part_transposed) errorLog << "can not allocate memory for data_part_transposed" << errorExit;
-
-          read_part(src_stream, data_part, j * square_size , obs_length, i * square_size , var_length,  data_size, src_nobss );
-          transpose_part(data_part,data_part_transposed,obs_length,var_length, data_size);
-          write_part(dest_stream, data_part_transposed, i * square_size, var_length, j* square_size , obs_length,  data_size, src_nvars );
-
-          delete[] data_part;
-          delete[] data_part_transposed;
-      }
-      dbg << endl;
-  }
+void Transposer::copy_data(string src_data_file_name, string dest_data_file_name,
+                           unsigned long src_nvars, unsigned long src_nobss,
+                           unsigned int data_size) {
+    dbg << "Copying data..." << src_nobss << "x" << src_nvars << endl;
+
+    unsigned long obs_pages = src_nobss / square_size;
+    if (src_nobss % square_size > 0) obs_pages++;
+
+    unsigned long var_pages = src_nvars / square_size;
+    if (src_nvars % square_size > 0) var_pages++;
+
+    ifstream * src_stream = new ifstream();
+    src_stream->open(src_data_file_name.c_str(),ios::in | ios::binary);
+
+    ofstream * dest_stream = new ofstream;
+    dest_stream->open(dest_data_file_name.c_str(),ios::out | ios::binary);
+
+    for (unsigned long i = 0; i < var_pages; i++) {
+        for (unsigned long j = 0; j< obs_pages; j++) {
+            unsigned long obs_length = square_size;
+            if ((j + 1 ) * square_size > src_nobss)
+                obs_length = src_nobss % square_size;
+
+            unsigned long var_length = square_size;
+            if ((i + 1 ) * square_size > src_nvars)
+                var_length = src_nvars % square_size;
+
+            char * data_part =
+                new (nothrow) char[var_length*obs_length*data_size];
+            if (!data_part)
+                errorLog << "can not allocate memory for data_part"
+                         << errorExit;
+
+            char * data_part_transposed =
+                new (nothrow) char[var_length*obs_length*data_size];
+            if (!data_part_transposed)
+                errorLog << "can not allocate memory for data_part_transposed"
+                         << errorExit;
+
+            read_part(src_stream, data_part, j * square_size ,
+                      obs_length, i * square_size , var_length,
+                      data_size, src_nobss);
+            transpose_part(data_part, data_part_transposed, obs_length,
+                           var_length, data_size);
+            write_part(dest_stream, data_part_transposed, i * square_size,
+                       var_length, j * square_size, obs_length,
+                       data_size, src_nvars);
+
+            delete[] data_part;
+            delete[] data_part_transposed;
+        }
+        dbg << endl;
+    }
 
-  src_stream->close();
-  delete src_stream;
-  dest_stream->close();
-  delete dest_stream;
+    src_stream->close();
+    delete src_stream;
+    dest_stream->close();
+    delete dest_stream;
 
-  dbg<< "data written" << endl;
+    dbg << "data written" << endl;
 }
 
 
 /*
-* read next piece of data with size = obs_length x var_length, starting from var_start, obs_start coordinates
-*/
-void Transposer::read_part(ifstream * src_stream, char * data_part, unsigned long obs_start , unsigned long obs_length,
-unsigned long var_start, unsigned long var_length , unsigned int  data_size, unsigned long src_obs_length ) {
-	for(unsigned long i=0; i<var_length ;i++) {
-	   //seek to the beginning of the next var
-	   unsigned long read_pos =   (var_start + i )* src_obs_length  + obs_start ;
-	   src_stream->seekg( read_pos * data_size , ios::beg );
-	   //read next var to input buffer
-	   src_stream->read( data_part + ( i * obs_length * data_size ), obs_length * data_size );
-	}
+ * read next piece of data with size = obs_length x var_length,
+ * starting from var_start, obs_start coordinates
+ */
+void Transposer::read_part(ifstream * src_stream, char * data_part,
+                           unsigned long obs_start, unsigned long obs_length,
+                           unsigned long var_start, unsigned long var_length,
+                           unsigned int  data_size,
+                           unsigned long src_obs_length) {
+    for (unsigned long i = 0; i < var_length; i++) {
+        //seek to the beginning of the next var
+        unsigned long read_pos = (var_start + i ) * src_obs_length + obs_start;
+        src_stream->seekg(read_pos * data_size, ios::beg);
+        //read next var to input buffer
+        src_stream->read(data_part + ( i * obs_length * data_size ),
+                         obs_length * data_size );
+    }
 }
 
+
 /*
-* write next piece of transposed data with size = obs_length' x var_length'
-*/
-void Transposer::write_part(ofstream * dest_stream, char * data_part_transposed, unsigned long obs_start , unsigned long obs_length,
-unsigned long var_start, unsigned long var_length , unsigned int  data_size, unsigned long dest_obs_length ) {
-	for(unsigned long i=0; i<var_length ;i++) {
-	   //seek to the beginning of the next var
-	   unsigned long write_pos =   (var_start + i )* dest_obs_length  + obs_start ;
-	   dest_stream->seekp( write_pos * data_size , ios::beg );
-	   //write next piece of var to file
-	   dest_stream->write( data_part_transposed + ( i * obs_length * data_size ), obs_length * data_size );
-	}
+ * write next piece of transposed data with size = obs_length' x var_length'
+ */
+void Transposer::write_part(ofstream * dest_stream, char * data_part_transposed,
+                            unsigned long obs_start, unsigned long obs_length,
+                            unsigned long var_start, unsigned long var_length,
+                            unsigned int  data_size,
+                            unsigned long dest_obs_length) {
+    for (unsigned long i = 0; i < var_length; i++) {
+        // seek to the beginning of the next var
+        unsigned long write_pos = (var_start + i ) * dest_obs_length + obs_start;
+        dest_stream->seekp(write_pos * data_size, ios::beg);
+        // write next piece of var to file
+        dest_stream->write(data_part_transposed + (i * obs_length * data_size),
+                           obs_length * data_size );
+    }
 }
 
+
 /*
-* transpose piece of data to write to the new file.
-* original axb matrix flipped to bxa matrix.
-*/
+ * transpose piece of data to write to the new file.
+ * original axb matrix flipped to bxa matrix.
+ */
 void Transposer::transpose_part(void * data_part, void * data_part_transposed,
-unsigned long obs_length,unsigned long var_length, unsigned int data_size ) {
-	for(unsigned long i=0; i<var_length ;i++) {
-		for(unsigned long j=0; j<obs_length ;j++) {
-           int from_pos =  (i * obs_length + j )* data_size;
-           int to_pos = ( j * var_length  + i ) * data_size;
-		   memcpy((char*)data_part_transposed + to_pos,
-		          (char*)data_part + from_pos,
-		          data_size);
-		}
-	}
+                                unsigned long obs_length,
+                                unsigned long var_length,
+                                unsigned int data_size) {
+    for (unsigned long i = 0; i < var_length; i++) {
+        for(unsigned long j = 0; j < obs_length; j++) {
+            int from_pos = (i * obs_length + j ) * data_size;
+            int to_pos = ( j * var_length  + i ) * data_size;
+            memcpy((char*)data_part_transposed + to_pos,
+                   (char*)data_part + from_pos,
+                   data_size);
+        }
+    }
 }
diff --git a/src/fvlib/Transposer.h b/src/fvlib/Transposer.h
index f9bc44c..2cb4753 100644
--- a/src/fvlib/Transposer.h
+++ b/src/fvlib/Transposer.h
@@ -15,30 +15,36 @@ data copying is working as explained below:
 
 class Transposer
 {
-public :
-Transposer(){ square_size =10000;};
-Transposer(int opt_square_size){ square_size=opt_square_size;};
+ public :
+    Transposer(){ square_size =10000;};
+    Transposer(int opt_square_size){ square_size=opt_square_size;};
 
-void process(string filename, string destFileName, bool forceOverwrite);
-void process(string filename);
+    void process(string filename, string destFileName, bool forceOverwrite);
+    void process(string filename);
 
-void write_var_obs_names(FileVector * src_fv, FileVector * dest_fv);
+    void write_var_obs_names(FileVector * src_fv, FileVector * dest_fv);
 
-void copy_data(string src_data_file_name,string dest_data_file_name, unsigned long src_nvars,
-unsigned long src_nobss, unsigned int data_size);
+    void copy_data(string src_data_file_name, string dest_data_file_name,
+                   unsigned long src_nvars, unsigned long src_nobss,
+                   unsigned int data_size);
 
-void read_part(ifstream * src_stream, char * data_part, unsigned long obs_start , unsigned long obs_length,
-unsigned long var_start, unsigned long var_length , unsigned int  data_size,unsigned long src_obs_length );
+    void read_part(ifstream * src_stream, char * data_part,
+                   unsigned long obs_start, unsigned long obs_length,
+                   unsigned long var_start, unsigned long var_length ,
+                   unsigned int  data_size,unsigned long src_obs_length);
 
-void write_part(ofstream * src_stream, char * data_part_transposed, unsigned long obs_start , unsigned long obs_length,
-unsigned long var_start, unsigned long var_length , unsigned int  data_size, unsigned long dest_obs_length );
+    void write_part(ofstream * src_stream, char * data_part_transposed,
+                    unsigned long obs_start, unsigned long obs_length,
+                    unsigned long var_start, unsigned long var_length,
+                    unsigned int  data_size, unsigned long dest_obs_length);
 
-void transpose_part(void * data_part, void * data_part_transposed,
-unsigned long obs_length,unsigned long var_length, unsigned int data_size );
+    void transpose_part(void * data_part, void * data_part_transposed,
+                        unsigned long obs_length,unsigned long var_length,
+                        unsigned int data_size );
 
-private:
+ private:
 //number of elements in square side. square_size^2 elements will be processed at one time:read and write
-unsigned int square_size;
+    unsigned int square_size;
 
 };
 
diff --git a/src/fvlib/convert_util.cpp b/src/fvlib/convert_util.cpp
index 79e2015..59774d1 100644
--- a/src/fvlib/convert_util.cpp
+++ b/src/fvlib/convert_util.cpp
@@ -20,287 +20,312 @@ using namespace std;
 #include <sstream>
 
 unsigned long calcNumLines(string fileName){
-	ifstream file(fileName.c_str());
-	string line;
-	unsigned long numlines = 0;
-	while(getline(file, line)){
-		numlines++;
-	}
-	return numlines;
+    ifstream file(fileName.c_str());
+    string line;
+    unsigned long numlines = 0;
+    while(getline(file, line)){
+        numlines++;
+    }
+    return numlines;
 }
 
+
 void messageOnOff(int bit)
 {
     msg << (bit?"ON":"OFF");
 }
 
+
 unsigned long calcNumWordsInFirstLine(string fileName){
-	ifstream file(fileName.c_str());
-	vector<string> words;
-	string line;
-	getline(file, line);
-	tokenize(line, words);
-	return words.size();
+    ifstream file(fileName.c_str());
+    vector<string> words;
+    string line;
+    getline(file, line);
+    tokenize(line, words);
+    return words.size();
 }
 
+
 void text2fvf(string program_name, string infilename, string outfilename,
-		string rownamesfilename, string colnamesfilename, int rncol, int cnrow,
-		unsigned long skiprows, unsigned long skipcols, int bTranspose, int Rmatrix,
-		unsigned short type, bool quiet, string nanString) {
-
-	if (Rmatrix) {
-		skipcols = skiprows = 1;
-		rncol = cnrow = 1;
-	}
-
-	if (!quiet) {
-		msg << "Options in effect: \n";
-
-		msg << "\t --infile    = " << infilename.c_str() << endl;
-		msg << "\t --outfile   = " << outfilename.c_str()<< endl;
-
-		msg << "\t --skiprows  = ";
-		if (skiprows) msg << skiprows << endl; else msg << "OFF\n";
-
-		msg << "\t --skipcols  = ";
-		if (skipcols) msg << skipcols << endl; else msg <<"OFF\n";
-
-		msg << "\t --cnrow     = ";
-		if (cnrow || colnamesfilename != "") {
-			if (colnamesfilename == "")
-				msg<<"ON, using line "<<cnrow<<" of '" <<infilename << "'\n";
-			else
-				msg<<"ON, using data from file '" <<colnamesfilename<< "'\n";
-		} else {
-			msg << "OFF\n";
-		}
-
-		msg << "\t --rncol     = ";
-
-		if (rncol || rownamesfilename != "") {
-			if (rownamesfilename == "")
-				msg << "ON, using column " << rncol << " of '" << infilename << "'\n";
-			else
-				msg << "ON, using data from file '" << rownamesfilename << "'\n";
-		} else {
-			msg << "OFF\n";
-		}
-
-		msg << "\t --transpose = ";
-		messageOnOff(bTranspose);
-		msg << "\n";
-		msg << "\t --Rmatrix   = ";
-		messageOnOff(Rmatrix);
-		msg << endl;
-		msg << "\t --nanString = " << nanString;
-		msg << endl;
-	}
-
-	const string TMP_SUFFIX = "_fvtmp";
-	string realOutFilename = outfilename;
-
-	// if transpose if OFF, do transpose (sic) and write to temp file
-	if (!bTranspose){
-		outfilename = outfilename + TMP_SUFFIX;
-	}
-
-	// check that it is mentioned how many columns to skip when reading row names
-	if (rownamesfilename=="" && (rncol>0) && !skipcols) {
-		errorLog << "\n\nPlease tell how many columns to skip when you provide the column containing row names!" << endl << endl << errorExit;
-	}
-	if (skipcols && (rncol > ((int) skipcols) ) ) {
-		errorLog << "rncol > skipcols" << errorExit;
-	}
-	if (colnamesfilename=="" && (cnrow>0) && !skiprows) {
-		errorLog << "\n\nPlease tell how many rows to skip when you provide the row containing column names!" << endl << endl << errorExit;
-	}
-	if (skiprows && (cnrow > ((int) skiprows) ) ) {
-		errorLog << "cnrow > skiprows" << errorExit;
-	}
-
-	ifstream infile(infilename.c_str());
-	if (!infile) {
-	    errorLog << "Can not open file '" << infilename << "' for reading\n\n" << errorExit;
-	}
-
-	vector<string> extColNames;
-
-	// column names specified in a separate file; check the number of columns
-	unsigned long words_in_colnamesfile = 0;
-
-	// reading column names from file
-	if (colnamesfilename != "")
-	{
-		msg << "Reading columns from "  << colnamesfilename << ": ";
-		ifstream colnamesfile(colnamesfilename.c_str());
-		string tmpstr;
-		if (!colnamesfile) {
-			errorLog << "Can not open column names file '" << colnamesfilename << "'\n\n" << errorExit;
-		}
-		while (colnamesfile >> tmpstr) {
-			words_in_colnamesfile++;
-			extColNames.push_back(tmpstr);
-		}
-		colnamesfile.close();
-		if (!quiet) {
-		    msg << "Number of names in column-names file '" << colnamesfilename << "' is ";
-		    msg <<words_in_colnamesfile<< "\n\n";
-		}
-	}
-
-	vector<string> extRowNames;
-
-	// row names specified in a separate file; check the number of columns
-	unsigned long words_in_rownamesfile = 0;
-
-	// reading row names from file
-	if (rownamesfilename != "") {
-		ifstream rownamesfile(rownamesfilename.c_str());
-		string tmpstr;
-		if (!rownamesfile) {
-			errorLog<< "Can not open row names file '"<<rownamesfilename<<"'\n\n";
-		}
-		while (rownamesfile >> tmpstr) {
-			words_in_rownamesfile++;
-			extRowNames.push_back(tmpstr);
-		}
-
-		rownamesfile.close();
-
-		if (!quiet){
-			msg << "number of names in row-names file '" << rownamesfilename;
-			msg << "' is "<<words_in_rownamesfile<<"\n\n"<< endl;
-		}
-
-	}
-
-	ifstream srcFile(infilename.c_str());
-
-	string firstLine;
-
-	vector<string> firstLineWords;
-	tokenize(firstLine, firstLineWords);
-
-	unsigned long numLines = calcNumLines(infilename);
-	unsigned long numWords = calcNumWordsInFirstLine(infilename);
-
-	msg << "Number of lines in source file is " << numLines << endl;
-	msg << "Number of words in source file is " << numWords << endl;
-
-	msg << "skiprows = " << skiprows << endl;
-	msg << "cnrow = " << cnrow << endl;
-	msg << "skipcols = " << skipcols << endl;
-	msg << "rncol = " << rncol << endl;
-	msg << "Rmatrix = " << Rmatrix << endl;
-	msg << "numWords = " << numWords << endl;
-
-	long int numRows = numLines - skiprows;
-	long int numColumns=123;
-
-	bool colNamesFilePresents = (colnamesfilename!="");
-	bool rowNamesFilePresents = (rownamesfilename!="");
-
-	numColumns = numWords - skipcols;
-	if (Rmatrix && !colNamesFilePresents)
-		numColumns = numWords - skipcols + 1;
-
-	msg << "Creating file with numRows = " << numRows << endl;
-	msg << "Creating file with numColumns = " << numColumns << endl;
-
-	initializeEmptyFile(outfilename, numRows, numColumns, type, true );
-	FileVector *out = new FileVector(outfilename, 1);
-
-	string line;
-	unsigned long rowCnt = 1;
-	unsigned long lineCnt = 1;
-
-	short element_size = out->getElementSize();
-	char* ArbTypeData = new (nothrow) char [(out->getNumObservations())*element_size];
-
-	while(getline(srcFile, line)) {
-
-		// is this a column name line?
-		if (lineCnt == ((unsigned long) cnrow) && !colNamesFilePresents)
-		{
-			unsigned long i;
+              string rownamesfilename, string colnamesfilename,
+              int rncol, int cnrow,
+              unsigned long skiprows, unsigned long skipcols,
+              int bTranspose, int Rmatrix, unsigned short type,
+              bool quiet, string nanString) {
+
+    if (Rmatrix) {
+        skipcols = skiprows = 1;
+        rncol = cnrow = 1;
+    }
+
+    if (!quiet) {
+        msg << "Options in effect: \n";
+
+        msg << "\t --infile    = " << infilename.c_str() << endl;
+        msg << "\t --outfile   = " << outfilename.c_str()<< endl;
+
+        msg << "\t --skiprows  = ";
+        if (skiprows) msg << skiprows << endl; else msg << "OFF\n";
+
+        msg << "\t --skipcols  = ";
+        if (skipcols) msg << skipcols << endl; else msg << "OFF\n";
+
+        msg << "\t --cnrow     = ";
+        if (cnrow || colnamesfilename != "") {
+            if (colnamesfilename == "")
+                msg << "ON, using line " << cnrow << " of '"
+                    << infilename << "'\n";
+            else
+                msg << "ON, using data from file '"
+                    << colnamesfilename<< "'\n";
+        } else {
+            msg << "OFF\n";
+        }
+
+        msg << "\t --rncol     = ";
+
+        if (rncol || rownamesfilename != "") {
+            if (rownamesfilename == "")
+                msg << "ON, using column " << rncol << " of '"
+                    << infilename << "'\n";
+            else
+                msg << "ON, using data from file '"
+                    << rownamesfilename << "'\n";
+        } else {
+            msg << "OFF\n";
+        }
+
+        msg << "\t --transpose = ";
+        messageOnOff(bTranspose);
+        msg << "\n";
+        msg << "\t --Rmatrix   = ";
+        messageOnOff(Rmatrix);
+        msg << endl;
+        msg << "\t --nanString = " << nanString;
+        msg << endl;
+    }
+
+    const string TMP_SUFFIX = "_fvtmp";
+    string realOutFilename = outfilename;
+
+    // if transpose if OFF, do transpose (sic) and write to temp file
+    if (!bTranspose){
+        outfilename = outfilename + TMP_SUFFIX;
+    }
+
+    // check that it is mentioned how many columns to skip when reading row names
+    if (rownamesfilename=="" && (rncol > 0) && !skipcols) {
+        errorLog << "\n\nPlease tell how many columns to skip when you "
+                 << "provide the column containing row names!"
+                 << endl << endl << errorExit;
+    }
+    if (skipcols && (rncol > ((int) skipcols) ) ) {
+        errorLog << "rncol > skipcols" << errorExit;
+    }
+    if (colnamesfilename=="" && (cnrow>0) && !skiprows) {
+        errorLog << "\n\nPlease tell how many rows to skip when you "
+                 << "provide the row containing column names!"
+                 << endl << endl << errorExit;
+    }
+    if (skiprows && (cnrow > ((int) skiprows) ) ) {
+        errorLog << "cnrow > skiprows" << errorExit;
+    }
+
+    ifstream infile(infilename.c_str());
+    if (!infile) {
+        errorLog << "Can not open file '" << infilename
+                 << "' for reading\n\n" << errorExit;
+    }
+
+    vector<string> extColNames;
+
+    // column names specified in a separate file; check the number of columns
+    unsigned long words_in_colnamesfile = 0;
+
+    // reading column names from file
+    if (colnamesfilename != "")
+    {
+        msg << "Reading columns from "  << colnamesfilename << ": ";
+        ifstream colnamesfile(colnamesfilename.c_str());
+        string tmpstr;
+        if (!colnamesfile) {
+            errorLog << "Can not open column names file '"
+                     << colnamesfilename << "'\n\n" << errorExit;
+        }
+        while (colnamesfile >> tmpstr) {
+            words_in_colnamesfile++;
+            extColNames.push_back(tmpstr);
+        }
+        colnamesfile.close();
+        if (!quiet) {
+            msg << "Number of names in column-names file '"
+                << colnamesfilename << "' is ";
+            msg << words_in_colnamesfile<< "\n\n";
+        }
+    }
+
+    vector<string> extRowNames;
+
+    // row names specified in a separate file; check the number of columns
+    unsigned long words_in_rownamesfile = 0;
+
+    // reading row names from file
+    if (rownamesfilename != "") {
+        ifstream rownamesfile(rownamesfilename.c_str());
+        string tmpstr;
+        if (!rownamesfile) {
+            errorLog << "Can not open row names file '"
+                     << rownamesfilename << "'\n\n";
+        }
+        while (rownamesfile >> tmpstr) {
+            words_in_rownamesfile++;
+            extRowNames.push_back(tmpstr);
+        }
+
+        rownamesfile.close();
+
+        if (!quiet){
+            msg << "number of names in row-names file '" << rownamesfilename;
+            msg << "' is " << words_in_rownamesfile << "\n\n" << endl;
+        }
+
+    }
+
+    ifstream srcFile(infilename.c_str());
+
+    string firstLine;
+
+    vector<string> firstLineWords;
+    tokenize(firstLine, firstLineWords);
+
+    unsigned long numLines = calcNumLines(infilename);
+    unsigned long numWords = calcNumWordsInFirstLine(infilename);
+
+    msg << "Number of lines in source file is " << numLines << endl;
+    msg << "Number of words in source file is " << numWords << endl;
+
+    msg << "skiprows = " << skiprows << endl;
+    msg << "cnrow = "    << cnrow    << endl;
+    msg << "skipcols = " << skipcols << endl;
+    msg << "rncol = "    << rncol    << endl;
+    msg << "Rmatrix = "  << Rmatrix  << endl;
+    msg << "numWords = " << numWords << endl;
+
+    long int numRows = numLines - skiprows;
+    long int numColumns=123;
+
+    bool colNamesFilePresents = (colnamesfilename!="");
+    bool rowNamesFilePresents = (rownamesfilename!="");
+
+    numColumns = numWords - skipcols;
+    if (Rmatrix && !colNamesFilePresents)
+        numColumns = numWords - skipcols + 1;
+
+    msg << "Creating file with numRows = " << numRows << endl;
+    msg << "Creating file with numColumns = " << numColumns << endl;
+
+    initializeEmptyFile(outfilename, numRows, numColumns, type, true );
+    FileVector *out = new FileVector(outfilename, 1);
+
+    string line;
+    unsigned long rowCnt = 1;
+    unsigned long lineCnt = 1;
+
+    short element_size = out->getElementSize();
+    char* ArbTypeData =
+        new (nothrow) char [(out->getNumObservations()) * element_size];
+
+    while(getline(srcFile, line)) {
+
+        // is this a column name line?
+        if (lineCnt == ((unsigned long) cnrow) && !colNamesFilePresents)
+        {
+            unsigned long i;
             vector<string> lineWords;
-      		tokenize(line, lineWords);
-			// ignoring R-matrix flag for some reason
-			for(i=skipcols-Rmatrix; i<lineWords.size(); i++) {
-				extColNames.push_back(lineWords[i]);
-			}
-			lineCnt++;
-			continue;
-		}
-
-		if (lineCnt <= skiprows)
-		{
-			lineCnt++;
-			continue;
-		}
-
-		unsigned long colCnt = 0;
-		unsigned long i = 0;
-		char const *SEPARATORS = " \t";
-		char *lineBuf = strdup(line.c_str());
-		char *word = strtok(lineBuf, SEPARATORS);
-		while(word!=0) {
-
-			if (i == ( (unsigned long) (rncol - 1) ) && !rowNamesFilePresents) {
-				extRowNames.push_back(word);
-				word = strtok(0, SEPARATORS);
-				i++;
-				continue;
-			}
-
-			if (i < skipcols) {
-			    word = strtok(0, SEPARATORS);
-			    i++;
-				continue;
-			}
-
-    		parseStringToArbType(word, type, &ArbTypeData[colCnt*element_size], nanString);
-			colCnt++;
-			word = strtok(0, SEPARATORS);
-			i++;
-		}
-		free(lineBuf);
-
-		out->writeVariable(rowCnt-1, (char*)ArbTypeData);
-		rowCnt++;
-		lineCnt++;
-	}
-
-	delete [] ArbTypeData;
-
-	if (!colNamesFilePresents && cnrow < 0) for (long int i=1;i<=numColumns;i++) {
-		char * tmpstr = NULL;
-		sprintf(tmpstr,"%lu",i);
-		extColNames.push_back(tmpstr);
-	}
-	if (!rowNamesFilePresents && cnrow < 0) for (long int i=1;i<=numRows;i++) {
-		char * tmpstr = NULL;
-		sprintf(tmpstr,"%lu",i);
-		extRowNames.push_back(tmpstr);
-	}
-	unsigned long i;
-	for (i=0;i<extColNames.size();i++){
-		out->writeObservationName(i,extColNames[i]);
-	}
-
-	for (i=0;i<extRowNames.size();i++){
-		out->writeVariableName(i,extRowNames[i]);
-	}
-
-	delete out;
-
-	if(!bTranspose)
-	{
-		msg << "Transposing " << outfilename << " => " << realOutFilename << "." << endl;
-		Transposer tr;
-
-		tr.process(outfilename, realOutFilename, true);
-	}
-	msg << "text2fvf finished." << endl;
+            tokenize(line, lineWords);
+            // ignoring R-matrix flag for some reason
+            for (i = skipcols-Rmatrix; i < lineWords.size(); i++) {
+                extColNames.push_back(lineWords[i]);
+            }
+            lineCnt++;
+            continue;
+        }
+
+        if (lineCnt <= skiprows)
+        {
+            lineCnt++;
+            continue;
+        }
+
+        unsigned long colCnt = 0;
+        unsigned long i = 0;
+        char const *SEPARATORS = " \t";
+        char *lineBuf = strdup(line.c_str());
+        char *word = strtok(lineBuf, SEPARATORS);
+        while(word!=0) {
+
+            if (i == ( (unsigned long) (rncol - 1) ) && !rowNamesFilePresents) {
+                extRowNames.push_back(word);
+                word = strtok(0, SEPARATORS);
+                i++;
+                continue;
+            }
+
+            if (i < skipcols) {
+                word = strtok(0, SEPARATORS);
+                i++;
+                continue;
+            }
+
+            parseStringToArbType(word, type,
+                                 &ArbTypeData[colCnt*element_size], nanString);
+            colCnt++;
+            word = strtok(0, SEPARATORS);
+            i++;
+        }
+        free(lineBuf);
+
+        out->writeVariable(rowCnt-1, (char*)ArbTypeData);
+        rowCnt++;
+        lineCnt++;
+    }
+
+    delete [] ArbTypeData;
+
+    if (!colNamesFilePresents && cnrow < 0)
+    {
+        for (long int i = 1; i <= numColumns; i++) {
+            char * tmpstr = NULL;
+            sprintf(tmpstr,"%lu",i);
+            extColNames.push_back(tmpstr);
+        }
+    }
+    if (!rowNamesFilePresents && cnrow < 0)
+    {
+        for (long int i = 1; i <= numRows; i++) {
+            char * tmpstr = NULL;
+            sprintf(tmpstr,"%lu",i);
+            extRowNames.push_back(tmpstr);
+        }
+    }
+    unsigned long i;
+    for (i = 0; i < extColNames.size(); i++){
+        out->writeObservationName(i, extColNames[i]);
+    }
+
+    for (i = 0; i < extRowNames.size(); i++){
+        out->writeVariableName(i, extRowNames[i]);
+    }
+
+    delete out;
+
+    if(!bTranspose)
+    {
+        msg << "Transposing " << outfilename << " => "
+            << realOutFilename << "." << endl;
+        Transposer tr;
+
+        tr.process(outfilename, realOutFilename, true);
+    }
+    msg << "text2fvf finished." << endl;
 }
-
diff --git a/src/fvlib/convert_util.h b/src/fvlib/convert_util.h
index a89f9d9..d4221a5 100644
--- a/src/fvlib/convert_util.h
+++ b/src/fvlib/convert_util.h
@@ -4,10 +4,12 @@
 using namespace std;
 
 unsigned long calcNumLines(string fileName);
-void parseStringToArbType(string s, int destType, void *destData); 
+void parseStringToArbType(string s, int destType, void *destData);
 void text2fvf(string program_name, string infilename, string outfilename,
-		string rownamesfilename, string colnamesfilename, int rncol, int cnrow,
-		unsigned long skiprows, unsigned long skipcols, int bTranspose, int Rmatrix,
-		unsigned short type, bool quiet, string nanString);
+              string rownamesfilename, string colnamesfilename,
+              int rncol, int cnrow,
+              unsigned long skiprows, unsigned long skipcols,
+              int bTranspose, int Rmatrix, unsigned short type,
+              bool quiet, string nanString);
 
 #endif
diff --git a/src/fvlib/frutil.cpp b/src/fvlib/frutil.cpp
index 6233214..8fb6d9e 100644
--- a/src/fvlib/frutil.cpp
+++ b/src/fvlib/frutil.cpp
@@ -7,15 +7,16 @@
 #include "FileVector.h"
 
 FileHeader get_file_type(char * filename) {
-	FileHeader out;
-	ifstream myfile(filename, ios::binary | ios::in);
-	if (!myfile) {
-		errorLog << "can not open file for reading" << endl << errorExit;
-	}
-	myfile.read((char*)&out,sizeof(out));
-	return(out);
+    FileHeader out;
+    ifstream myfile(filename, ios::binary | ios::in);
+    if (!myfile) {
+        errorLog << "can not open file for reading" << endl << errorExit;
+    }
+    myfile.read((char*)&out, sizeof(out));
+    return(out);
 }
 
+
 string extract_base_file_name(string filename)
 {
     unsigned int idxExtPos = filename.find(FILEVECTOR_INDEX_FILE_SUFFIX);
@@ -23,134 +24,150 @@ string extract_base_file_name(string filename)
     if (idxExtPos == filename.size() - FILEVECTOR_INDEX_FILE_SUFFIX.size() )
     {
         return filename.substr(0, idxExtPos);
-	}
-	else if (dataExtPos == filename.size() - FILEVECTOR_DATA_FILE_SUFFIX.size() )
-	{
-	    return filename.substr(0, dataExtPos );
-	}
-	else
-	{
-		return filename;
-	}
+    }
+    else if (dataExtPos == filename.size() - FILEVECTOR_DATA_FILE_SUFFIX.size() )
+    {
+        return filename.substr(0, dataExtPos );
+    }
+    else
+    {
+        return filename;
+    }
 }
 
+
 unsigned short calcDataSize(unsigned short int type){
     unsigned short desize;
-	switch (type) {
-	  case UNSIGNED_SHORT_INT:
-		desize = sizeof(unsigned short int);
-		break;
-	  case SHORT_INT:
-		desize = sizeof(short int);
-		break;
-	  case UNSIGNED_INT:
-		desize = sizeof(unsigned int);
-		break;
-	  case INT:
-		desize = sizeof(int);
-		break;
-	  case FLOAT:
-		desize = sizeof(float);
-		break;
-	  case DOUBLE:
-		desize = sizeof(double);
-		break;
-	  case SIGNED_CHAR:
-		desize = sizeof(char);
-		break;
-	  case UNSIGNED_CHAR:
-		desize = sizeof(unsigned char);
-		break;
-	  default:
-	        desize = 0;
-		errorLog << "file contains data of unknown type " << type << endl << errorExit;
-	}
-	return desize;
+    switch (type) {
+    case UNSIGNED_SHORT_INT:
+        desize = sizeof(unsigned short int);
+        break;
+    case SHORT_INT:
+        desize = sizeof(short int);
+        break;
+    case UNSIGNED_INT:
+        desize = sizeof(unsigned int);
+        break;
+    case INT:
+        desize = sizeof(int);
+        break;
+    case FLOAT:
+        desize = sizeof(float);
+        break;
+    case DOUBLE:
+        desize = sizeof(double);
+        break;
+    case SIGNED_CHAR:
+        desize = sizeof(char);
+        break;
+    case UNSIGNED_CHAR:
+        desize = sizeof(unsigned char);
+        break;
+    default:
+        desize = 0;
+        errorLog << "file contains data of unknown type " << type
+                 << endl << errorExit;
+    }
+    return desize;
 }
 
-void initializeEmptyFile(string filename, unsigned long numVariables, unsigned long nobservations, unsigned short type, bool override)
+
+void initializeEmptyFile(string filename, unsigned long numVariables,
+                         unsigned long nobservations, unsigned short type,
+                         bool override)
 {
-    dbg << "Initializing empty file '" << filename << "', type " << type << "." << endl;
+    dbg << "Initializing empty file '" << filename
+        << "', type " << type << "." << endl;
+
     string indexFilename = filename + FILEVECTOR_INDEX_FILE_SUFFIX;
     string dataFilename = filename + FILEVECTOR_DATA_FILE_SUFFIX;
 
-	FileHeader fileHeader;
-	unsigned long desize = calcDataSize(type);
-	fileHeader.type = type;
-	fileHeader.numVariables = numVariables;
-	fileHeader.numObservations = nobservations;
-	fileHeader.nelements = numVariables*nobservations;
-	fileHeader.bytesPerRecord = desize;
-	fileHeader.bitsPerRecord = desize*8;
-
-	bool bHeaderOrDataExists = headerOrDataExists( filename );
-
-	if (override && bHeaderOrDataExists) {
-	    dbg << "Deleting existing file" << indexFilename << endl;
-	    unlink(indexFilename.c_str());
-	    unlink(dataFilename.c_str());
-	}
+    FileHeader fileHeader;
+    unsigned long desize = calcDataSize(type);
+    fileHeader.type = type;
+    fileHeader.numVariables = numVariables;
+    fileHeader.numObservations = nobservations;
+    fileHeader.nelements = numVariables * nobservations;
+    fileHeader.bytesPerRecord = desize;
+    fileHeader.bitsPerRecord = desize*8;
+
+    bool bHeaderOrDataExists = headerOrDataExists( filename );
+
+    if (override && bHeaderOrDataExists) {
+        dbg << "Deleting existing file" << indexFilename << endl;
+        unlink(indexFilename.c_str());
+        unlink(dataFilename.c_str());
+    }
 
-	if (!override && bHeaderOrDataExists) {
-	    errorLog << "File '" << filename << "' already exists." << endl << errorExit;
-	}
+    if (!override && bHeaderOrDataExists) {
+        errorLog << "File '" << filename << "' already exists."
+                 << endl << errorExit;
+    }
 
-	ofstream indexFile(indexFilename.c_str(), ios::binary | ios::out);
-	ofstream dataFile(dataFilename.c_str(), ios::binary | ios::out);
+    ofstream indexFile(indexFilename.c_str(), ios::binary | ios::out);
+    ofstream dataFile(dataFilename.c_str(), ios::binary | ios::out);
 
-	deepDbg << "Writing FileVector header." << endl;
+    deepDbg << "Writing FileVector header." << endl;
     fileHeader.print();
 
     indexFile.seekp(0,ios::beg);
-	indexFile.write((char*)&fileHeader, sizeof(fileHeader));
+    indexFile.write((char*)&fileHeader, sizeof(fileHeader));
 
-    deepDbg << "Writing "<<nobservations<<" observations." << endl;
-	FixedChar name;
-	for (unsigned long i=0;i<nobservations;i++) {
-		sprintf(name.name, "%lu", i+1);
+    deepDbg << "Writing " << nobservations << " observations." << endl;
+    FixedChar name;
+    for (unsigned long i = 0; i < nobservations; i++) {
+        sprintf(name.name, "%lu", i+1);
         indexFile.seekp(sizeof(FileHeader) + i * sizeof(FixedChar), ios::beg);
-		indexFile.write((char*)&name.name,sizeof(name.name));
-	}
+        indexFile.write((char*)&name.name, sizeof(name.name));
+    }
 
-    deepDbg << "Writing "<< numVariables <<" variables." << endl;
+    deepDbg << "Writing " << numVariables << " variables." << endl;
 
-    for (unsigned long j=0;j<numVariables;j++) {
-		sprintf(name.name, "%lu", j+1);
-        indexFile.seekp(sizeof(FileHeader) + (j + fileHeader.numObservations) * sizeof(FixedChar), ios::beg);
-		indexFile.write((char*)&name.name,sizeof(name.name));
-	}
-	indexFile.close();
+    for (unsigned long j = 0; j < numVariables; j++) {
+        sprintf(name.name, "%lu", j+1);
+        indexFile.seekp(sizeof(FileHeader) +
+                        (j + fileHeader.numObservations) * sizeof(FixedChar),
+                        ios::beg);
+        indexFile.write((char*)&name.name, sizeof(name.name));
+    }
+    indexFile.close();
 
-	deepDbg << "Writing data file." << endl;
+    deepDbg << "Writing data file." << endl;
 
-	unsigned long estimated_data_size = (unsigned long) fileHeader.bytesPerRecord *
-										(unsigned long) fileHeader.numVariables *
-										(unsigned long) fileHeader.numObservations;
+    unsigned long estimated_data_size =
+        (unsigned long) fileHeader.bytesPerRecord *
+        (unsigned long) fileHeader.numVariables *
+        (unsigned long) fileHeader.numObservations;
     //unsigned long i;
-    dataFile.seekp(estimated_data_size-1,ios::beg);
+    dataFile.seekp(estimated_data_size-1, ios::beg);
     char c = 0;
-  	dataFile.write(&c,1);
-    deepDbg <<"Closing data file"<<endl;
-	dataFile.close();
-    dbg << "File '" << filename << "' initialized."<< endl;
+    dataFile.write(&c, 1);
+    deepDbg << "Closing data file" << endl;
+    dataFile.close();
+    dbg << "File '" << filename << "' initialized." << endl;
 }
 
+
 bool headerOrDataExists(string fileName) {
-    return file_exists(fileName + FILEVECTOR_INDEX_FILE_SUFFIX) || file_exists(fileName + FILEVECTOR_INDEX_FILE_SUFFIX);
+    return file_exists(fileName + FILEVECTOR_INDEX_FILE_SUFFIX) ||
+        file_exists(fileName + FILEVECTOR_INDEX_FILE_SUFFIX);
 }
 
+
 bool file_exists(string fileName) {
     struct stat buf;
-    int i = stat ( fileName.c_str(), &buf );
-     /* File found */
-    if ( i == 0 )
+    int i = stat( fileName.c_str(), &buf );
+    /* File found */
+    if (i == 0)
     {
         return true;
     }
     return false;
 }
 
-void tokenize(const string& str, vector<string>& tokens, const string& delimiters) {
+
+void tokenize(const string& str, vector<string>& tokens,
+              const string& delimiters) {
     string::size_type lastPos = str.find_first_not_of(delimiters, 0);
     string::size_type pos = str.find_first_of(delimiters, lastPos);
     while (string::npos != pos || string::npos != lastPos) {
@@ -160,18 +177,19 @@ void tokenize(const string& str, vector<string>& tokens, const string& delimiter
     }
 }
 
+
 #define PART_SIZE INT_MAX
-void blockWriteOrRead(fstream& file, unsigned long length, char* data, bool writeAction){
-  unsigned long i;
-  unsigned long numParts = length/PART_SIZE;
-  for(i = 0; i <= numParts; i++){
-    unsigned long subLength =
-     (numParts>0 && i < numParts )?PART_SIZE:(length%PART_SIZE);
-    if (writeAction){
-      file.write(data+i*PART_SIZE, subLength);
-    } else {
-      file.read(data+i*PART_SIZE, subLength);
+void blockWriteOrRead(fstream& file, unsigned long length,
+                      char* data, bool writeAction){
+    unsigned long i;
+    unsigned long numParts = length/PART_SIZE;
+    for(i = 0; i <= numParts; i++){
+        unsigned long subLength =
+            (numParts > 0 && i < numParts ) ? PART_SIZE:(length % PART_SIZE);
+        if (writeAction){
+            file.write(data+i*PART_SIZE, subLength);
+        } else {
+            file.read(data+i*PART_SIZE, subLength);
+        }
     }
-  }
 }
-
diff --git a/src/fvlib/frutil.h b/src/fvlib/frutil.h
index 66e893f..7371ca5 100644
--- a/src/fvlib/frutil.h
+++ b/src/fvlib/frutil.h
@@ -15,66 +15,72 @@ using namespace std;
 
 class FixedChar
 {
-public:
+ public:
     FixedChar(){
         memset(name,0xab,NAMELENGTH);
     };
     FixedChar(string s){
-    	if (s.length()>=NAMELENGTH){
-    		errorLog << "Overflow of FixedChar (length of name > NAMELENGTH (" << NAMELENGTH << "): "<<s.c_str()<<"." << endl;
-  		
-    	}
-    
-        strncpy(name,s.c_str(),NAMELENGTH-1);
-        name[NAMELENGTH-1] = '\0';    
+        if (s.length() >= NAMELENGTH){
+            errorLog << "Overflow of FixedChar (length of name > NAMELENGTH ("
+                     << NAMELENGTH << "): " << s.c_str() << "." << endl;
+
+        }
+
+        strncpy(name, s.c_str(), NAMELENGTH-1);
+        name[NAMELENGTH-1] = '\0';
     };
     char name[NAMELENGTH];
 };
 
+
 class FileHeader
 {
-public:
-	unsigned short int type;
-	// should change that to long!!!
-	unsigned int nelements;
-	unsigned int numObservations;
-	unsigned int numVariables;
-	unsigned int bytesPerRecord;
-	unsigned int bitsPerRecord;
-	unsigned int namelength;
-	unsigned int reserved[RESERVEDSPACE];
-	
+ public:
+    unsigned short int type;
+    // should change that to long!!!
+    unsigned int nelements;
+    unsigned int numObservations;
+    unsigned int numVariables;
+    unsigned int bytesPerRecord;
+    unsigned int bitsPerRecord;
+    unsigned int namelength;
+    unsigned int reserved[RESERVEDSPACE];
+
     FileHeader () {
-		type=0;
-		nelements=0;
-		numObservations=0;
-		bitsPerRecord=0;
-		bytesPerRecord=0;
-		numVariables=0;
-		namelength = NAMELENGTH;
-		for (int i=0;i<RESERVEDSPACE;i++) reserved[i]=0;
-	}
-	~FileHeader() {}
+        type = 0;
+        nelements = 0;
+        numObservations = 0;
+        bitsPerRecord = 0;
+        bytesPerRecord = 0;
+        numVariables = 0;
+        namelength = NAMELENGTH;
+        for (int i = 0; i < RESERVEDSPACE; i++) reserved[i] = 0;
+    }
+    ~FileHeader() {}
 
-	void print() {
-		dbg << "type = " << type << "("<< dataTypeToString(type) << ")"<< endl;
-		dbg << "nelements = " << nelements << endl;
-		dbg << "numObservations = " << numObservations << endl;
-		dbg << "numVariables = " << numVariables << ";" << endl;
-		dbg << "bytesPerRecord = " << bytesPerRecord << ";" << endl;
-		dbg << "bitsPerRecord = " << bitsPerRecord << ";" << endl;
-	}
+    void print() {
+        dbg << "type = " << type << "("<< dataTypeToString(type) << ")" << endl;
+        dbg << "nelements = " << nelements << endl;
+        dbg << "numObservations = " << numObservations << endl;
+        dbg << "numVariables = " << numVariables << ";" << endl;
+        dbg << "bytesPerRecord = " << bytesPerRecord << ";" << endl;
+        dbg << "bitsPerRecord = " << bitsPerRecord << ";" << endl;
+    }
 };
 
 
 FileHeader get_file_type(char * filename);
 
-void initializeEmptyFile(string filename, unsigned long numVariables, unsigned long nobservations, unsigned short int type, bool override);
+void initializeEmptyFile(string filename, unsigned long numVariables,
+                         unsigned long nobservations, unsigned short int type,
+                         bool override);
 
 string extract_base_file_name(string filename);
 bool file_exists(string fileName);
 bool headerOrDataExists(string fileName);
 unsigned short calcDataSize(unsigned short int type);
-void tokenize(const string& str, vector<string>& tokens, const string& delimiters = " \t");
-void blockWriteOrRead(fstream& file, unsigned long length, char* data, bool writeAction);
+void tokenize(const string& str, vector<string>& tokens,
+              const string& delimiters = " \t");
+void blockWriteOrRead(fstream& file, unsigned long length, char* data,
+                      bool writeAction);
 #endif
diff --git a/src/gendata.cpp b/src/gendata.cpp
index eef0f81..d43e2af 100644
--- a/src/gendata.cpp
+++ b/src/gendata.cpp
@@ -30,7 +30,7 @@ void gendata::get_var(int var, double * data)
     }
     else if (DAG != NULL)       // Read from fv file
     {
-        double tmpdata[DAG->getNumObservations()];
+        double *tmpdata = new double[DAG->getNumObservations()];
         DAG->readVariableAs((unsigned long int) var, tmpdata);
 
         unsigned int j = 0;
@@ -67,6 +67,7 @@ void gendata::get_var(int var, double * data)
                 data[j++] = val;
             }
         }
+        delete[] tmpdata;
     }
     else
     {
diff --git a/src/gendata.h b/src/gendata.h
index dcf8de6..13b62e7 100644
--- a/src/gendata.h
+++ b/src/gendata.h
@@ -18,7 +18,7 @@
 #endif
 
 class gendata {
-public:
+ public:
     unsigned int nsnps;
     unsigned int nids;
     unsigned int ngpreds;
@@ -39,7 +39,7 @@ public:
     // MAKE THAT PRIVATE, ACCESS THROUGH GET_SNP
     // ANOTHER PRIVATE OBJECT IS A POINTER TO DATABELBASECPP
     // UPDATE SNP, ALL REGRESSION METHODS: ACCOUNT FOR MISSING
-private:
+ private:
     mematrix<double> G;
     AbstractMatrix * DAG;
     unsigned short int * DAGmask;
diff --git a/src/main.cpp b/src/main.cpp
index c6f018f..57d145f 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1,3 +1,14 @@
+/**
+ * \file   main.cpp
+ * \author Yurii S. Aulchenko (cox, log, lin regressions)
+ * \author M. Kooyman
+ * \author L.C. Karssen
+ * \author Maksim V. Struchalin
+ *
+ * \brief ProbABEL main file
+ *
+ *
+ */
 //=============================================================================
 //           Filename:  src/main.cpp
 //
@@ -37,349 +48,33 @@
 #include "mematrix.h"
 #include "mematri1.h"
 #endif
+
 #include "maskedmatrix.h"
 #include "data.h"
 #include "reg1.h"
 #include "command_line_settings.h"
-
 #include "coxph_data.h"
-//#include "coxph_reg.cpp"
-
-#define MAXITER 10
+#include "main_functions_dump.h"
 
+/// Maximum number of iterations we allow the regression to run
+#define MAXITER 20
+/// Tolerance for convergence
 #define EPS 1.e-8
+/// Precision for the Cholesky decomposition
 #define CHOLTOL 1.5e-12
 
-void update_progress_to_cmd_line(int csnp, int nsnps)
-{
-    std::cout << setprecision(2) << fixed;
-
-    if (csnp % 1000 == 0)
-    {
-        if (csnp == 0)
-        {
-            std::cout << "Analysis: "
-                      << setw(5)
-                      << 100. * static_cast<double>(csnp)
-                              / static_cast<double>(nsnps)
-                      << "%...";
-        }
-        else
-        {
-            std::cout << "\b\b\b\b\b\b\b\b\b"
-                      << setw(5)
-                      << 100. * static_cast<double>(csnp)
-                              / static_cast<double>(nsnps)
-                      << "%...";
-        }
-        std::cout.flush();
-    }
-    std::cout << setprecision(6);
-}
-
-void open_files_for_output(std::vector<std::ofstream*>& outfile,
-                           std::string& outfilename_str)
-{
-    //create a list of filenames
-    const int amount_of_files = 5;
-    std::string filenames[amount_of_files] = {
-        outfilename_str + "_2df.out.txt",
-        outfilename_str + "_add.out.txt",
-        outfilename_str + "_domin.out.txt",
-        outfilename_str + "_recess.out.txt",
-        outfilename_str + "_over_domin.out.txt" };
-
-    for (int i = 0; i < amount_of_files; i++)
-    {
-        outfile.push_back(new std::ofstream());
-        outfile[i]->open((filenames[i]).c_str());
-        if (!outfile[i]->is_open())
-        {
-            std::cerr << "Cannot open file for writing: "
-                      << filenames[i]
-                      << "\n";
-            exit(1);
-        }
-    }
-}
-
-int create_phenotype(phedata& phd, cmdvars& input_var)
-{
-    phd.set_is_interaction_excluded(input_var.isIsInteractionExcluded());
-    phd.setphedata(input_var.getPhefilename(),
-                   input_var.getNoutcomes(),
-                   input_var.getNpeople(),
-                   input_var.getInteraction(),
-                   input_var.isIscox());
-
-    int interaction_cox = input_var.getInteraction();
-#if COXPH
-    interaction_cox--;
-#endif
-
-    if (input_var.getInteraction() < 0 ||
-        input_var.getInteraction() > phd.ncov ||
-        interaction_cox > phd.ncov)
-    {
-        std::cerr << "error: Interaction parameter is out of range "
-                  << "(interaction="
-                  << input_var.getInteraction()
-                  << ") \n";
-        exit(1);
-    }
-
-    return interaction_cox;
-}
-
-void loadInvSigma(cmdvars& input_var, phedata& phd, masked_matrix& invvarmatrix)
-{
-    std::cout << "you are running mmscore...\n";
-    InvSigma inv(input_var.getInverseFilename(), &phd);
-    // invvarmatrix = inv.get_matrix();
-    //double par = 1.; //var(phd.Y)*phd.nids/(phd.nids-phd.ncov-1);
-    invvarmatrix.set_matrix(inv.get_matrix());    // = invvarmatrix * par;
-    std::cout << " loaded InvSigma ..." << std::flush;
-}
-
-void create_start_of_header(std::vector<std::ofstream*>& outfile,
-        cmdvars& input_var, phedata& phd)
-{
-    for (unsigned int i = 0; i < outfile.size(); i++)
-    {
-        (*outfile[i]) << "name"
-                      << input_var.getSep()
-                      << "A1"
-                      << input_var.getSep()
-                      << "A2"
-                      << input_var.getSep()
-                      << "Freq1"
-                      << input_var.getSep()
-                      << "MAF"
-                      << input_var.getSep()
-                      << "Quality"
-                      << input_var.getSep()
-                      << "Rsq"
-                      << input_var.getSep()
-                      << "n"
-                      << input_var.getSep()
-                      << "Mean_predictor_allele";
-        if (input_var.getChrom() != "-1")
-            (*outfile[i]) << input_var.getSep() << "chrom";
-        if (input_var.getMapfilename() != NULL)
-            (*outfile[i]) << input_var.getSep() << "position";
-    }
-
-    if (input_var.getAllcov()) //All covariates in output
-    {
-        for (unsigned int file = 0; file < outfile.size(); file++)
-            for (int i = 0; i < phd.n_model_terms - 1; i++)
-                *outfile[file] << input_var.getSep()
-                               << "beta_"
-                               << phd.model_terms[i]
-                               << input_var.getSep()
-                               << "sebeta_"
-                               << phd.model_terms[i];
-    }
-}
-
 
-void create_header(std::vector<std::ofstream*>& outfile, cmdvars& input_var,
-                   phedata& phd, int& interaction_cox)
-{
-    create_start_of_header(outfile, input_var, phd);
 
-    if (input_var.getNgpreds() == 1) // dose data: only additive model
-    {
-        *outfile[0] << input_var.getSep()
-                    << "beta_SNP_add"
-                    << input_var.getSep()
-                    << "sebeta_SNP_add";
-
-        if (input_var.getInteraction() != 0)
-        {
-            *outfile[0] << input_var.getSep()
-                        << "beta_SNP_"
-                        << phd.model_terms[interaction_cox]
-                        << input_var.getSep()
-                        << "sebeta_SNP_"
-                        << phd.model_terms[interaction_cox];
-        }
-
-        if (input_var.getInverseFilename() == NULL)
-        {
-            //Han Chen
-#if !COXPH
-            if (input_var.getInteraction() != 0 && !input_var.getAllcov())
-            {
-                *outfile[0] << input_var.getSep()
-                            << "cov_SNP_int_SNP_"
-                            << phd.model_terms[interaction_cox];
-            }
-#endif
-        }
-        *outfile[0] << input_var.getSep() << "chi2_SNP";
-        *outfile[0] << "\n";
-    } // ngpreds == 1
-    else if (input_var.getNgpreds() == 2) // prob data: all models
-    {
-        *outfile[0] << input_var.getSep()
-                    << "beta_SNP_A1A2"
-                    << input_var.getSep()
-                    << "sebeta_SNP_A1A2"
-                    << input_var.getSep()
-                    << "beta_SNP_A1A1"
-                    << input_var.getSep()
-                    << "sebeta_SNP_A1A1";
-        *outfile[1] << input_var.getSep()
-                    << "beta_SNP_addA1"
-                    << input_var.getSep()
-                    << "sebeta_SNP_addA1";
-        *outfile[2] << input_var.getSep()
-                    << "beta_SNP_domA1"
-                    << input_var.getSep()
-                    << "sebeta_SNP_domA1";
-        *outfile[3] << input_var.getSep()
-                    << "beta_SNP_recA1"
-                    << input_var.getSep()
-                    << "sebeta_SNP_recA1";
-        *outfile[4] << input_var.getSep()
-                    << "beta_SNP_odomA1"
-                    << input_var.getSep()
-                    << "sebeta_SNP_odomA1";
-        if (input_var.getInteraction() != 0)
-        {
-            //Han Chen
-            *outfile[0] << input_var.getSep()
-                        << "beta_SNP_A1A2_"
-                        << phd.model_terms[interaction_cox]
-                        << input_var.getSep()
-                        << "sebeta_SNP_A1A2_"
-                        << phd.model_terms[interaction_cox]
-                        << input_var.getSep()
-                        << "beta_SNP_A1A1_"
-                        << phd.model_terms[interaction_cox]
-                        << input_var.getSep()
-                        << "sebeta_SNP_A1A1_"
-                        << phd.model_terms[interaction_cox];
-#if !COXPH
-            if (input_var.getInverseFilename() == NULL && !input_var.getAllcov())
-            {
-                *outfile[0] << input_var.getSep()
-                            << "cov_SNP_A1A2_int_SNP_"
-                            << phd.model_terms[interaction_cox]
-                            << input_var.getSep()
-                            << "cov_SNP_A1A1_int_SNP_"
-                            << phd.model_terms[interaction_cox];
-            }
-#endif
-            //Oct 26, 2009
-            for (unsigned int file = 1; file < outfile.size(); file++)
-            {
-                *outfile[file] << input_var.getSep()
-                               << "beta_SNP_"
-                               << phd.model_terms[interaction_cox]
-                               << input_var.getSep()
-                               << "sebeta_SNP_"
-                               << phd.model_terms[interaction_cox];
-                //Han Chen
-#if !COXPH
-                if (input_var.getInverseFilename() == NULL
-                    && !input_var.getAllcov())
-                {
-                    *outfile[file] << input_var.getSep()
-                                   << "cov_SNP_int_SNP_"
-                                   << phd.model_terms[interaction_cox];
-                }
-#endif
-                //Oct 26, 2009
-            }
-        }
-        *outfile[0] << input_var.getSep() << "chi2_SNP_2df\n";  // "loglik\n";
-        *outfile[1] << input_var.getSep() << "chi2_SNP_A1\n";   // "loglik\n";
-        *outfile[2] << input_var.getSep() << "chi2_SNP_domA1\n";// "loglik\n";
-        *outfile[3] << input_var.getSep() << "chi2_SNP_recA1\n";// "loglik\n";
-        *outfile[4] << input_var.getSep() << "chi2_SNP_odomA1\n"; // "loglik\n";
-    } // End: ngpreds == 2
-    else
-    {
-        cerr << "Error: create_header(): ngpreds != 1 or 2.\n";
-    }
-}
-
-
-void write_mlinfo(const std::vector<std::ofstream*>& outfile, unsigned int file,
-                  const mlinfo& mli, int csnp, const cmdvars& input_var,
-                  int gcount, double freq)
-{
-    *outfile[file] << mli.name[csnp]
-                   << input_var.getSep()
-                   << mli.A1[csnp]
-                   << input_var.getSep()
-                   << mli.A2[csnp]
-                   << input_var.getSep()
-                   << mli.Freq1[csnp]
-                   << input_var.getSep()
-                   << mli.MAF[csnp]
-                   << input_var.getSep()
-                   << mli.Quality[csnp]
-                   << input_var.getSep()
-                   << mli.Rsq[csnp]
-                   << input_var.getSep()
-                   << gcount
-                   << input_var.getSep()
-                   << freq;
-    if (input_var.getChrom() != "-1")
-    {
-        *outfile[file] << input_var.getSep() << input_var.getChrom();
-    }
-    if (input_var.getMapfilename() != NULL)
-    {
-        *outfile[file] << input_var.getSep() << mli.map[csnp];
-    }
-}
-
-
-int get_start_position(const cmdvars& input_var, int model,
-        int number_of_rows_or_columns)
-{
-    int start_pos;
-    if (!input_var.getAllcov() &&
-        model == 0 &&
-        input_var.getInteraction() == 0)
-    {
-        if (input_var.getNgpreds() == 2)
-        {
-            start_pos = number_of_rows_or_columns - 2;
-        } else
-        {
-            start_pos = number_of_rows_or_columns - 1;
-        }
-    } else if (!input_var.getAllcov() && model == 0
-            && input_var.getInteraction() != 0)
-    {
-        if (input_var.getNgpreds() == 2)
-        {
-            start_pos = number_of_rows_or_columns - 4;
-        } else
-        {
-            start_pos = number_of_rows_or_columns - 2;
-        }
-    } else if (!input_var.getAllcov() && model != 0
-            && input_var.getInteraction() == 0)
-    {
-        start_pos = number_of_rows_or_columns - 1;
-    } else if (!input_var.getAllcov() && model != 0
-            && input_var.getInteraction() != 0)
-    {
-        start_pos = number_of_rows_or_columns - 2;
-    } else
-    {
-        start_pos = 0;
-    }
-
-    return start_pos;
-}
 
+/**
+ * Main routine. The main logic of ProbABEL can be found here
+ *
+ * \param argc Number of command line arguments
+ * \param argv Vector containing the command line arguments
+ *
+ * \return 0 if all went well. Other integer numbers if an error
+ * occurred
+ */
 int main(int argc, char * argv[])
 {
     cmdvars input_var;
@@ -387,20 +82,22 @@ int main(int argc, char * argv[])
 
     input_var.printinfo();
 
+    cout << "Reading info data...\n" << flush;
     mlinfo mli(input_var.getMlinfofilename(), input_var.getMapfilename());
     int nsnps = mli.nsnps;
     phedata phd;
+    cout << "Reading phenotype data...\n" << flush;
     int interaction_cox = create_phenotype(phd, input_var);
 
     masked_matrix invvarmatrix;
 
-    std::cout << "Reading data..." << std::flush;
     if (input_var.getInverseFilename() != NULL)
     {
         loadInvSigma(input_var, phd, invvarmatrix);
     }
 
     gendata gtd;
+    cout << "Reading genotype data... " << flush;
     if (!input_var.getIsFvf())
     {
         // use the non-filevector input format
@@ -416,8 +113,8 @@ int main(int argc, char * argv[])
                        input_var.getNgpreds(), phd.nids_all, phd.nids,
                        phd.allmeasured, phd.idnames);
     }
+    cout << "done.\n" << flush;
 
-    std::cout << " loaded genotypic data..." << std::flush;
 
     // estimate null model
 #if COXPH
@@ -447,7 +144,8 @@ int main(int argc, char * argv[])
 #elif COXPH
     coxph_reg nrd = coxph_reg(nrgd);
     nrd.estimate(nrgd, 0, MAXITER, EPS, CHOLTOL, 0,
-                 input_var.getInteraction(), input_var.getNgpreds(), true, 1);
+                 input_var.getInteraction(), input_var.getNgpreds(),
+                 true, 1, mli, 0);
 #endif
     double null_loglik = nrd.loglik;
 
@@ -476,7 +174,7 @@ int main(int argc, char * argv[])
         {
             create_header(outfile, input_var, phd, interaction_cox);
         }
-    } else //Dosage data: Only additive model => only one output file
+    } else  // Dosage data: Only additive model => only one output file
     {
         outfile.push_back(
             new std::ofstream((outfilename_str + "_add.out.txt").c_str()));
@@ -492,7 +190,7 @@ int main(int argc, char * argv[])
         {
             create_header(outfile, input_var, phd, interaction_cox);
         }
-    } // END else: we have dosage data => only one file
+    }  // END else: we have dosage data => only one file
 
 
     int maxmod = 5;             // Total number of models (in random
@@ -505,9 +203,9 @@ int main(int argc, char * argv[])
     int start_pos, end_pos;
 
     std::vector<std::ostringstream *> beta_sebeta;
-    //Han Chen
+    // Han Chen
     std::vector<std::ostringstream *> covvalue;
-    //Oct 26, 2009
+    // Oct 26, 2009
     std::vector<std::ostringstream *> chi2;
 
     // Create string streams for betas, SEs, etc. These are used to
@@ -517,59 +215,26 @@ int main(int argc, char * argv[])
     {
         beta_sebeta.push_back(new std::ostringstream());
         beta_sebeta[i]->precision(6);
-        //*beta_sebeta[i] << scientific;
-        //Han Chen
+        // *beta_sebeta[i] << scientific;
+        // Han Chen
         covvalue.push_back(new std::ostringstream());
         covvalue[i]->precision(6);
-        //*covvalue[i] << scientific;
-        //Oct 26, 2009
+        // *covvalue[i] << scientific;
+        // Oct 26, 2009
         chi2.push_back(new std::ostringstream());
         chi2[i]->precision(6);
-        //*chi2[i] << scientific;
+        // *chi2[i] << scientific;
     }
 
 
     // Here we start the analysis for each SNP.
     for (int csnp = 0; csnp < nsnps; csnp++)
     {
-        rgd.update_snp(gtd, csnp);
-        double freq = 0.;
-        unsigned int gcount = 0;
-        double snpdata1[gtd.nids];
-        double snpdata2[gtd.nids];
+        rgd.update_snp(&gtd, csnp);
 
-        if (input_var.getNgpreds() == 2) // Two predictors (probs)
-        {
-            //freq = ((gtd.G).column_mean(csnp*2)*2. +
-            //        (gtd.G).column_mean(csnp*2+1))/2.;
-            gtd.get_var(csnp * 2, snpdata1);
-            gtd.get_var(csnp * 2 + 1, snpdata2);
-            for (unsigned int ii = 0; ii < gtd.nids; ii++)
-            {
-                if (!isnan(snpdata1[ii]) && !isnan(snpdata2[ii]))
-                {
-                    gcount++;
-                    freq += snpdata1[ii] + snpdata2[ii] * 0.5;
-                }
-            }
-        }
-        else // Only one predictor (dosage data)
-        {
-            // freq = (gtd.G).column_mean(csnp)/2.;
-            gtd.get_var(csnp, snpdata1);
-            for (unsigned int ii = 0; ii < gtd.nids; ii++)
-            {
-                if (!isnan(snpdata1[ii]))
-                {
-                    gcount++;
-                    freq += snpdata1[ii] * 0.5;
-                }
-            }
-        }
-        freq /= static_cast<double>(gcount); // Allele frequency
 
         int poly = 1;
-        if (fabs(freq) < 1.e-16 || fabs(1. - freq) < 1.e-16)
+        if (fabs(rgd.freq) < 1.e-16 || fabs(1. - rgd.freq) < 1.e-16)
         {
             poly = 0;
         }
@@ -586,13 +251,14 @@ int main(int argc, char * argv[])
             for (unsigned int file = 0; file < outfile.size(); file++)
             {
                 write_mlinfo(outfile, file, mli, csnp, input_var,
-                             gcount, freq);
+                             rgd.gcount, rgd.freq);
             }
         } else
         {
             // Dosage data: only additive model
             int file = 0;
-            write_mlinfo(outfile, file, mli, csnp, input_var, gcount, freq);
+            write_mlinfo(outfile, file, mli, csnp, input_var,
+                         rgd.gcount, rgd.freq);
             maxmod = 1;         // We can only calculate the additive
                                 // model with dosage data
         }
@@ -637,10 +303,10 @@ int main(int argc, char * argv[])
                                 input_var.getRobust());
                 }
 #elif COXPH
-                    coxph_reg rd(rgd);
-                    rd.estimate(rgd, 0, MAXITER, EPS, CHOLTOL, model,
-                                input_var.getInteraction(),
-                                input_var.getNgpreds(), true, 0);
+                coxph_reg rd(rgd);
+                rd.estimate(rgd, 0, MAXITER, EPS, CHOLTOL, model,
+                            input_var.getInteraction(),
+                            input_var.getNgpreds(), true, 0, mli, csnp);
 #endif
 
                 int number_of_rows_or_columns = rd.beta.nrow;
@@ -655,7 +321,7 @@ int main(int argc, char * argv[])
                                         << rd.beta[pos]
                                         << input_var.getSep()
                                         << rd.sebeta[pos];
-                    //Han Chen
+                    // Han Chen
 #if !COXPH
                     if (input_var.getInverseFilename() == NULL
                             && !input_var.getAllcov()
@@ -674,35 +340,33 @@ int main(int argc, char * argv[])
                                             << input_var.getSep()
                                             << rd.covariance[pos - 2];
                                     }
-
-                                } // END ngpreds=2
+                                }  // END ngpreds=2
                                 else
                                 {
                                     *covvalue[model] << rd.covariance[pos - 1];
                                 }
-
-                            } //END model == 0
+                            }  // END model == 0
                             else
                             {
                                 *covvalue[model] << rd.covariance[pos - 1];
-                            } // END model != 0
-                        } // END if pos > start_pos
+                            }  // END model != 0
+                        }  // END if pos > start_pos
                     }
 #endif
-                    //Oct 26, 2009
-                } // END for(pos = start_pos; pos < rd.beta.nrow; pos++)
+                    // Oct 26, 2009
+                }  // END for(pos = start_pos; pos < rd.beta.nrow; pos++)
 
 
-                //calculate chi^2
-                //________________________________
-                //cout <<  rd.loglik<<" "<<input_var.getNgpreds() << "\n";
+                // calculate chi^2
+                // ________________________________
+                // cout <<  rd.loglik<<" "<<input_var.getNgpreds() << "\n";
 
                 if (input_var.getInverseFilename() == NULL)
                 { // Only if we don't have an inv.sigma file can we use LRT
                     if (input_var.getScore() == 0)
                     {
                         double loglik = rd.loglik;
-                        if (gcount != gtd.nids)
+                        if (rgd.gcount != gtd.nids)
                         {
                             // If SNP data is missing we didn't
                             // correctly compute the null likelihood
@@ -738,11 +402,11 @@ int main(int argc, char * argv[])
                             coxph_data new_rgd = rgd;
                             new_rgd.remove_snp_from_X();
                             coxph_reg new_null_rd(new_rgd);
-                            new_null_rd.estimate(new_rgd, 0, MAXITER, EPS,
-                                                 CHOLTOL, model,
+                            new_null_rd.estimate(new_rgd, 0, MAXITER,
+                                                 EPS, CHOLTOL, model,
                                                  input_var.getInteraction(),
                                                  input_var.getNgpreds(),
-                                                 true, 1);
+                                                 true, 1, mli, csnp);
 #endif
                             *chi2[model] << 2. * (loglik - new_null_rd.loglik);
                         }
@@ -756,7 +420,7 @@ int main(int argc, char * argv[])
                         // We want score test output
                         *chi2[model] << rd.chi2_score;
                     }
-                } // END if( inv.sigma == NULL )
+                }  // END if( inv.sigma == NULL )
                 else if (input_var.getInverseFilename() != NULL)
                 {
                     // We can't use the LRT here, because mmscore is a
@@ -776,10 +440,9 @@ int main(int argc, char * argv[])
                         *chi2[model] << Z * Z;
                     }
                 }
-            } // END first part of if(poly); allele not too rare
+            }  // END first part of if(poly); allele not too rare
             else
             {   // SNP is rare: beta, sebeta, chi2 = nan
-
                 int number_of_rows_or_columns = rgd.X.ncol;
                 start_pos = get_start_position(input_var, model,
                         number_of_rows_or_columns);
@@ -813,7 +476,7 @@ int main(int argc, char * argv[])
 
                 if (input_var.getNgpreds() == 2)
                 {
-                    //Han Chen
+                    // Han Chen
 #if !COXPH
                     if (!input_var.getAllcov()
                             && input_var.getInteraction() != 0)
@@ -829,10 +492,10 @@ int main(int argc, char * argv[])
                         }
                     }
 #endif
-                    //Oct 26, 2009
+                    // Oct 26, 2009
                     *chi2[model] << "nan";
                 } else
-                { //ngpreds==1 (and SNP is rare)
+                { // ngpreds==1 (and SNP is rare)
                     if (input_var.getInverseFilename() == NULL)
                     {
                         //                     Han Chen
@@ -843,18 +506,18 @@ int main(int argc, char * argv[])
                             *covvalue[model] << "nan";
                         }
 #endif
-                        //Oct 26, 2009
-                    } // END if getInverseFilename == NULL
+                        // Oct 26, 2009
+                    }  // END if getInverseFilename == NULL
                     *chi2[model] << "nan";
-                } // END ngpreds == 1 (and SNP is rare)
-            } // END else: SNP is rare
-        } // END of model cycle
+                }  // END ngpreds == 1 (and SNP is rare)
+            }  // END else: SNP is rare
+        }  // END of model cycle
 
 
         // Start writing beta's, se_beta's etc. to file
         if (input_var.getNgpreds() == 2)
         {
-            for(int model=0; model < maxmod; model++)
+            for (int model = 0; model < maxmod; model++)
             {
                 *outfile[model] << beta_sebeta[model]->str()
                                 << input_var.getSep();
@@ -867,9 +530,9 @@ int main(int argc, char * argv[])
 #endif
                 *outfile[model] << chi2[model]->str()
                                 << "\n";
-            } // END for loop over all models
+            }  // END for loop over all models
         }
-        else // Dose data: only additive model. Only one output file
+        else  // Dose data: only additive model. Only one output file
         {
             *outfile[0] << beta_sebeta[0]->str() << input_var.getSep();
 #if !COXPH
@@ -886,14 +549,14 @@ int main(int argc, char * argv[])
         for (int model = 0; model < maxmod; model++)
         {
             beta_sebeta[model]->str("");
-            //Han Chen
+            // Han Chen
             covvalue[model]->str("");
-            //Oct 26, 2009
+            // Oct 26, 2009
             chi2[model]->str("");
         }
 
         update_progress_to_cmd_line(csnp, nsnps);
-    } // END for loop over all SNPs
+    }  // END for loop over all SNPs
 
 
     // We're almost done. All computations have finished, time to
diff --git a/src/main_functions_dump.cpp b/src/main_functions_dump.cpp
new file mode 100644
index 0000000..fcd7601
--- /dev/null
+++ b/src/main_functions_dump.cpp
@@ -0,0 +1,428 @@
+/*
+ * main_functions_dump.cpp
+ *
+ *  Created on: Nov 27, 2013
+ *      Author: mkooyman
+ */
+
+
+#include <stdio.h>
+#include <iostream>
+#include <cstdlib>
+#include <fstream>
+#include <sstream>
+#include <string>
+#include <iomanip>
+#include <vector>
+
+#include "maskedmatrix.h"
+#include "phedata.h"
+#include "data.h"
+#include "command_line_settings.h"
+
+/**
+ * Send a progress update (a percentage) to stdout so that the user
+ * has a rough indication of the percentage of SNPs that has already
+ * been completed.
+ *
+ * @param csnp Number of the SNP that is currently being analysed.
+ * @param nsnps Total number of SNPs
+ */
+void update_progress_to_cmd_line(const int csnp, const int nsnps)
+{
+    std::cout << std::setprecision(2) << std::fixed;
+
+    if (csnp % 1000 == 0)
+    {
+        if (csnp == 0)
+        {
+            std::cout << "Analysis: "
+                      << std::setw(5)
+                      << 100. * static_cast<double>(csnp)
+                              / static_cast<double>(nsnps)
+                      << "%...";
+        }
+        else
+        {
+            std::cout << "\b\b\b\b\b\b\b\b\b"
+                      << std::setw(5)
+                      << 100. * static_cast<double>(csnp)
+                              / static_cast<double>(nsnps)
+                      << "%...";
+        }
+        std::cout.flush();
+    }
+    std::cout << std::setprecision(6);
+}
+
+/**
+ * Open an output file for each model when using probability data
+ * (npgreds == 2). This function creates the _2df.out.txt etc. files.
+ *
+ * @param outfile Vector of output streams
+ * @param outfilename_str Basename of the outputfiles.
+ */
+void open_files_for_output(std::vector<std::ofstream*>& outfile,
+                           const std::string& outfilename_str)
+{
+    //create a list of filenames
+    const int amount_of_files = 5;
+    std::string filenames[amount_of_files] = {
+        outfilename_str + "_2df.out.txt",
+        outfilename_str + "_add.out.txt",
+        outfilename_str + "_domin.out.txt",
+        outfilename_str + "_recess.out.txt",
+        outfilename_str + "_over_domin.out.txt" };
+
+    for (int i = 0; i < amount_of_files; i++)
+    {
+        outfile.push_back(new std::ofstream());
+        outfile[i]->open((filenames[i]).c_str());
+        if (!outfile[i]->is_open())
+        {
+            std::cerr << "Cannot open file for writing: "
+                      << filenames[i]
+                      << "\n";
+            exit(1);
+        }
+    }
+}
+
+int create_phenotype(phedata& phd, const cmdvars& input_var)
+{
+    phd.set_is_interaction_excluded(input_var.isIsInteractionExcluded());
+    phd.setphedata(input_var.getPhefilename(),
+                   input_var.getNoutcomes(),
+                   input_var.getNpeople(),
+                   input_var.getInteraction(),
+                   input_var.isIscox());
+
+    int interaction_cox = input_var.getInteraction();
+#if COXPH
+    interaction_cox--;
+#endif
+
+    if (input_var.getInteraction() < 0 ||
+        input_var.getInteraction() > phd.ncov ||
+        interaction_cox > phd.ncov)
+    {
+        std::cerr << "error: Interaction parameter is out of range "
+                  << "(interaction="
+                  << input_var.getInteraction()
+                  << ") \n";
+        exit(1);
+    }
+
+    return interaction_cox;
+}
+
+
+/**
+ * Load the inverse variance-covariance matrix into an InvSigma object.
+ *
+ * @param input_var Object containing the values of the various
+ * command line options.
+ * @param phd Object with phenotype data
+ * @param invvarmatrix The object of type masked_matrix in which the
+ * inverse variance-covariance matrix is returned.
+ */
+void loadInvSigma(const cmdvars& input_var, phedata& phd,
+                  masked_matrix& invvarmatrix)
+{
+    std::cout << "You are running mmscore...\n";
+    InvSigma inv(input_var.getInverseFilename(), &phd);
+    // invvarmatrix = inv.get_matrix();
+    //double par = 1.; //var(phd.Y)*phd.nids/(phd.nids-phd.ncov-1);
+    invvarmatrix.set_matrix(inv.get_matrix());    // = invvarmatrix * par;
+    std::cout << " loaded InvSigma...\n" << std::flush;
+}
+
+
+/**
+ * Create the first part of the output file header.
+ *
+ * \param outfile Vector of output file streams. Contains the streams
+ * of the output file(s). One file when using dosage data (ngpreds==1)
+ * and one for each genetic model in case probabilities are used
+ * (ngpreds==2).
+ * \param input_var Object containing the values of the various
+ * command line options.
+ * \param phd Object with phenotype data
+ */
+void create_start_of_header(std::vector<std::ofstream*>& outfile,
+        cmdvars& input_var, phedata& phd)
+{
+    for (unsigned int i = 0; i < outfile.size(); i++)
+    {
+        (*outfile[i]) << "name"
+                      << input_var.getSep()
+                      << "A1"
+                      << input_var.getSep()
+                      << "A2"
+                      << input_var.getSep()
+                      << "Freq1"
+                      << input_var.getSep()
+                      << "MAF"
+                      << input_var.getSep()
+                      << "Quality"
+                      << input_var.getSep()
+                      << "Rsq"
+                      << input_var.getSep()
+                      << "n"
+                      << input_var.getSep()
+                      << "Mean_predictor_allele";
+        if (input_var.getChrom() != "-1")
+            (*outfile[i]) << input_var.getSep() << "chrom";
+        if (input_var.getMapfilename() != NULL)
+            (*outfile[i]) << input_var.getSep() << "position";
+    }
+
+    if (input_var.getAllcov()) //All covariates in output
+    {
+        for (unsigned int file = 0; file < outfile.size(); file++)
+            for (int i = 0; i < phd.n_model_terms - 1; i++)
+                *outfile[file] << input_var.getSep()
+                               << "beta_"
+                               << phd.model_terms[i]
+                               << input_var.getSep()
+                               << "sebeta_"
+                               << phd.model_terms[i];
+    }
+}
+
+
+/**
+ * Create the header of the output file(s).
+ *
+ * \param outfile vector of output file streams. Contains the streams
+ * of the output file(s). One file when using dosage data (ngpreds==1)
+ * and one for each genetic model in case probabilities are used
+ * (ngpreds==2).
+ * \param input_var object containing the values of the various
+ * command line options.
+ * \param phd object with phenotype data
+ * \param interaction_cox are we using the Cox model with interaction?
+ */
+void create_header(std::vector<std::ofstream*>& outfile,
+                   cmdvars& input_var, phedata& phd, int& interaction_cox)
+{
+    create_start_of_header(outfile, input_var, phd);
+
+    if (input_var.getNgpreds() == 1) // dose data: only additive model
+    {
+        *outfile[0] << input_var.getSep()
+                    << "beta_SNP_add"
+                    << input_var.getSep()
+                    << "sebeta_SNP_add";
+
+        if (input_var.getInteraction() != 0)
+        {
+            *outfile[0] << input_var.getSep()
+                        << "beta_SNP_"
+                        << phd.model_terms[interaction_cox]
+                        << input_var.getSep()
+                        << "sebeta_SNP_"
+                        << phd.model_terms[interaction_cox];
+        }
+
+        if (input_var.getInverseFilename() == NULL)
+        {
+            //Han Chen
+#if !COXPH
+            if (input_var.getInteraction() != 0 && !input_var.getAllcov())
+            {
+                *outfile[0] << input_var.getSep()
+                            << "cov_SNP_int_SNP_"
+                            << phd.model_terms[interaction_cox];
+            }
+#endif
+        }
+        *outfile[0] << input_var.getSep() << "chi2_SNP";
+        *outfile[0] << "\n";
+    } // ngpreds == 1
+    else if (input_var.getNgpreds() == 2) // prob data: all models
+    {
+        *outfile[0] << input_var.getSep()
+                    << "beta_SNP_A1A2"
+                    << input_var.getSep()
+                    << "sebeta_SNP_A1A2"
+                    << input_var.getSep()
+                    << "beta_SNP_A1A1"
+                    << input_var.getSep()
+                    << "sebeta_SNP_A1A1";
+        *outfile[1] << input_var.getSep()
+                    << "beta_SNP_addA1"
+                    << input_var.getSep()
+                    << "sebeta_SNP_addA1";
+        *outfile[2] << input_var.getSep()
+                    << "beta_SNP_domA1"
+                    << input_var.getSep()
+                    << "sebeta_SNP_domA1";
+        *outfile[3] << input_var.getSep()
+                    << "beta_SNP_recA1"
+                    << input_var.getSep()
+                    << "sebeta_SNP_recA1";
+        *outfile[4] << input_var.getSep()
+                    << "beta_SNP_odomA1"
+                    << input_var.getSep()
+                    << "sebeta_SNP_odomA1";
+        if (input_var.getInteraction() != 0)
+        {
+            //Han Chen
+            *outfile[0] << input_var.getSep()
+                        << "beta_SNP_A1A2_"
+                        << phd.model_terms[interaction_cox]
+                        << input_var.getSep()
+                        << "sebeta_SNP_A1A2_"
+                        << phd.model_terms[interaction_cox]
+                        << input_var.getSep()
+                        << "beta_SNP_A1A1_"
+                        << phd.model_terms[interaction_cox]
+                        << input_var.getSep()
+                        << "sebeta_SNP_A1A1_"
+                        << phd.model_terms[interaction_cox];
+#if !COXPH
+            if (input_var.getInverseFilename() == NULL &&
+                !input_var.getAllcov())
+            {
+                *outfile[0] << input_var.getSep()
+                            << "cov_SNP_A1A2_int_SNP_"
+                            << phd.model_terms[interaction_cox]
+                            << input_var.getSep()
+                            << "cov_SNP_A1A1_int_SNP_"
+                            << phd.model_terms[interaction_cox];
+            }
+#endif
+            //Oct 26, 2009
+            for (unsigned int file = 1; file < outfile.size(); file++)
+            {
+                *outfile[file] << input_var.getSep()
+                               << "beta_SNP_"
+                               << phd.model_terms[interaction_cox]
+                               << input_var.getSep()
+                               << "sebeta_SNP_"
+                               << phd.model_terms[interaction_cox];
+                //Han Chen
+#if !COXPH
+                if (input_var.getInverseFilename() == NULL
+                    && !input_var.getAllcov())
+                {
+                    *outfile[file] << input_var.getSep()
+                                   << "cov_SNP_int_SNP_"
+                                   << phd.model_terms[interaction_cox];
+                }
+#endif
+                //Oct 26, 2009
+            }
+        }
+        *outfile[0] << input_var.getSep() << "chi2_SNP_2df\n";
+        *outfile[1] << input_var.getSep() << "chi2_SNP_A1\n";
+        *outfile[2] << input_var.getSep() << "chi2_SNP_domA1\n";
+        *outfile[3] << input_var.getSep() << "chi2_SNP_recA1\n";
+        *outfile[4] << input_var.getSep() << "chi2_SNP_odomA1\n";
+    } // End: ngpreds == 2
+    else
+    {
+        cerr << "Error: create_header(): ngpreds != 1 or 2.\n";
+    }
+}
+
+
+/**
+ * Write the information from the mlinfo file to the output file(s).
+ *
+ * \param outfile Vector of output file(s)
+ * \param file index number identifying the file in the vector of files
+ * \param mli mlinfo object
+ * \param csnp number of the SNP that is currently being analysed
+ * \param input_var object containing the information of the options
+ * specified on the command line
+ * \param gcount The number of non-NaN genotypes
+ * \param freq The allele frequency based on the non-NaN genotypes
+ */
+void write_mlinfo(const std::vector<std::ofstream*>& outfile,
+                  const unsigned int file, const mlinfo& mli,
+                  const int csnp, const cmdvars& input_var,
+                  const int gcount, const double freq)
+{
+    *outfile[file] << mli.name[csnp]
+                   << input_var.getSep()
+                   << mli.A1[csnp]
+                   << input_var.getSep()
+                   << mli.A2[csnp]
+                   << input_var.getSep()
+                   << mli.Freq1[csnp]
+                   << input_var.getSep()
+                   << mli.MAF[csnp]
+                   << input_var.getSep()
+                   << mli.Quality[csnp]
+                   << input_var.getSep()
+                   << mli.Rsq[csnp]
+                   << input_var.getSep()
+                   << gcount
+                   << input_var.getSep()
+                   << freq;
+    if (input_var.getChrom() != "-1")
+    {
+        *outfile[file] << input_var.getSep() << input_var.getChrom();
+    }
+    if (input_var.getMapfilename() != NULL)
+    {
+        *outfile[file] << input_var.getSep() << mli.map[csnp];
+    }
+}
+
+
+/**
+ * Get the position within a (row or column) vector (the index) where
+ * a \f$ \beta \f$ (or \f$ se_{\beta} \f$) starts. This is basically a
+ * matter of counting backwards from the end of the vector/list.
+ *
+ * @param input_var Object containing the values of the various
+ * command line options.
+ * @param model Number of the genetic model (additive, etc)
+ * @param number_of_rows_or_columns Total number of rows or columns in
+ * the vector.
+ *
+ * @return Start position of beta for this model
+ */
+int get_start_position(const cmdvars& input_var, const int model,
+        const int number_of_rows_or_columns)
+{
+    int start_pos;
+    if (!input_var.getAllcov() &&
+        model == 0 &&
+        input_var.getInteraction() == 0)
+    {
+        if (input_var.getNgpreds() == 2)
+        {
+            start_pos = number_of_rows_or_columns - 2;
+        } else
+        {
+            start_pos = number_of_rows_or_columns - 1;
+        }
+    } else if (!input_var.getAllcov() && model == 0
+            && input_var.getInteraction() != 0)
+    {
+        if (input_var.getNgpreds() == 2)
+        {
+            start_pos = number_of_rows_or_columns - 4;
+        } else
+        {
+            start_pos = number_of_rows_or_columns - 2;
+        }
+    } else if (!input_var.getAllcov() && model != 0
+            && input_var.getInteraction() == 0)
+    {
+        start_pos = number_of_rows_or_columns - 1;
+    } else if (!input_var.getAllcov() && model != 0
+            && input_var.getInteraction() != 0)
+    {
+        start_pos = number_of_rows_or_columns - 2;
+    } else
+    {
+        start_pos = 0;
+    }
+
+    return start_pos;
+}
diff --git a/src/main_functions_dump.h b/src/main_functions_dump.h
new file mode 100644
index 0000000..3f75cda
--- /dev/null
+++ b/src/main_functions_dump.h
@@ -0,0 +1,38 @@
+/*
+ * main_functions_dump.h
+ *
+ *  Created on: Nov 27, 2013
+ *      Author: mkooyman
+ */
+
+#ifndef MAIN_FUNCTIONS_DUMP_H_
+#define MAIN_FUNCTIONS_DUMP_H_
+
+#include "phedata.h"
+#include "command_line_settings.h"
+#include "maskedmatrix.h"
+
+void update_progress_to_cmd_line(const int csnp, const int nsnps);
+
+void loadInvSigma(const cmdvars& input_var, phedata& phd,
+                  masked_matrix& invvarmatrix);
+
+int create_phenotype(phedata& phd, const cmdvars& input_var);
+
+void create_start_of_header(std::vector<std::ofstream*>& outfile,
+                            cmdvars& input_var, phedata& phd);
+
+void write_mlinfo(const std::vector<std::ofstream*>& outfile,
+                  const unsigned int file, const mlinfo& mli,
+                  const int csnp, const cmdvars& input_var,
+                  const int gcount, const double freq);
+
+void open_files_for_output(std::vector<std::ofstream*>& outfile,
+                           const std::string& outfilename_str);
+
+void create_header(std::vector<std::ofstream*>& outfile,
+                   cmdvars& input_var, phedata& phd, int& interaction_cox);
+
+int get_start_position(const cmdvars& input_var, const int model,
+        const int number_of_rows_or_columns);
+#endif /* MAIN_FUNCTIONS_DUMP_H_ */
diff --git a/src/maskedmatrix.h b/src/maskedmatrix.h
index 66699f0..c594640 100644
--- a/src/maskedmatrix.h
+++ b/src/maskedmatrix.h
@@ -17,7 +17,7 @@
 #endif
 
 class masked_matrix {
-public:
+ public:
     masked_matrix();
     masked_matrix(mematrix<double> M);
     void set_matrix(const mematrix<double> &M);
@@ -27,8 +27,8 @@ public:
     mematrix<double> matrix_original;
     mematrix<double> *masked_data;
     int length_of_mask;
-private:
-    //char type;
+
+ private:
     mematrix<double> matrix_masked_data;
     unsigned short int *mask_of_old;
     void mask_symmetric(int nmeasured);
diff --git a/src/mematrix.h b/src/mematrix.h
index 508fdcc..700e6ed 100644
--- a/src/mematrix.h
+++ b/src/mematrix.h
@@ -5,7 +5,7 @@ using namespace std;
 
 template<class DT> class mematrix
 {
-public:
+ public:
     int nrow;
     int ncol;
     int nelements;
diff --git a/src/phedata.cpp b/src/phedata.cpp
index 7ac5857..4c0bc18 100644
--- a/src/phedata.cpp
+++ b/src/phedata.cpp
@@ -1,9 +1,14 @@
+#include <phedata.h>
 #include <string>
 #include <sstream>
 #include <fstream>
 #include <cstdarg>
 #include <cstdlib>
-#include <phedata.h>
+
+using std::cout;
+using std::cerr;
+using std::endl;
+
 
 phedata::phedata(char * fname, int noutc, int npeople, int interaction,
                  bool iscox)
@@ -16,13 +21,24 @@ void phedata::set_is_interaction_excluded(bool int_exl)
     is_interaction_excluded = int_exl;
 }
 
+
+/**
+ * Read phenotype data from file.
+ *
+ * @param fname Name of the file containing phenotype data
+ * @param noutc Number of outcomes/phenotypes
+ * @param npeople Number of people
+ * @param interaction Column specifying which phenotype is selected to
+ * interact with the SNP (default: 0, i.e. no interaction)
+ * @param iscox Are we running a Cox PH regression?
+ */
 void phedata::setphedata(char * fname, int noutc, int npeople, int interaction,
                          bool iscox)
 {
-    static const unsigned int BFS = 1000;
+    static const unsigned int BFS = 1048576;
     std::ifstream myfile(fname);
-    char line[BFS];
-    char tmp[100];
+    char *line = new char[BFS];
+    char *tmp  = new char[BFS];
     noutcomes = noutc;
     is_interaction_excluded = false;
 
@@ -199,8 +215,6 @@ void phedata::setphedata(char * fname, int noutc, int npeople, int interaction,
         infile >> tmp;
     }
 
-    //TODO: remove this unused variable if there is not a reason to keep it
-    //int k = 0;
     int m = 0;
     for (int i = 0; i < npeople; i++)
         if (allmeasured[i] == 1)
@@ -225,8 +239,12 @@ void phedata::setphedata(char * fname, int noutc, int npeople, int interaction,
                 infile >> tmp;
         }
     infile.close();
+
+    delete[] line;
+    delete[] tmp;
 }
 
+
 phedata::~phedata()
 {
     // delete X;
diff --git a/src/phedata.h b/src/phedata.h
index 16312d7..c35aa73 100644
--- a/src/phedata.h
+++ b/src/phedata.h
@@ -17,7 +17,7 @@
 #endif
 
 class phedata {
-public:
+ public:
     phedata()
     {
         is_interaction_excluded = 0;
diff --git a/src/probabel.pl b/src/probabel
old mode 100755
new mode 100644
similarity index 90%
rename from src/probabel.pl
rename to src/probabel
index 67bcbac..29002d8
--- a/src/probabel.pl
+++ b/src/probabel
@@ -1,13 +1,23 @@
 #! /usr/bin/perl -W
 #==========================================================================
 #
-#           Filename:  probabel.pl
+#           Filename:  probabel
 #
 #        Description: Handy perl wrapper for ProbABEL functions
 #
 #==========================================================================
 use strict;
 
+## Add warning message about future removal of the pl extension
+use File::Basename;
+my $name = basename($0);
+if ($name eq 'probabel.pl') {
+    print "WARNING: You are running this script as 'probabel.pl'. " .
+        "The correct name of this script is 'probabel', please update " .
+        "pipelines accordingly. In a future release the use of" .
+        "'probabel.pl' will be deprecated.\n\n";
+}
+
 #==========================================================================
 # Set variables
 my $version="PROBABEL_VERSION";
@@ -67,7 +77,7 @@ close(CFG);
 # Print usage info if arguments are not correct
 if(@ARGV<6 || $ARGV[0] eq "--help" || $ARGV[0] eq "-h") {
     print "Usage:
-        probabel.pl chrom-start chrom-end method cohort <--allmodels OR --additive> trait <other available options of ProbABEL functions>\n";
+        probabel chrom-start chrom-end method cohort <--allmodels OR --additive> trait <other available options of ProbABEL functions>\n";
     print "\n	* chrom-start - the first chromosome number, chrom-end - the last one; X or Y have to be run separately (specify them twice, once as chrom-start and once as chrom-end)";
     print "\n	* method can be ";
     foreach my $me(@method) {print "\"".$me."\", "};
@@ -78,12 +88,12 @@ if(@ARGV<6 || $ARGV[0] eq "--help" || $ARGV[0] eq "-h") {
         print "\"".$coh."\", "
     };
     print "\n	* example:
-          probabel.pl 1 22 linear \"ERF\" --additive filename
+          probabel 1 22 linear \"ERF\" --additive filename
           (filename has to be saved as filename.PHE)\n\n";
 
     if(@ARGV == 1 && ($ARGV[0] eq "--help" || $ARGV[0] eq "-h")) {
         print "\nDetails:\n";
-        print " The probabel.pl script is used for analysis of imputed data. First you have to create a file with the phenotype values that you are going to use. The first column contains ids in special order, the second one contains the trait which you are going	analyze, the others contain covariates.  For example:
+        print " The probabel script is used for analysis of imputed data. First you have to create a file with the phenotype values that you are going to use. The first column contains ids in special order, the second one contains the trait which you are going	analyze, the others contain covariates.  For example:
 
         id         phen1 covariate1  covariate2
         1_2094  0     334         0
@@ -100,15 +110,16 @@ if(@ARGV<6 || $ARGV[0] eq "--help" || $ARGV[0] eq "-h") {
         Then save it to folder where you are doing the analysis. The name of the file must be name_of_file.PHE, where name_of_file is any name.
 
         Then run the following on the command line:
-          probabel.pl 1 22 \"method\" \"cohort\" --model name_of_file
+          probabel 1 22 \"method\" \"cohort\" --model name_of_file
         Change \"method\", \"cohort\" and --model to appropriate values\n";
         print "\n	Version: $version";
-        print "\n\n	Authors: Lennart Karssen   - l.karssen\@erasmusmc.nl,
+        print "\n\n	Authors: Lennart Karssen   - lennart\@karssen.org,
+                 Maarten Kooyman - m.kooijman\@erasmusmc.nl,
                  Maksim Struchalin - m.struchalin\@erasmusmc.nl,
                  Yurii Aulchenko   - yurii.aulchenko\@gmail.com.\n\n";
     }
     else {
-        print "Type probabel.pl --help for more details.\n";
+        print "Type probabel --help for more details.\n";
     }
     exit;
 }
diff --git a/src/reg1.cpp b/src/reg1.cpp
index 1217787..a7062ac 100644
--- a/src/reg1.cpp
+++ b/src/reg1.cpp
@@ -13,7 +13,7 @@ mematrix<double> apply_model(mematrix<double>& X, int model, int interaction,
 // model 3 = recessive 1 df
 // model 4 = over-dominant 1 df
 {
-    if(nullmodel)
+    if (nullmodel)
     {
         // No need to apply any genotypic model when calculating the
         // null model
@@ -39,7 +39,7 @@ mematrix<double> apply_model(mematrix<double>& X, int model, int interaction,
                 {
                     if (iscox)
                     {
-                        //Maksim: interaction with SNP;;
+                        // Maksim: interaction with SNP;;
                         nX[i * nX.ncol + c1] = X[i * X.ncol + csnp_p1]
                                 * X[i * X.ncol + interaction - 1];
                         nX[i * nX.ncol + c2] = X[i * X.ncol + csnp_p2]
@@ -47,7 +47,7 @@ mematrix<double> apply_model(mematrix<double>& X, int model, int interaction,
                     }
                     else
                     {
-                        //Maksim: interaction with SNP;;
+                        // Maksim: interaction with SNP;;
                         nX[i * nX.ncol + c1] = X[i * X.ncol + csnp_p1]
                                 * X[i * X.ncol + interaction];
                         nX[i * nX.ncol + c2] = X[i * X.ncol + csnp_p2]
@@ -59,33 +59,35 @@ mematrix<double> apply_model(mematrix<double>& X, int model, int interaction,
                 {
                     mematrix<double> nX_without_interact_phe;
                     nX_without_interact_phe.reinit(nX.nrow, nX.ncol - 1);
-                    int col_new;
+
                     for (int row = 0; row < nX.nrow; row++)
                     {
-                        //Han Chen
-                        col_new = -1;
+                        // Han Chen
+                        int col_new = -1;
                         for (int col = 0; col < nX.ncol; col++)
                         {
                             if (col != interaction && !iscox)
                             {
                                 col_new++;
                                 nX_without_interact_phe[row
-                                        * nX_without_interact_phe.ncol + col_new] =
-                                        nX[row * nX.ncol + col];
+                                        * nX_without_interact_phe.ncol
+                                        + col_new] =
+                                    nX[row * nX.ncol + col];
                             }
                             if (col != interaction - 1 && iscox)
                             {
                                 col_new++;
                                 nX_without_interact_phe[row
-                                        * nX_without_interact_phe.ncol + col_new] =
-                                        nX[row * nX.ncol + col];
+                                        * nX_without_interact_phe.ncol
+                                        + col_new] =
+                                    nX[row * nX.ncol + col];
                             }
-                        } //interaction_only, model==0, ngpreds==2
-                          //Oct 26, 2009
+                        } // interaction_only, model==0, ngpreds==2
+                          // Oct 26, 2009
                     }
                     return nX_without_interact_phe;
-                } //end of is_interaction_excluded
-                  //________________________
+                }  // end of is_interaction_excluded
+                   //________________________
                 return (nX);
             }
             if (ngpreds == 1)
@@ -97,28 +99,30 @@ mematrix<double> apply_model(mematrix<double>& X, int model, int interaction,
                 for (int i = 0; i < X.nrow; i++)
                     for (int j = 0; j < (X.ncol); j++)
                         nX[i * nX.ncol + j] = X[i * X.ncol + j];
+
                 for (int i = 0; i < nX.nrow; i++)
                 {
                     if (iscox)
                     {
+                        // Maksim: interaction with SNP;;
                         nX[i * nX.ncol + c1] = X[i * X.ncol + csnp_p1]
-                                * X[i * X.ncol + interaction - 1]; //Maksim: interaction with SNP;;
+                                * X[i * X.ncol + interaction - 1];
                     }
                     else
                     {
+                         // Maksim: interaction with SNP;;
                         nX[i * nX.ncol + c1] = X[i * X.ncol + csnp_p1]
-                                * X[i * X.ncol + interaction]; //Maksim: interaction with SNP;;
+                                * X[i * X.ncol + interaction];
                     }
                 }
                 //________________________
                 if (is_interaction_excluded)
                 {
-                    int col_new;
                     mematrix<double> nX_without_interact_phe;
                     nX_without_interact_phe.reinit(nX.nrow, nX.ncol - 1);
                     for (int row = 0; row < nX.nrow; row++)
                     {
-                        col_new = -1;
+                        int col_new = -1;
                         for (int col = 0; col < nX.ncol; col++)
                         {
                             if (col != interaction && !iscox)
@@ -140,7 +144,7 @@ mematrix<double> apply_model(mematrix<double>& X, int model, int interaction,
                         }
                     }
                     return nX_without_interact_phe;
-                } //end of is_interaction_excluded
+                }  // end of is_interaction_excluded
                   //________________________
                 return (nX);
             }
@@ -161,26 +165,29 @@ mematrix<double> apply_model(mematrix<double>& X, int model, int interaction,
         nX.reinit(X.nrow, (X.ncol - 1));
     }
 
-    int c1 = X.ncol - 2; // column with Prob(A1A2)
-    int c2 = X.ncol - 1; // column with Prob(A1A1). Note the order is swapped cf the file!
+    // column with Prob(A1A2)
+    int c1 = X.ncol - 2;
+    // column with Prob(A1A1). Note the order is swapped cf the file!
+    int c2 = X.ncol - 1;
+
     for (int i = 0; i < X.nrow; i++)
         for (int j = 0; j < (X.ncol - 2); j++)
             nX[i * nX.ncol + j] = X[i * X.ncol + j];
 
     for (int i = 0; i < nX.nrow; i++)
     {
-        if (model == 1) // additive
+        if (model == 1)  // additive
             nX[i * nX.ncol + c1] = X[i * X.ncol + c1] + 2. * X[i * X.ncol + c2];
-        else if (model == 2) //dominant
+        else if (model == 2)  //dominant
             nX[i * nX.ncol + c1] = X[i * X.ncol + c1] + X[i * X.ncol + c2];
-        else if (model == 3) // recessive
+        else if (model == 3)  // recessive
             nX[i * nX.ncol + c1] = X[i * X.ncol + c2];
-        else if (model == 4) // over-dominant
+        else if (model == 4)  // over-dominant
             nX[i * nX.ncol + c1] = X[i * X.ncol + c1];
 
         if (interaction != 0)
             nX[i * nX.ncol + c2] = X[i * nX.ncol + interaction]
-                    * nX[i * nX.ncol + c1]; //Maksim: interaction with SNP
+                    * nX[i * nX.ncol + c1];  // Maksim: interaction with SNP
     }
 
     //Han Chen
@@ -188,10 +195,10 @@ mematrix<double> apply_model(mematrix<double>& X, int model, int interaction,
     {
         mematrix<double> nX_without_interact_phe;
         nX_without_interact_phe.reinit(nX.nrow, nX.ncol - 1);
-        int col_new;
+
         for (int row = 0; row < nX.nrow; row++)
         {
-            col_new = -1;
+            int col_new = -1;
             for (int col = 0; col < nX.ncol; col++)
             {
                 if (col != interaction && !iscox)
@@ -209,10 +216,11 @@ mematrix<double> apply_model(mematrix<double>& X, int model, int interaction,
             }
         }
         return nX_without_interact_phe;
-    } //interaction_only, model!=0, ngpreds==2
+    }  // interaction_only, model!=0, ngpreds==2
     return nX;
 }
 
+
 mematrix<double> t_apply_model(mematrix<double>& X, int model, int interaction,
                                int ngpreds, bool iscox, int nullmodel)
 {
@@ -223,6 +231,7 @@ mematrix<double> t_apply_model(mematrix<double>& X, int model, int interaction,
     return out;
 }
 
+
 linear_reg::linear_reg(regdata& rdatain)
 {
     regdata rdata = rdatain.get_unmasked_data();
@@ -243,6 +252,7 @@ linear_reg::linear_reg(regdata& rdatain)
     chi2_score = -1.;
 }
 
+
 void base_reg::base_score(mematrix<double>& resid, regdata& rdata, int verbose,
                           double tol_chol, int model, int interaction,
                           int ngpreds, const masked_matrix& invvarmatrix,
@@ -289,6 +299,7 @@ void base_reg::base_score(mematrix<double>& resid, regdata& rdata, int verbose,
     chi2_score = chi2[0];
 }
 
+
 void linear_reg::estimate(regdata& rdatain, int verbose, double tol_chol,
                           int model, int interaction, int ngpreds,
                           masked_matrix& invvarmatrixin, int robust,
@@ -374,9 +385,9 @@ void linear_reg::estimate(regdata& rdatain, int verbose, double tol_chol,
         printf("beta[0] = %e\n", betaeigen.data()[0]);
         printf("----\n");
 //        (beta).print();
-        double relative_error = (tXXeigen * betaeigen - tXYeigen).norm() / tXYeigen.norm(); // norm() is L2 norm
+        double relative_error = (tXXeigen * betaeigen - tXYeigen).norm() /
+            tXYeigen.norm(); // norm() is L2 norm
         cout << "The relative error is:\n" << relative_error << endl;
-
     }
 
     // This one is needed later on in this function
@@ -423,14 +434,14 @@ void linear_reg::estimate(regdata& rdatain, int verbose, double tol_chol,
     sigma2_matrix = sigma2_matrix - sigma2_matrix1;
     //        std::cout << "sigma2_matrix\n";
     //        sigma2_matrix.print();
-    static double val;
+
     //  std::cout << "sigma2_matrix.nrow=" << sigma2_matrix.nrow
     //            << "sigma2_matrix.ncol" << sigma2_matrix.ncol
     //            <<"\n";
 
     for (int i = 0; i < sigma2_matrix.nrow; i++)
     {
-        val = sigma2_matrix.get(i, 0);
+        double val = sigma2_matrix.get(i, 0);
         //            std::cout << "val = " << val << "\n";
         sigma2 += val * val;
         //            std::cout << "sigma2+= " << sigma2 << "\n";
@@ -569,6 +580,7 @@ void linear_reg::estimate(regdata& rdatain, int verbose, double tol_chol,
     }
 }
 
+
 void linear_reg::score(mematrix<double>& resid, regdata& rdatain, int verbose,
                        double tol_chol, int model, int interaction, int ngpreds,
                        const masked_matrix& invvarmatrix, int nullmodel)
@@ -578,6 +590,7 @@ void linear_reg::score(mematrix<double>& resid, regdata& rdatain, int verbose,
                invvarmatrix, nullmodel = 0);
 }
 
+
 logistic_reg::logistic_reg(regdata& rdatain)
 {
     regdata rdata = rdatain.get_unmasked_data();
@@ -597,6 +610,7 @@ logistic_reg::logistic_reg(regdata& rdatain)
     chi2_score = -1.;
 }
 
+
 void logistic_reg::estimate(regdata& rdatain, int verbose, int maxiter,
                             double eps, double tol_chol, int model,
                             int interaction, int ngpreds,
@@ -681,7 +695,7 @@ void logistic_reg::estimate(regdata& rdatain, int verbose, int maxiter,
         {
             double emu = eMu.get(i, 0);
             double value = emu;
-            double zval = 0.;
+            double zval;
             value = exp(value) / (1. + exp(value));
             residuals[i] = (rdata.Y).get(i, 0) - value;
             eMu.put(value, i, 0);
@@ -749,9 +763,11 @@ void logistic_reg::estimate(regdata& rdatain, int verbose, int maxiter,
 
         delta = fabs(1. - (prevlik / loglik));
         niter++;
-    }
+    }  // END while (niter < maxiter && delta > eps)
+
     sigma2 = 0.;
     mematrix<double> robust_sigma2(X.ncol, X.ncol);
+
     if (robust)
     {
         mematrix<double> XbyR = X;
@@ -826,6 +842,7 @@ void logistic_reg::estimate(regdata& rdatain, int verbose, int maxiter,
     // exit(1);
 }
 
+
 void logistic_reg::score(mematrix<double>& resid, regdata& rdata, int verbose,
                          double tol_chol, int model, int interaction,
                          int ngpreds, masked_matrix& invvarmatrix,
diff --git a/src/reg1.h b/src/reg1.h
index f4bf490..02b646e 100644
--- a/src/reg1.h
+++ b/src/reg1.h
@@ -38,7 +38,7 @@ mematrix<double> t_apply_model(mematrix<double>& X, int model, int interaction,
         int ngpreds, bool iscox, int nullmodel = 0);
 
 class base_reg {
-public:
+ public:
     mematrix<double> beta;
     mematrix<double> sebeta;
     //Han Chen
@@ -55,7 +55,7 @@ public:
 };
 
 class linear_reg: public base_reg {
-public:
+ public:
     linear_reg(regdata& rdatain);
     ~linear_reg()
     {
@@ -75,7 +75,7 @@ public:
 };
 
 class logistic_reg: public base_reg {
-public:
+ public:
     int niter;
 
     logistic_reg(regdata& rdatain);
diff --git a/src/regdata.cpp b/src/regdata.cpp
index 19ec576..d09682c 100644
--- a/src/regdata.cpp
+++ b/src/regdata.cpp
@@ -25,6 +25,8 @@ regdata::regdata()
     noutcomes               = 0;
     is_interaction_excluded = false;
     masked_data             = NULL;
+    gcount                  = 0;
+    freq                    = 0;
 }
 
 
@@ -34,6 +36,8 @@ regdata::regdata(const regdata &obj) : X(obj.X), Y(obj.Y)
     ncov = obj.ncov;
     ngpreds = obj.ngpreds;
     noutcomes = obj.noutcomes;
+    gcount = obj.gcount;
+    freq = obj.freq;
     is_interaction_excluded = obj.is_interaction_excluded;
     masked_data = new unsigned short int[nids];
 
@@ -43,11 +47,15 @@ regdata::regdata(const regdata &obj) : X(obj.X), Y(obj.Y)
     }
 }
 
-regdata::regdata(phedata &phed, gendata &gend, int snpnum,
-                 bool ext_is_interaction_excluded)
+
+regdata::regdata(phedata &phed, gendata &gend, const int snpnum,
+                 const bool ext_is_interaction_excluded)
 {
-    nids = gend.nids;
+    freq        = 0;
+    gcount      = 0;
+    nids        = gend.nids;
     masked_data = new unsigned short int[nids];
+
     for (int i = 0; i < nids; i++)
     {
         masked_data[i] = 0;
@@ -82,10 +90,13 @@ regdata::regdata(phedata &phed, gendata &gend, int snpnum,
     if (snpnum > 0)
         for (int j = 0; j < ngpreds; j++)
         {
-            double snpdata[nids];
+            double *snpdata = new double[nids];
             gend.get_var(snpnum * ngpreds + j, snpdata);
             for (int i = 0; i < nids; i++)
+            {
                 X.put(snpdata[i], i, (ncov - ngpreds + 1 + j));
+            }
+            delete[] snpdata;
         }
         // for (int i=0;i<nids;i++)
         //     for (int j=0;j<ngpreds;j++)
@@ -93,43 +104,65 @@ regdata::regdata(phedata &phed, gendata &gend, int snpnum,
     is_interaction_excluded = ext_is_interaction_excluded;
 }
 
-void regdata::update_snp(gendata &gend, int snpnum)
+
+void regdata::update_snp(gendata *gend, const int snpnum)
 {
-    // Add genotypic data (dosage or probabilities) to the design
-    // matrix X.
+    // Reset counter for frequency since it is a new SNP
+    gcount = 0;
+    freq = 0.0;
 
+    // Add genotypic data (dosage or probabilities) to the design
+    // matrix X
     for (int j = 0; j < ngpreds; j++)
     {
-        double snpdata[nids];
+        double *snpdata = new double[nids];
         for (int i = 0; i < nids; i++)
         {
             masked_data[i] = 0;
         }
 
-        gend.get_var(snpnum * ngpreds + j, snpdata);
+        gend->get_var(snpnum * ngpreds + j, snpdata);
 
-        for (int i = 0; i < nids; i++)
-        {
+        for (int i = 0; i < nids; i++) {
             X.put(snpdata[i], i, (ncov - j));
-            if (isnan(snpdata[i]))
-            {
+            if (std::isnan(snpdata[i])) {
                 masked_data[i] = 1;
-            }
-        }
-    }
+                // SNP not masked
+            } else {
+                // check for first predictor
+                if (j == 0) {
+                    gcount++;
+                    if (ngpreds == 1) {
+                        freq += snpdata[i] * 0.5;
+                    } else if (ngpreds == 2) {
+                        freq += snpdata[i];
+                    }
+                } else if (j == 1) {
+                    // Add second genotype in two predicor data form
+                    freq += snpdata[i] * 0.5;
+                }
+            }  // End std::isnan(snpdata[i]) snp
+        }  // End i for loop
+
+        delete[] snpdata;
+    }  // End ngpreds loop
+
+    freq /= static_cast<double>(gcount); // Allele frequency
 }
 
+
+/**
+ * update_snp() adds SNP information to the design matrix. This
+ * function allows you to strip that information from X again.
+ * This is used for example when calculating the null model.
+ */
 void regdata::remove_snp_from_X()
 {
-    // update_snp() adds SNP information to the design matrix. This
-    // function allows you to strip that information from X again.
-    // This is used for example when calculating the null model.
-
-    if(ngpreds == 1)
+    if (ngpreds == 1)
     {
         X.delete_column(X.ncol -1);
     }
-    else if(ngpreds == 2)
+    else if (ngpreds == 2)
     {
         X.delete_column(X.ncol -1);
         X.delete_column(X.ncol -1);
@@ -141,16 +174,18 @@ void regdata::remove_snp_from_X()
     }
 }
 
+
 regdata::~regdata()
 {
     delete[] regdata::masked_data;
-    //      delete X;
-    //      delete Y;
+    // delete X;
+    // delete Y;
 }
 
+
 regdata regdata::get_unmasked_data()
 {
-    regdata to; // = regdata(*this);
+    regdata to;  // = regdata(*this);
     int nmeasured = 0;
     for (int i = 0; i < nids; i++)
     {
@@ -186,7 +221,7 @@ regdata regdata::get_unmasked_data()
         }
     }
 
-    //delete [] to.masked_data;
+    // delete [] to.masked_data;
     to.masked_data = new unsigned short int[to.nids];
     for (int i = 0; i < to.nids; i++)
     {
@@ -197,6 +232,7 @@ regdata regdata::get_unmasked_data()
     return (to);
 }
 
+
 mematrix<double> regdata::extract_genotypes(void)
 {
     mematrix<double> out;
diff --git a/src/regdata.h b/src/regdata.h
index a6e53da..e124d4c 100644
--- a/src/regdata.h
+++ b/src/regdata.h
@@ -19,26 +19,28 @@
 #include "phedata.h"
 
 class regdata {
-public:
+ public:
     int nids;
     int ncov;
     int ngpreds;
     int noutcomes;
     bool is_interaction_excluded;
     unsigned short int * masked_data;
+    unsigned int gcount;
+    double freq;
     mematrix<double> X;
     mematrix<double> Y;
     regdata();
     regdata(const regdata &obj);
-    regdata(phedata &phed, gendata &gend, int snpnum,
-            bool ext_is_interaction_excluded);
+    regdata(phedata &phed, gendata &gend, const int snpnum,
+            const bool ext_is_interaction_excluded);
     mematrix<double> extract_genotypes();
-    void update_snp(gendata &gend, int snpnum);
+    void update_snp(gendata *gend, const int snpnum);
     void remove_snp_from_X();
     regdata get_unmasked_data();
     ~regdata();
 
-private:
+ private:
 };
 
 #endif /* REGDATA_H_ */
diff --git a/src/usage.cpp b/src/usage.cpp
index dcb4ee0..ce13f1a 100644
--- a/src/usage.cpp
+++ b/src/usage.cpp
@@ -13,7 +13,9 @@
 #endif
 
 
-using namespace std;
+using std::cout;
+using std::endl;
+
 
 void print_usage(char * program_name, int exit_code)
 {
@@ -30,8 +32,9 @@ void print_usage(char * program_name, int exit_code)
     cout << "\t --out     : [optional] output file name "
          << "(default is regression.out.txt)"
          << endl;
-    cout << "\t --skipd   : [optional] how many columns to skip in the predictor"
-         << "\n\t             (dose/prob) file (default 2)"
+    cout << "\t --skipd   : [optional] how many columns to skip in the "
+         << "predictor\n"
+         << "\t             (dose/prob) file (default 2)"
          << endl;
 #if COXPH
     cout << "\t --ntraits : [optional] how many traits are analysed (default 2)"
@@ -40,15 +43,16 @@ void print_usage(char * program_name, int exit_code)
     cout << "\t --ntraits : [optional] how many traits are analysed (default 1)"
          << endl;
 #endif
-    cout << "\t --ngpreds : [optional] how many predictor columns per marker"
-         <<"\n\t              (default 1 = MLDOSE; else use 2 for MLPROB)"
+    cout << "\t --ngpreds : [optional] how many predictor columns per marker\n"
+         <<"\t              (default 1 = MLDOSE; else use 2 for MLPROB)"
          << endl;
     cout << "\t --separat : [optional] character to separate fields "
          << "(default is space)"
          << endl;
     cout << "\t --score   : use score test" << endl;
     cout << "\t --no-head : do not report header line" << endl;
-    cout << "\t --allcov  : report estimates for all covariates (large outputs!)"
+    cout << "\t --allcov  : report estimates for all covariates "
+         << "(large outputs!)"
          << endl;
     cout << "\t --interaction: Which covariate to use for interaction with "
          << "SNP analysis (default is no interaction, 0)"
@@ -70,7 +74,7 @@ void print_usage(char * program_name, int exit_code)
 }
 
 
-void print_version(void){
+void print_version(void) {
     cout << PACKAGE
          << " v. " << PACKAGE_VERSION
          << "\n(C) Yurii Aulchenko, Lennart C. Karssen, Maksim Struchalin, "
diff --git a/test-driver b/test-driver
new file mode 100755
index 0000000..32bf39e
--- /dev/null
+++ b/test-driver
@@ -0,0 +1,127 @@
+#! /bin/sh
+# test-driver - basic testsuite driver script.
+
+scriptversion=2012-06-27.10; # UTC
+
+# Copyright (C) 2011-2013 Free Software Foundation, Inc.
+#
+# 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, 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, see <http://www.gnu.org/licenses/>.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# This file is maintained in Automake, please report
+# bugs to <bug-automake at gnu.org> or send patches to
+# <automake-patches at gnu.org>.
+
+# Make unconditional expansion of undefined variables an error.  This
+# helps a lot in preventing typo-related bugs.
+set -u
+
+usage_error ()
+{
+  echo "$0: $*" >&2
+  print_usage >&2
+  exit 2
+}
+
+print_usage ()
+{
+  cat <<END
+Usage:
+  test-driver --test-name=NAME --log-file=PATH --trs-file=PATH
+              [--expect-failure={yes|no}] [--color-tests={yes|no}]
+              [--enable-hard-errors={yes|no}] [--] TEST-SCRIPT
+The '--test-name', '--log-file' and '--trs-file' options are mandatory.
+END
+}
+
+# TODO: better error handling in option parsing (in particular, ensure
+# TODO: $log_file, $trs_file and $test_name are defined).
+test_name= # Used for reporting.
+log_file=  # Where to save the output of the test script.
+trs_file=  # Where to save the metadata of the test run.
+expect_failure=no
+color_tests=no
+enable_hard_errors=yes
+while test $# -gt 0; do
+  case $1 in
+  --help) print_usage; exit $?;;
+  --version) echo "test-driver $scriptversion"; exit $?;;
+  --test-name) test_name=$2; shift;;
+  --log-file) log_file=$2; shift;;
+  --trs-file) trs_file=$2; shift;;
+  --color-tests) color_tests=$2; shift;;
+  --expect-failure) expect_failure=$2; shift;;
+  --enable-hard-errors) enable_hard_errors=$2; shift;;
+  --) shift; break;;
+  -*) usage_error "invalid option: '$1'";;
+  esac
+  shift
+done
+
+if test $color_tests = yes; then
+  # Keep this in sync with 'lib/am/check.am:$(am__tty_colors)'.
+  red='' # Red.
+  grn='' # Green.
+  lgn='' # Light green.
+  blu='' # Blue.
+  mgn='' # Magenta.
+  std=''     # No color.
+else
+  red= grn= lgn= blu= mgn= std=
+fi
+
+do_exit='rm -f $log_file $trs_file; (exit $st); exit $st'
+trap "st=129; $do_exit" 1
+trap "st=130; $do_exit" 2
+trap "st=141; $do_exit" 13
+trap "st=143; $do_exit" 15
+
+# Test script is run here.
+"$@" >$log_file 2>&1
+estatus=$?
+if test $enable_hard_errors = no && test $estatus -eq 99; then
+  estatus=1
+fi
+
+case $estatus:$expect_failure in
+  0:yes) col=$red res=XPASS recheck=yes gcopy=yes;;
+  0:*)   col=$grn res=PASS  recheck=no  gcopy=no;;
+  77:*)  col=$blu res=SKIP  recheck=no  gcopy=yes;;
+  99:*)  col=$mgn res=ERROR recheck=yes gcopy=yes;;
+  *:yes) col=$lgn res=XFAIL recheck=no  gcopy=yes;;
+  *:*)   col=$red res=FAIL  recheck=yes gcopy=yes;;
+esac
+
+# Report outcome to console.
+echo "${col}${res}${std}: $test_name"
+
+# Register the test result, and other relevant metadata.
+echo ":test-result: $res" > $trs_file
+echo ":global-test-result: $res" >> $trs_file
+echo ":recheck: $recheck" >> $trs_file
+echo ":copy-in-global-log: $gcopy" >> $trs_file
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
+# End:

-- 
Alioth's /git/debian-med/git-commit-notice on /srv/git.debian.org/git/debian-med/probabel.git



More information about the debian-med-commit mailing list