diff --git a/.gitignore b/.gitignore
index c3622c5460d8d401119f1067cd3e364eb6f22786..6208aede5114ca1007ed37ca018466eb50b37e60 100644
--- a/.gitignore
+++ b/.gitignore
@@ -58,7 +58,7 @@ tags
 *.i*86
 *.x86_64
 *.hex
-moose
+/moose
 
 CMakeCache.txt
 CMakeFiles
@@ -132,3 +132,4 @@ Session.vim
 *~
 *.clean
 
+/VERSION
diff --git a/.travis/travis_build_linux.sh b/.travis/travis_build_linux.sh
index 3a2ebbfa48f5022d52eb5af6bec4e001ce91025d..b993e109f7ec82154791414896c6b02e5b7c645c 100755
--- a/.travis/travis_build_linux.sh
+++ b/.travis/travis_build_linux.sh
@@ -20,22 +20,20 @@
 set -o nounset                              # Treat unset variables as an error
 set -e
 
+PYTHON2="/usr/bin/python2"
+PYTHON3="/usr/bin/python3"
 #MAKEFLAGS="-j 4"
 
-PYTHON2="/usr/bin/python2"
 # Bug: `which python` returns /opt/bin/python* etc on travis. For which numpy
 # many not be available. Therefore, it is neccessary to use fixed path for
 # python executable.
-PYTHON3="/usr/bin/python3"
 
 (
     # Old makefile based flow.
     $PYTHON2 -m compileall -q .
     if type $PYTHON3 > /dev/null; then $PYTHON3 -m compileall -q . ; fi
-    ## DEPRECATED: No longer testing make file.
-
-    ## Traditional make.
-    #make 
+    # Traditional make.
+    make 
     ## CMAKE based flow
     mkdir -p _GSL_BUILD && cd _GSL_BUILD && \
         cmake -DDEBUG=ON -DPYTHON_EXECUTABLE="$PYTHON2" ..
diff --git a/.travis/travis_prepare_linux.sh b/.travis/travis_prepare_linux.sh
index d016aa5baab4dcf5226b6c7209c0625a2b12d408..ce068f9bf2fc2497ef2ca738a468e1acffb46541 100755
--- a/.travis/travis_prepare_linux.sh
+++ b/.travis/travis_prepare_linux.sh
@@ -29,4 +29,3 @@ apt-get install -qq libboost-all-dev
 apt-get install -qq libgsl0-dev
 apt-get install -qq python-pip python3-pip
 apt-get install -qq libgraphviz-dev
-pip3 install numpy
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4f3667a5f0bbfea6e53267b1c4bce1ca85011f40..aa1c243d0ffd727d1926ec67bd07d9d31a38a087 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -11,11 +11,9 @@ endif(COMMAND cmake_policy)
 
 project(MOOSE)
 
-set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules")
 include(CheckCXXCompiler.cmake)
 include(CheckIncludeFileCXX)
 include(FindPkgConfig)
-include(GetRevision)
 
 # If from command line, version info is not passed, use the git to generate a
 # version file. If GIT fails, use the previous known version.
@@ -29,14 +27,14 @@ if( (NOT MOOSE_VERSION) AND GIT_EXEC)
         OUTPUT_VARIABLE MOOSE_VERSION
         OUTPUT_STRIP_TRAILING_WHITESPACE
         )
-endif( )
-
-# Default to current date.
-if( (NOT MOOSE_VERSION)  )
-    NOW(TIMESTAMP)
-    set(MOOSE_VERSION "nightly-${TIMESTAMP}" )
+    message(STATUS "+ Writing ${MOOSE_VERSION} to ${VERSION_FILE}" )
+    file(WRITE ${VERSION_FILE} ${MOOSE_VERSION})
+elseif( (NOT MOOSE_VERSION) AND (NOT GIT_EXEC) )
+    message(STATUS "+ Reading ${VERSION_FILE}" )
+    file(READ ${VERSION_FILE} GIT_VERSION_OUTPUT )
 elseif(MOOSE_VERSION)
     message(STATUS "+ Using user specified VERSION = ${MOOSE_VERSION}" )
+    file(WRITE ${VERSION_FILE} ${MOOSE_VERSION})
 else()
     message(FATAL_ERROR "Could not determine MOOSE_VERSION" )
 endif( )
@@ -44,9 +42,6 @@ endif( )
 add_definitions( -DMOOSE_VERSION="${MOOSE_VERSION}")
 message( STATUS "MOOSE Version ${MOOSE_VERSION}" )
 
-# Write VERSION to a file VERSION so that setup.py can use it.
-file(WRITE ${VERSION_FILE} ${MOOSE_VERSION} )
-
 # This snippet is from LLVM project.
 # Sanity check our source directory to make sure that we are not trying to
 # generate an in-tree build (unless on MSVC_IDE, where it is ok), and to make
@@ -103,6 +98,9 @@ option(WITH_MPI  "Enable Openmpi support" OFF)
 option(WITH_BOOST "Use boost library instead of GSL" OFF)
 option(WITH_GSL  "Use gsl-library. Alternative is WITH_BOOST" ON)
 
+################################# CMKAE MACROS #################################
+
+set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules")
 
 ############################ BUILD CONFIGURATION #################################
 
@@ -307,9 +305,15 @@ if(WITH_MPI)
     endif()
 endif(WITH_MPI)
 
-# Always use private version of muparser. We have some custom edits.
-add_subdirectory(external/muparser)
-list(APPEND MOOSE_LIBRARIES muparser)
+pkg_check_modules(MUPARSER muparser)
+if(MUPARSER_FOUND)
+    message(STATUS "Using system muparser ${MUPARSER_VERSION}")
+    list(APPEND SYSTEM_SHARED_LIBS ${MUPARSER_LIBRARIES})
+else()
+    message(STATUS "Using private muparser")
+    add_subdirectory(external/muparser)
+    list(APPEND MOOSE_LIBRARIES muparser)
+endif()
 
 # Add subdirectroeis
 add_subdirectory(basecode)
diff --git a/CheckCXXCompiler.cmake b/CheckCXXCompiler.cmake
index a87acde8d8136fa8d7fc1e09369cce64b3f65cdb..15a4d730b98679a10bf42e9c5f8df04d6de3fd58 100644
--- a/CheckCXXCompiler.cmake
+++ b/CheckCXXCompiler.cmake
@@ -37,7 +37,7 @@ if(COMPILER_SUPPORTS_CXX11)
 elseif(COMPILER_SUPPORTS_CXX0X)
     message(STATUS "Your compiler supports c++0x features. Enabling it")
     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
-    add_definitions( -DENABLE_CPP11 )
+    add_definitions( -DENABLE_CXX11 )
     add_definitions( -DBOOST_NO_CXX11_SCOPED_ENUMS -DBOOST_NO_SCOPED_ENUMS )
     if(APPLE)
         set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++" )
diff --git a/basecode/SparseMatrix.h b/basecode/SparseMatrix.h
index ecbc71eafa78149c8e67e09de69f5a7ceba6a34e..88d2681c65fd06f8a5f5479d348606f247038905 100644
--- a/basecode/SparseMatrix.h
+++ b/basecode/SparseMatrix.h
@@ -423,19 +423,6 @@ public:
                           colIndexArg.begin(), colIndexArg.end() );
         rowStart_[rowNum + 1] = N_.size();
     }
-	/// Here we expose the sparse matrix for MOOSE use.
-	const vector< T >& matrixEntry() const
-	{
-		return N_;
-	}
-	const vector< unsigned int >& colIndex() const
-	{
-		return colIndex_;
-	}
-	const vector< unsigned int >& rowStart() const
-	{
-		return rowStart_;
-	}
     //////////////////////////////////////////////////////////////////
     // Operations on entire matrix.
     //////////////////////////////////////////////////////////////////
@@ -582,7 +569,7 @@ public:
 
     void tripletFill( const vector< unsigned int >& row,
                       const vector< unsigned int >& col,
-                      const vector< T >& z, bool retainSize = false )
+                      const vector< T >& z )
     {
         unsigned int len = row.size();
         if ( len > col.size() ) len = col.size();
@@ -591,20 +578,16 @@ public:
         for ( unsigned int i = 0; i < len; ++i )
             trip[i]= Triplet< T >(z[i], row[i], col[i] );
         sort( trip.begin(), trip.end(), Triplet< T >::cmp );
-    	unsigned int nr = nrows_;
-    	unsigned int nc = ncolumns_;
-		if ( !retainSize ) {
-    		nr = trip.back().b_ + 1;
-    		nc = 0;
-    		for ( typename vector< Triplet< T > >::iterator i =
-                trip.begin(); i != trip.end(); ++i )
-    		{
-        		if ( nc < i->c_ )
-            		nc = i->c_;
-    		}
-    		nc++;
-		}
-   		setSize( nr, nc );
+        unsigned int nr = trip.back().b_ + 1;
+        unsigned int nc = 0;
+        for ( typename vector< Triplet< T > >::iterator i =
+                    trip.begin(); i != trip.end(); ++i )
+        {
+            if ( nc < i->c_ )
+                nc = i->c_;
+        }
+        nc++;
+        setSize( nr, nc );
 
         vector< unsigned int > colIndex( nc );
         vector< T > entry( nc );
diff --git a/basecode/global.cpp b/basecode/global.cpp
index b54fc979131dce4103a106281a28ab23ef0d7375..ec5a523e78e911755e12565e854af321b5172ada 100644
--- a/basecode/global.cpp
+++ b/basecode/global.cpp
@@ -87,7 +87,7 @@ namespace moose {
      *
      * @param x 
      */
-    void mtseed( int x )
+    void mtseed( unsigned int x )
     {
         moose::__rng_seed__ = x;
         moose::rng.setSeed( x );
diff --git a/basecode/global.h b/basecode/global.h
index 40b2dba5758c8c848e49ecca9a7b92257b4c9d9f..9b06b2820245f1ef4d8fd0639be1b3e6f42a5a13 100644
--- a/basecode/global.h
+++ b/basecode/global.h
@@ -109,7 +109,7 @@ namespace moose
      *
      * @param seed
      */
-    void mtseed( int seed );
+    void mtseed( unsigned int seed );
 
     /**
      * @brief Generate a random double between 0 and 1
diff --git a/biophysics/CaConc.cpp b/biophysics/CaConc.cpp
index 2ecf503491e562555271424772371699b1025ea9..40f3bf2b7be1002cb77cfecb90f682cebfde56c7 100644
--- a/biophysics/CaConc.cpp
+++ b/biophysics/CaConc.cpp
@@ -17,13 +17,13 @@ const Cinfo* CaConc::initCinfo()
 {
 	static string doc[] =
 	{
-		"Name", "CaConc",
-		"Author", "Upinder S. Bhalla, 2014, NCBS",
-		"Description", "CaConc: Calcium concentration pool. Takes current from a "
-				"channel and keeps track of calcium buildup and depletion by a "
-				"single exponential process. ",
+		"Name", "CaConc \n",
+		"Author", "Upinder S. Bhalla, 2014, NCBS \n",
+		"Description", "CaConc: Calcium concentration pool. Takes current from a \n"
+				"channel and keeps track of calcium buildup and depletion by a \n"
+				"single exponential process. \n",
 	};
-        
+
         static Dinfo< CaConc > dinfo;
 
 	static Cinfo CaConcCinfo(
@@ -177,16 +177,16 @@ void testCaConc()
 	cc.setB( 5.2e-6 / 1e-15 );
 	// Faraday constant = 96485.3415 s A / mol
 	// Use a 1 pA input current. This should give (0.5e-12/F) moles/sec
-	// influx, because Ca has valence of 2. 
+	// influx, because Ca has valence of 2.
 	// So we get 5.2e-18 moles/sec coming in.
 	// Our volume is 1e-15 m^3
 	// So our buildup should be at 5.2e-3 moles/m^3/sec = 5.2 uM/sec
 	double curr = 1e-12;
 	// This will settle when efflux = influx
 	// dC/dt = B*Ik - C/tau = 0.
-	// so Ca = CaBasal + tau * B * Ik = 
+	// so Ca = CaBasal + tau * B * Ik =
 	// 0.0001 + 0.1 * 5.2e-6 * 1e3 = 0.000626
-	
+
 	ProcInfo p;
 	p.dt = 0.001;
 	p.currTime = 0.0;
@@ -214,4 +214,4 @@ void testCaConc()
 	cout << "." << flush;
     */
 }
-#endif 
+#endif
diff --git a/biophysics/CaConcBase.cpp b/biophysics/CaConcBase.cpp
index c484b24827292cb1d2f8b031c066eb2c6562de87..f569cbaeb7651941e0fa53a7ad5d030514dcbca5 100644
--- a/biophysics/CaConcBase.cpp
+++ b/biophysics/CaConcBase.cpp
@@ -17,13 +17,13 @@
 ///////////////////////////////////////////////////////
 /*
  * This Finfo is used to send out Ca concentration to channels.
- * 
+ *
  * It is exposed here so that HSolve can also use it to send out
  * Ca concentration to the recipients.
  */
 // Static function.
 SrcFinfo1< double >* CaConcBase::concOut() {
-  static SrcFinfo1< double > concOut( "concOut", 
+  static SrcFinfo1< double > concOut( "concOut",
 				      "Concentration of Ca in pool" );
   return &concOut;
 }
@@ -33,10 +33,10 @@ const Cinfo* CaConcBase::initCinfo()
   ///////////////////////////////////////////////////////
   // Shared message definitions
   ///////////////////////////////////////////////////////
-  static DestFinfo process( "process", 
+  static DestFinfo process( "process",
 			    "Handles process call",
 			    new ProcOpFunc< CaConcBase >( &CaConcBase::process ) );
-  static DestFinfo reinit( "reinit", 
+  static DestFinfo reinit( "reinit",
 			   "Handles reinit call",
 			   new ProcOpFunc< CaConcBase >( &CaConcBase::reinit ) );
 
@@ -45,10 +45,10 @@ const Cinfo* CaConcBase::initCinfo()
       &process, &reinit
     };
 
-  static SharedFinfo proc( "proc", 
+  static SharedFinfo proc( "proc",
 			   "Shared message to receive Process message from scheduler",
 			   processShared, sizeof( processShared ) / sizeof( Finfo* ) );
-		
+
   ///////////////////////////////////////////////////////
   // Field definitions
   ///////////////////////////////////////////////////////
@@ -82,10 +82,9 @@ const Cinfo* CaConcBase::initCinfo()
 						    &CaConcBase::getB
 						    );
   static ElementValueFinfo< CaConcBase, double > thick( "thick",
-							"Thickness of Ca shell, assumed cylindrical. Legal range is "
-							"between zero and the radius. If outside this range it is "
-							"taken as the radius. Default zero, ie, the shell is the entire "
-							"thickness of the cylinder", 	
+							"Thickness of Ca shell, assumed cylindrical. Legal range is between 0 \n"
+							"and the radius. If outside this range it is taken as the radius. \n"
+							" Default zero, ie, the shell is the entire thickness of the cylinder \n",
 							&CaConcBase::setThickness,
 							&CaConcBase::getThickness
 							);
@@ -100,7 +99,8 @@ const Cinfo* CaConcBase::initCinfo()
 							   &CaConcBase::getDiameter
 							   );
   static ElementValueFinfo< CaConcBase, double > ceiling( "ceiling",
-							  "Ceiling value for Ca concentration. If Ca > ceiling, Ca = ceiling. If ceiling <= 0.0, there is no upper limit on Ca concentration value.",
+							  "Ceiling value for Ca concentration. If Ca > ceiling, Ca = ceiling. \n"
+                "If ceiling <= 0.0, there is no upper limit on Ca concentration value.",
 							  &CaConcBase::setCeiling,
 							  &CaConcBase::getCeiling
 							  );
@@ -114,34 +114,34 @@ const Cinfo* CaConcBase::initCinfo()
   // MsgDest definitions
   ///////////////////////////////////////////////////////
 
-  static DestFinfo current( "current", 
+  static DestFinfo current( "current",
 			    "Calcium Ion current, due to be converted to conc.",
 			    new EpFunc1< CaConcBase, double >( &CaConcBase::current )
 			    );
 
-  static DestFinfo currentFraction( "currentFraction", 
+  static DestFinfo currentFraction( "currentFraction",
 				    "Fraction of total Ion current, that is carried by Ca2+.",
 				    new EpFunc2< CaConcBase, double, double >( &CaConcBase::currentFraction )
 				    );
 
-  static DestFinfo increase( "increase", 
+  static DestFinfo increase( "increase",
 			     "Any input current that increases the concentration.",
 			     new EpFunc1< CaConcBase, double >( &CaConcBase::increase )
 			     );
 
-  static DestFinfo decrease( "decrease", 
+  static DestFinfo decrease( "decrease",
 			     "Any input current that decreases the concentration.",
 			     new EpFunc1< CaConcBase, double >( &CaConcBase::decrease )
 			     );
 
-  static DestFinfo basal( "basal", 
+  static DestFinfo basal( "basal",
 			  "Synonym for assignment of basal conc.",
 			  new EpFunc1< CaConcBase, double >( &CaConcBase::setCaBasal )
 			  );
 
   static Finfo* CaConcBaseFinfos[] =
     {
-      &proc,		// Shared 
+      &proc,		// Shared
       concOut(),	// Src
       &Ca,		// Value
       &CaBasal,	// Value
@@ -167,13 +167,12 @@ const Cinfo* CaConcBase::initCinfo()
     {
       "Name", "CaConcBase",
       "Author", "Upinder S. Bhalla, 2014, NCBS",
-      "Description", 
-      "CaConcBase: Base class for Calcium concentration "
-      "pool. Takes current from a channel and keeps track of "
-      "calcium buildup and depletion by a "
-      "single exponential process. ",
+      "Description",
+      "CaConcBase: Base class for Calcium concentration pool. \n"
+      "Takes current from a channel and keeps track of calcium buildup and \n"
+      " depletion by a single exponential process. ",
     };
-        
+
   static ZeroSizeDinfo< int > dinfo;
 
   static Cinfo CaConcBaseCinfo(
@@ -341,7 +340,7 @@ void CaConcBase::vSetSolver( const Eref& e, Id hsolve )
 {;}
 
 // static func
-void CaConcBase::zombify( Element* orig, const Cinfo* zClass, 
+void CaConcBase::zombify( Element* orig, const Cinfo* zClass,
 			  Id hsolve )
 {
   if ( orig->cinfo() == zClass )
@@ -355,7 +354,7 @@ void CaConcBase::zombify( Element* orig, const Cinfo* zClass,
   unsigned int j = 0;
   for ( unsigned int i = 0; i < num; ++i ) {
     Eref er( orig, i + start );
-    const CaConcBase* cb = 
+    const CaConcBase* cb =
       reinterpret_cast< const CaConcBase* >( er.data() );
     data[j + 0] = cb->getCa( er );
     data[j + 1] = cb->getCaBasal( er );
@@ -386,4 +385,3 @@ void CaConcBase::zombify( Element* orig, const Cinfo* zClass,
     j += 9; //was 7?
   }
 }
-
diff --git a/biophysics/ChanBase.cpp b/biophysics/ChanBase.cpp
index c3826c50bba41531a3734fb15e40a29455360d67..b483dbcb6bec2f8860856a3c2890bd9d9e14198b 100644
--- a/biophysics/ChanBase.cpp
+++ b/biophysics/ChanBase.cpp
@@ -13,21 +13,21 @@
 
 SrcFinfo1< double >* ChanBase::permeability()
 {
-	static SrcFinfo1< double > permeability( "permeabilityOut", 
+	static SrcFinfo1< double > permeability( "permeabilityOut",
 		"Conductance term going out to GHK object" );
 	return &permeability;
 }
 
 SrcFinfo2< double, double >* ChanBase::channelOut()
 {
-	static SrcFinfo2< double, double > channelOut( "channelOut", 
+	static SrcFinfo2< double, double > channelOut( "channelOut",
 		"Sends channel variables Gk and Ek to compartment" );
 	return &channelOut;
 }
 
 SrcFinfo1< double >* ChanBase::IkOut()
 {
-	static SrcFinfo1< double > IkOut( "IkOut", 
+	static SrcFinfo1< double > IkOut( "IkOut",
 		"Channel current. This message typically goes to concen"
 		"objects that keep track of ion concentration." );
 	return &IkOut;
@@ -38,10 +38,10 @@ const Cinfo* ChanBase::initCinfo()
 	/////////////////////////////////////////////////////////////////////
 	// Shared messages
 	/////////////////////////////////////////////////////////////////////
-	static DestFinfo process( "process", 
+	static DestFinfo process( "process",
 		"Handles process call",
 		new ProcOpFunc< ChanBase >( &ChanBase::process ) );
-	static DestFinfo reinit( "reinit", 
+	static DestFinfo reinit( "reinit",
 		"Handles reinit call",
 		new ProcOpFunc< ChanBase >( &ChanBase::reinit ) );
 
@@ -50,13 +50,13 @@ const Cinfo* ChanBase::initCinfo()
 		&process, &reinit
 	};
 
-	static SharedFinfo proc( "proc", 
+	static SharedFinfo proc( "proc",
 		"Shared message to receive Process message from scheduler",
 		processShared, sizeof( processShared ) / sizeof( Finfo* ) );
 
 	/////////////////////////////////////////////////////////////////////
 	/// ChannelOut SrcFinfo defined above.
-	static DestFinfo Vm( "Vm", 
+	static DestFinfo Vm( "Vm",
 		"Handles Vm message coming in from compartment",
 		new OpFunc1< ChanBase, double >( &ChanBase::handleVm ) );
 
@@ -64,7 +64,7 @@ const Cinfo* ChanBase::initCinfo()
 	{
 		channelOut(), &Vm
 	};
-	static SharedFinfo channel( "channel", 
+	static SharedFinfo channel( "channel",
 		"This is a shared message to couple channel to compartment. "
 		"The first entry is a MsgSrc to send Gk and Ek to the compartment "
 		"The second entry is a MsgDest for Vm from the compartment.",
@@ -79,7 +79,7 @@ const Cinfo* ChanBase::initCinfo()
 	{
 		&Vm, permeability()
 	};
-	static SharedFinfo ghk( "ghk", 
+	static SharedFinfo ghk( "ghk",
 		"Message to Goldman-Hodgkin-Katz object",
 		ghkShared, sizeof( ghkShared ) / sizeof( Finfo* ) );
 
@@ -104,7 +104,7 @@ const Cinfo* ChanBase::initCinfo()
 			&ChanBase::setModulation,
 			&ChanBase::getModulation
 		);
-		static ElementValueFinfo< ChanBase, double > Ek( "Ek", 
+		static ElementValueFinfo< ChanBase, double > Ek( "Ek",
 			"Reversal potential of channel",
 			&ChanBase::setEk,
 			&ChanBase::getEk
@@ -127,7 +127,7 @@ const Cinfo* ChanBase::initCinfo()
 ///////////////////////////////////////////////////////
 // MsgDest definitions
 ///////////////////////////////////////////////////////
-	
+
 ///////////////////////////////////////////////////////
 	static Finfo* ChanBaseFinfos[] =
 	{
@@ -141,7 +141,7 @@ const Cinfo* ChanBase::initCinfo()
 		IkOut(),			// Src
 		&proc,				// Shared
 	};
-	
+
 	static string doc[] =
 	{
 		"Name", "ChanBase",
@@ -151,7 +151,7 @@ const Cinfo* ChanBase::initCinfo()
 	};
 
         static  ZeroSizeDinfo< int > dinfo;
-        
+
 	static Cinfo ChanBaseCinfo(
 		"ChanBase",
 		Neutral::initCinfo(),
diff --git a/biophysics/Compartment.cpp b/biophysics/Compartment.cpp
index 569d6a50de67d46bd2a8335b953f6957a1fe65e3..dda3ee47cfe3645a4a9efc3df895b4d9ad7f58ea 100644
--- a/biophysics/Compartment.cpp
+++ b/biophysics/Compartment.cpp
@@ -54,18 +54,18 @@ static const Cinfo* compartmentCinfo = Compartment::initCinfo();
 
 
 /*
-const SrcFinfo1< double >* VmOut = 
-	dynamic_cast< const SrcFinfo1< double >* >( 
-			compartmentCinfo->findFinfo( "VmOut" ) ); 
+const SrcFinfo1< double >* VmOut =
+	dynamic_cast< const SrcFinfo1< double >* >(
+			compartmentCinfo->findFinfo( "VmOut" ) );
 			*/
 
-const SrcFinfo1< double >* axialOut = 
+const SrcFinfo1< double >* axialOut =
 	dynamic_cast< const SrcFinfo1< double >* > (
-			compartmentCinfo->findFinfo( "axialOut" ) ); 
+			compartmentCinfo->findFinfo( "axialOut" ) );
 
-const SrcFinfo2< double, double >* raxialOut = 
+const SrcFinfo2< double, double >* raxialOut =
 	dynamic_cast< const SrcFinfo2< double, double >* > (
-			compartmentCinfo->findFinfo( "raxialOut" ) ); 
+			compartmentCinfo->findFinfo( "raxialOut" ) );
 
 //////////////////////////////////////////////////////////////////
 // Here we put the Compartment class functions.
@@ -181,7 +181,7 @@ double Compartment::vGetInitVm( const Eref& e ) const
 void Compartment::vProcess( const Eref& e, ProcPtr p )
 {
         //cout << "Compartment " << e.id().path() << ":: process: A = " << A_ << ", B = " << B_ << endl;
-	A_ += inject_ + sumInject_ + Em_ * invRm_; 
+	A_ += inject_ + sumInject_ + Em_ * invRm_;
 	if ( B_ > EPSILON ) {
 		double x = exp( -B_ * p->dt / Cm_ );
 		Vm_ = Vm_ * x + ( A_ / B_ )  * ( 1.0 - x );
@@ -208,7 +208,7 @@ void Compartment::vReinit(  const Eref& e, ProcPtr p )
         lastIm_ = 0.0;
 	sumInject_ = 0.0;
 	dt_ = p->dt;
-	
+
 	// Send out the resting Vm to channels, SpikeGens, etc.
 	VmOut()->send( e, Vm_ );
 }
@@ -293,7 +293,7 @@ void testCompartment()
 	double Vm = 0.0;
 	double tau = 1.0;
 	double Vmax = 1.0;
-	for ( p.currTime = 0.0; p.currTime < 2.0; p.currTime += p.dt ) 
+	for ( p.currTime = 0.0; p.currTime < 2.0; p.currTime += p.dt )
 	{
 		Vm = c->getVm( compter );
 		double x = Vmax - Vmax * exp( -p.currTime / tau );
@@ -336,7 +336,7 @@ void testCompartmentProcess()
 	assert( ret );
 	Field< double >::setRepeat( cid, "inject", 0 );
 	// Only apply current injection in first compartment
-	Field< double >::set( ObjId( cid, 0 ), "inject", 1.0 ); 
+	Field< double >::set( ObjId( cid, 0 ), "inject", 1.0 );
 	Field< double >::setRepeat( cid, "Rm", Rm );
 	Field< double >::setRepeat( cid, "Ra", Ra );
 	Field< double >::setRepeat( cid, "Cm", Cm );
@@ -363,7 +363,7 @@ void testCompartmentProcess()
 	shell->doSetClock( 0, dt );
 	shell->doSetClock( 1, dt );
 	// Ensure that the inter_compt msgs go between nodes once every dt.
-	shell->doSetClock( 9, dt ); 
+	shell->doSetClock( 9, dt );
 
 	shell->doUseClock( "/compt", "init", 0 );
 	shell->doUseClock( "/compt", "process", 1 );
@@ -374,7 +374,7 @@ void testCompartmentProcess()
 	double Vmax = Field< double >::get( ObjId( cid, 0 ), "Vm" );
 
 	double delta = 0.0;
-	// We measure only the first 50 compartments as later we 
+	// We measure only the first 50 compartments as later we
 	// run into end effects because it is not an infinite cable
 	for ( unsigned int i = 0; i < size; i++ ) {
 		double Vm = Field< double >::get( ObjId( cid, i ), "Vm" );
diff --git a/biophysics/CompartmentBase.cpp b/biophysics/CompartmentBase.cpp
index 50297e3b9f83a3c8431e2dc91055dc95d1843f5a..94ac948d7fbdaff6a4eae98cfe4b40914ad00f10 100644
--- a/biophysics/CompartmentBase.cpp
+++ b/biophysics/CompartmentBase.cpp
@@ -19,13 +19,13 @@ using namespace moose;
 
 /*
  * This Finfo is used to send out Vm to channels, spikegens, etc.
- * 
+ *
  * It is exposed here so that HSolve can also use it to send out
  * the Vm to the recipients.
  */
 // Static function.
 SrcFinfo1< double >* CompartmentBase::VmOut() {
-	static SrcFinfo1< double > VmOut( "VmOut", 
+	static SrcFinfo1< double > VmOut( "VmOut",
 		"Sends out Vm value of compartment on each timestep" );
 	return &VmOut;
 }
@@ -35,7 +35,7 @@ SrcFinfo1< double >* CompartmentBase::VmOut() {
 // are still only Vm.
 
 static SrcFinfo1< double >* axialOut() {
-	static SrcFinfo1< double > axialOut( "axialOut", 
+	static SrcFinfo1< double > axialOut( "axialOut",
 		"Sends out Vm value of compartment to adjacent compartments,"
 		"on each timestep" );
 	return &axialOut;
@@ -43,7 +43,7 @@ static SrcFinfo1< double >* axialOut() {
 
 static SrcFinfo2< double, double >* raxialOut()
 {
-	static SrcFinfo2< double, double > raxialOut( "raxialOut", 
+	static SrcFinfo2< double, double > raxialOut( "raxialOut",
 		"Sends out Raxial information on each timestep, "
 		"fields are Ra and Vm" );
 	return &raxialOut;
@@ -62,38 +62,38 @@ const Cinfo* CompartmentBase::initCinfo()
 	///////////////////////////////////////////////////////////////////
 	// Shared messages
 	///////////////////////////////////////////////////////////////////
-	static DestFinfo process( "process", 
+	static DestFinfo process( "process",
 		"Handles 'process' call",
 		new ProcOpFunc< CompartmentBase >( &CompartmentBase::process ) );
 
-	static DestFinfo reinit( "reinit", 
+	static DestFinfo reinit( "reinit",
 		"Handles 'reinit' call",
 		new ProcOpFunc< CompartmentBase >( &CompartmentBase::reinit ) );
-	
+
 	static Finfo* processShared[] =
 	{
 		&process, &reinit
 	};
 
 	static SharedFinfo proc( "proc",
-		"This is a shared message to receive Process messages "
-		"from the scheduler objects. The Process should be called "
-		"_second_ in each clock tick, after the Init message."
+		"This is a shared message to receive Process messages from the scheduler"
+		"objects. The Process should be called _second_ in each clock tick, after the Init message."
 		"The first entry in the shared msg is a MsgDest "
 		"for the Process operation. It has a single argument, "
 		"ProcInfo, which holds lots of information about current "
 		"time, thread, dt and so on. The second entry is a MsgDest "
-		"for the Reinit operation. It also uses ProcInfo. ",
+		"for the Reinit operation. It also uses ProcInfo. "
+		"- Handles 'reinit' and 'process' calls.",
 		processShared, sizeof( processShared ) / sizeof( Finfo* )
 	);
 	///////////////////////////////////////////////////////////////////
-	
-	static DestFinfo initProc( "initProc", 
+
+	static DestFinfo initProc( "initProc",
 		"Handles Process call for the 'init' phase of the CompartmentBase "
 		"calculations. These occur as a separate Tick cycle from the "
 		"regular proc cycle, and should be called before the proc msg.",
 		new ProcOpFunc< CompartmentBase >( &CompartmentBase::initProc ) );
-	static DestFinfo initReinit( "initReinit", 
+	static DestFinfo initReinit( "initReinit",
 		"Handles Reinit call for the 'init' phase of the CompartmentBase "
 		"calculations.",
 		new ProcOpFunc< CompartmentBase >( &CompartmentBase::initReinit ) );
@@ -102,7 +102,7 @@ const Cinfo* CompartmentBase::initCinfo()
 		&initProc, &initReinit
 	};
 
-	static SharedFinfo init( "init", 
+	static SharedFinfo init( "init",
 			"This is a shared message to receive Init messages from "
 			"the scheduler objects. Its job is to separate the "
 			"compartmental calculations from the message passing. "
@@ -113,13 +113,14 @@ const Cinfo* CompartmentBase::initCinfo()
 			"single argument, ProcInfo, which holds lots of "
 			"information about current time, thread, dt and so on. "
 			"The second entry is a dummy MsgDest for the Reinit "
-			"operation. It also uses ProcInfo. ",
+			"operation. It also uses ProcInfo. "
+			"- Handles 'initProc' and 'initReinit' calls.",
 		initShared, sizeof( initShared ) / sizeof( Finfo* )
 	);
 
 	///////////////////////////////////////////////////////////////////
 
-	static DestFinfo handleChannel( "handleChannel", 
+	static DestFinfo handleChannel( "handleChannel",
 		"Handles conductance and Reversal potential arguments from Channel",
 		new EpFunc2< CompartmentBase, double, double >( &CompartmentBase::handleChannel ) );
 	// VmOut is declared above as it needs to be in scope for later funcs.
@@ -128,18 +129,19 @@ const Cinfo* CompartmentBase::initCinfo()
 	{
 		&handleChannel, CompartmentBase::VmOut()
 	};
-	static SharedFinfo channel( "channel", 
+	static SharedFinfo channel( "channel",
 			"This is a shared message from a compartment to channels. "
 			"The first entry is a MsgDest for the info coming from "
 			"the channel. It expects Gk and Ek from the channel "
-			"as args. The second entry is a MsgSrc sending Vm ",
+			"as args. The second entry is a MsgSrc sending Vm "
+			"- Handles 'handleChannel' and 'VmOut' calls.",
 		channelShared, sizeof( channelShared ) / sizeof( Finfo* )
 	);
 	///////////////////////////////////////////////////////////////////
 	// axialOut declared above as it is needed in file scope
-	static DestFinfo handleRaxial( "handleRaxial", 
+	static DestFinfo handleRaxial( "handleRaxial",
 		"Handles Raxial info: arguments are Ra and Vm.",
-		new OpFunc2< CompartmentBase, double, double >( 
+		new OpFunc2< CompartmentBase, double, double >(
 			&CompartmentBase::handleRaxial )
 	);
 
@@ -147,7 +149,7 @@ const Cinfo* CompartmentBase::initCinfo()
 	{
 		axialOut(), &handleRaxial
 	};
-	static SharedFinfo axial( "axial", 
+	static SharedFinfo axial( "axial",
 			"This is a shared message between asymmetric compartments. "
 			"axial messages (this kind) connect up to raxial "
 			"messages (defined below). The soma should use raxial "
@@ -161,12 +163,13 @@ const Cinfo* CompartmentBase::initCinfo()
 			"of the target compartment. The second entry is a MsgDest "
 			"for the info coming from the other compt. It expects "
 			"Ra and Vm from the other compt as args. Note that the "
-			"message is named after the source type. ",
+			"message is named after the source type. "
+			"- Handles 'axialOut' and 'handleRaxial' calls.",
 		axialShared, sizeof( axialShared ) / sizeof( Finfo* )
 	);
 
 	///////////////////////////////////////////////////////////////////
-	static DestFinfo handleAxial( "handleAxial", 
+	static DestFinfo handleAxial( "handleAxial",
 		"Handles Axial information. Argument is just Vm.",
 		new OpFunc1< CompartmentBase, double >( &CompartmentBase::handleAxial ) );
 	// rxialOut declared above as it is needed in file scope
@@ -174,78 +177,78 @@ const Cinfo* CompartmentBase::initCinfo()
 	{
 		&handleAxial, raxialOut()
 	};
-	static SharedFinfo raxial( "raxial", 
-			"This is a raxial shared message between asymmetric "
-			"compartments. The first entry is a MsgDest for the info "
-			"coming from the other compt. It expects Vm from the "
-			"other compt as an arg. The second is a MsgSrc sending "
-			"Ra and Vm to the raxialFunc of the target compartment. ",
+	static SharedFinfo raxial( "raxial",
+			"This is a raxial shared message between asymmetric compartments. The \n"
+			"first entry is a MsgDest for the info coming from the other compt. It \n"
+			"expects Vm from the other compt as an arg. The second is a MsgSrc sending \n"
+			"Ra and Vm to the raxialFunc of the target compartment. \n"
+			"- Handles 'handleAxial' and 'raxialOut' calls.",
 			raxialShared, sizeof( raxialShared ) / sizeof( Finfo* )
 	);
 	///////////////////////////////////////////////////////////////////
 	// Value Finfos.
 	///////////////////////////////////////////////////////////////////
 
-		static ElementValueFinfo< CompartmentBase, double > Vm( "Vm", 
+		static ElementValueFinfo< CompartmentBase, double > Vm( "Vm",
 			"membrane potential",
 			&CompartmentBase::setVm,
 			&CompartmentBase::getVm
 		);
-		static ElementValueFinfo< CompartmentBase, double > Cm( "Cm", 
+		static ElementValueFinfo< CompartmentBase, double > Cm( "Cm",
 			"Membrane capacitance",
 			 &CompartmentBase::setCm,
 			&CompartmentBase::getCm
 		);
-		static ElementValueFinfo< CompartmentBase, double > Em( "Em", 
+		static ElementValueFinfo< CompartmentBase, double > Em( "Em",
 			"Resting membrane potential",
 			 &CompartmentBase::setEm,
 			&CompartmentBase::getEm
 		);
-		static ReadOnlyElementValueFinfo< CompartmentBase, double > Im( "Im", 
+		static ReadOnlyElementValueFinfo< CompartmentBase, double > Im( "Im",
 			"Current going through membrane",
 			&CompartmentBase::getIm
 		);
-		static ElementValueFinfo< CompartmentBase, double > inject( "inject", 
+		static ElementValueFinfo< CompartmentBase, double > inject( "inject",
 			"Current injection to deliver into compartment",
 			&CompartmentBase::setInject,
 			&CompartmentBase::getInject
 		);
-		static ElementValueFinfo< CompartmentBase, double > initVm( "initVm", 
+		static ElementValueFinfo< CompartmentBase, double > initVm( "initVm",
 			"Initial value for membrane potential",
 			&CompartmentBase::setInitVm,
 			&CompartmentBase::getInitVm
 		);
-		static ElementValueFinfo< CompartmentBase, double > Rm( "Rm", 
+		static ElementValueFinfo< CompartmentBase, double > Rm( "Rm",
 			"Membrane resistance",
 			&CompartmentBase::setRm,
 			&CompartmentBase::getRm
 		);
-		static ElementValueFinfo< CompartmentBase, double > Ra( "Ra", 
+		static ElementValueFinfo< CompartmentBase, double > Ra( "Ra",
 			"Axial resistance of compartment",
 			&CompartmentBase::setRa,
 			&CompartmentBase::getRa
 		);
-		static ValueFinfo< CompartmentBase, double > diameter( "diameter", 
+		static ValueFinfo< CompartmentBase, double > diameter( "diameter",
 			"Diameter of compartment",
 			&CompartmentBase::setDiameter,
 			&CompartmentBase::getDiameter
 		);
-		static ValueFinfo< CompartmentBase, double > length( "length", 
+		static ValueFinfo< CompartmentBase, double > length( "length",
 			"Length of compartment",
 			&CompartmentBase::setLength,
 			&CompartmentBase::getLength
 		);
-		static ValueFinfo< CompartmentBase, double > x0( "x0", 
+		static ValueFinfo< CompartmentBase, double > x0( "x0",
 			"X coordinate of start of compartment",
 			&CompartmentBase::setX0,
 			&CompartmentBase::getX0
 		);
-		static ValueFinfo< CompartmentBase, double > y0( "y0", 
+		static ValueFinfo< CompartmentBase, double > y0( "y0",
 			"Y coordinate of start of compartment",
 			&CompartmentBase::setY0,
 			&CompartmentBase::getY0
 		);
-		static ValueFinfo< CompartmentBase, double > z0( "z0", 
+		static ValueFinfo< CompartmentBase, double > z0( "z0",
 			"Z coordinate of start of compartment",
 			&CompartmentBase::setZ0,
 			&CompartmentBase::getZ0
@@ -260,16 +263,16 @@ const Cinfo* CompartmentBase::initCinfo()
 			&CompartmentBase::setY,
 			&CompartmentBase::getY
 		);
-		static ValueFinfo< CompartmentBase, double > z( "z", 
+		static ValueFinfo< CompartmentBase, double > z( "z",
 			"z coordinate of end of compartment",
 			&CompartmentBase::setZ,
 			&CompartmentBase::getZ
 		);
-	
+
 	//////////////////////////////////////////////////////////////////
 	// DestFinfo definitions
 	//////////////////////////////////////////////////////////////////
-		static DestFinfo injectMsg( "injectMsg", 
+		static DestFinfo injectMsg( "injectMsg",
 			"The injectMsg corresponds to the INJECT message in the "
 			"GENESIS compartment. Unlike the 'inject' field, any value "
 			"assigned by handleInject applies only for a single timestep."
@@ -277,7 +280,7 @@ const Cinfo* CompartmentBase::initCinfo()
 			"injection current",
 			new EpFunc1< CompartmentBase,  double >( &CompartmentBase::injectMsg )
 		);
-		
+
 		static DestFinfo randInject( "randInject",
 			"Sends a random injection current to the compartment. Must be"
 			"updated each timestep."
@@ -285,24 +288,24 @@ const Cinfo* CompartmentBase::initCinfo()
 			new EpFunc2< CompartmentBase, double, double > (
 				&CompartmentBase::randInject ) );
 
-		static DestFinfo cable( "cable", 
+		static DestFinfo cable( "cable",
 			"Message for organizing compartments into groups, called"
 			"cables. Doesn't do anything.",
 			new OpFunc0< CompartmentBase >( &CompartmentBase::cable )
 		);
-		static DestFinfo displace( "displace", 
+		static DestFinfo displace( "displace",
 			"Displaces compartment by specified vector",
 			new OpFunc3< CompartmentBase, double, double, double>(
 				   	&CompartmentBase::displace )
 		);
-		static DestFinfo setGeomAndElec( "setGeomAndElec", 
+		static DestFinfo setGeomAndElec( "setGeomAndElec",
 			"Assigns length and dia and accounts for any electrical "
 			"scaling needed as a result.",
 			new EpFunc2< CompartmentBase, double, double>(
 				   	&CompartmentBase::setGeomAndElec )
 		);
 	///////////////////////////////////////////////////////////////////
-	static Finfo* compartmentFinfos[] = 
+	static Finfo* compartmentFinfos[] =
 	{
 		&Vm,				// Value
 		&Cm,				// Value
@@ -381,7 +384,7 @@ bool CompartmentBase::rangeWarning( const string& field, double value )
 	if ( value < RANGE ) {
 		cout << "Warning: Ignored attempt to set " << field <<
 				" of compartment " <<
-				// c->target().e->name() << 
+				// c->target().e->name() <<
 				" to " << value << " as it is less than " << RANGE << endl;
 		return 1;
 	}
@@ -480,8 +483,8 @@ double CompartmentBase::getDiameter() const
 void CompartmentBase::setLength( double value )
 {
 	// If length is assigned correctly, also redo the end coords to match.
-	if ( value > 0 && length_ > 0 && 
-			doubleEq( length_ * length_, 
+	if ( value > 0 && length_ > 0 &&
+			doubleEq( length_ * length_,
 			(x_-x0_)*(x_-x0_) + (y_-y0_)*(y_-y0_) + (z_-z0_)*(z_-z0_) ) ) {
 		double ratio = value / length_;
 		x_ = x0_ + ratio * ( x_ - x0_ );
@@ -499,7 +502,7 @@ double CompartmentBase::getLength() const
 
 void CompartmentBase::updateLength()
 {
-	length_ = sqrt( (x_-x0_)*(x_-x0_) + 
+	length_ = sqrt( (x_-x0_)*(x_-x0_) +
 					(y_-y0_)*(y_-y0_) + (z_-z0_)*(z_-z0_) );
 }
 
@@ -585,7 +588,7 @@ void CompartmentBase::reinit(  const Eref& e, ProcPtr p )
 
 void CompartmentBase::initProc( const Eref& e, ProcPtr p )
 {
-	vInitProc( e, p ); 
+	vInitProc( e, p );
 }
 
 void CompartmentBase::initReinit( const Eref& e, ProcPtr p )
@@ -637,11 +640,11 @@ void CompartmentBase::setGeomAndElec( const Eref& e,
 				double len, double dia )
 {
 	if ( length_ > 0 && diameter_ > 0 && len > 0 && dia > 0 &&
-			doubleEq( length_ * length_, 
+			doubleEq( length_ * length_,
 			(x_-x0_)*(x_-x0_) + (y_-y0_)*(y_-y0_) + (z_-z0_)*(z_-z0_) ) ) {
 		vSetRm( e, vGetRm( e ) * diameter_ * length_ / ( dia * len ) );
 		vSetCm( e, vGetCm( e ) * dia * len / ( diameter_ * length_ ) );
-		vSetRa( e, vGetRa( e ) * len * (diameter_ * diameter_) / 
+		vSetRa( e, vGetRa( e ) * len * (diameter_ * diameter_) /
 				( length_ * dia * dia ) );
 		// Rescale channel Gbars here
 		vector< ObjId > chans;
@@ -658,7 +661,7 @@ void CompartmentBase::setGeomAndElec( const Eref& e,
 			Field< double >::set( concs[i], "length", len );
 			Field< double >::set( concs[i], "diameter", dia );
 		}
-		
+
 		setLength( len );
 		setDiameter( dia );
 	}
@@ -673,7 +676,7 @@ void CompartmentBase::vSetSolver( const Eref& e, Id hsolve )
 {;}
 
 // static func
-void CompartmentBase::zombify( Element* orig, const Cinfo* zClass, 
+void CompartmentBase::zombify( Element* orig, const Cinfo* zClass,
 				Id hsolve )
 {
 	if ( orig->cinfo() == zClass )
@@ -686,7 +689,7 @@ void CompartmentBase::zombify( Element* orig, const Cinfo* zClass,
 
 	for ( unsigned int i = 0; i < num; ++i ) {
 		Eref er( orig, i + start );
-		const CompartmentBase* cb = 
+		const CompartmentBase* cb =
 			reinterpret_cast< const CompartmentBase* >( er.data() );
 		cdh[i].readData( cb, er );
 	}
diff --git a/biophysics/DifBuffer.cpp b/biophysics/DifBuffer.cpp
index 60763e82b86ce5794edf170948758d40d31f214c..cb77d41faeeb6907a35904a7ac1037813dca3e6b 100644
--- a/biophysics/DifBuffer.cpp
+++ b/biophysics/DifBuffer.cpp
@@ -1,47 +1,47 @@
 // DifBuffer.cpp --- 
-// 
+//
 // Filename: DifBuffer.cpp
-// Description: 
+// Description:
 // Author: Subhasis Ray
-// Maintainer: 
+// Maintainer:
 // Created: Mon Feb 16 12:02:11 2015 (-0500)
-// Version: 
+// Version:
 // Package-Requires: ()
 // Last-Updated: Mon Feb 23 13:07:56 2015 (-0500)
 //           By: Subhasis Ray
 //     Update #: 130
-// URL: 
-// Doc URL: 
-// Keywords: 
-// Compatibility: 
-// 
-// 
-
-// Commentary: 
-// 
-// 
-// 
-// 
+// URL:
+// Doc URL:
+// Keywords:
+// Compatibility:
+//
+//
+
+// Commentary:
+//
+//
+//
+//
 
 // Change Log:
 // 5/25/16 Completing DifBuffer -- Asia J-Szmek (GMU)
 // 9/21/16 rewrote DifBuffer to account for DifBufferBase (AJS)
-// 
-// 
+//
+//
 // 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 3 of the License, or (at
 // your option) any later version.
-// 
+//
 // This program is distributed in the hope that it will be useful, but
 // WITHOUT ANY WARRANTY; without even the implied warranty of
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 // General Public License for more details.
-// 
+//
 // You should have received a copy of the GNU General Public License
 // along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
-// 
-// 
+//
+//
 
 // Code:
 
@@ -141,7 +141,7 @@ void DifBuffer::vSetBFree(const Eref& e,double value)
   bBound_ = bTot_ - bFree_;
   prevFree_= bFree_;
   prevBound_ = bBound_;
-  
+
 }
 
 double DifBuffer::vGetBBound(const Eref& e) const
@@ -219,7 +219,7 @@ double DifBuffer::vGetD(const Eref& e) const
 
 void DifBuffer::vSetD(const Eref& e,double value)
 {
-  
+
   if ( value  < 0.0 ) {
     cerr << " Error: DifBuffer: Diffusion constant, D, cannot be negative!\n";
     return;
@@ -248,7 +248,7 @@ void DifBuffer::vSetLength(const Eref& e, double length )
     cerr << "Error: DifBuffer: length cannot be negative!\n";
     return;
   }
-	
+
   length_ = length;
 }
 
@@ -263,7 +263,7 @@ void DifBuffer::vSetDiameter(const Eref& e, double diameter )
     cerr << "Error: DifBuffer: diameter cannot be negative!\n";
     return;
   }
-	
+
   diameter_ = diameter;
 }
 
@@ -278,7 +278,7 @@ void DifBuffer::vSetThickness( const Eref& e, double thickness )
     cerr << "Error: DifBuffer: thickness cannot be negative!\n";
     return;
   }
-	
+
   thickness_ = thickness;
 }
 
@@ -291,12 +291,12 @@ void DifBuffer::vSetVolume(const Eref& e, double volume )
 {
   if ( shapeMode_ != 3 )
     cerr << "Warning: DifBuffer: Trying to set volume, when shapeMode is not USER-DEFINED\n";
-	
+
   if ( volume < 0.0 ) {
     cerr << "Error: DifBuffer: volume cannot be negative!\n";
     return;
   }
-	
+
   volume_ = volume;
 }
 
@@ -309,12 +309,12 @@ void DifBuffer::vSetOuterArea(const Eref& e, double outerArea )
 {
   if (shapeMode_ != 3 )
     cerr << "Warning: DifBuffer: Trying to set outerArea, when shapeMode is not USER-DEFINED\n";
-	
+
   if ( outerArea < 0.0 ) {
     cerr << "Error: DifBuffer: outerArea cannot be negative!\n";
     return;
   }
-	
+
   outerArea_ = outerArea;
 }
 
@@ -327,12 +327,12 @@ void DifBuffer::vSetInnerArea(const Eref& e, double innerArea )
 {
   if ( shapeMode_ != 3 )
     cerr << "Warning: DifBuffer: Trying to set innerArea, when shapeMode is not USER-DEFINED\n";
-    
+
   if ( innerArea < 0.0 ) {
     cerr << "Error: DifBuffer: innerArea cannot be negative!\n";
     return;
   }
-    
+
   innerArea_ = innerArea;
 }
 
@@ -369,16 +369,16 @@ void DifBuffer::vProcess( const Eref & e, ProcPtr p )
    * then compute their incoming fluxes.
    */
 
-  
-  
+
+
   Af_ += kb_ * bBound_;
   Bf_ += kf_ * activation_;
-  
+
   bFree_ = integrate(bFree_,p->dt,Af_,Bf_);
   bBound_ = bTot_ - bFree_;
   prevFree_ = bFree_;
   prevBound_ = bBound_;
- 
+
   /**
    * Send ion concentration to ion buffers. They will send back information on
    * the reaction (forward / backward rates ; free / bound buffer concentration)
@@ -395,11 +395,11 @@ void DifBuffer::vProcess( const Eref & e, ProcPtr p )
 
 void DifBuffer::vReinit( const Eref& e, ProcPtr p )
 {
-	
+
   Af_ = 0;
   Bf_= 0;
   double rOut = diameter_/2.;
-  
+
   double rIn = rOut - thickness_;
 
   if (rIn<0)
@@ -419,9 +419,9 @@ void DifBuffer::vReinit( const Eref& e, ProcPtr p )
 	outerArea_ = 2*M_PI * rOut * length_;
 	innerArea_ = 2*M_PI * rIn * length_;
       }
-		
+
       break;
-	
+
       /*
        * Cylindrical Slice
        */
@@ -430,7 +430,7 @@ void DifBuffer::vReinit( const Eref& e, ProcPtr p )
       outerArea_ = M_PI * diameter_ * diameter_ / 4.0;
       innerArea_ = outerArea_;
       break;
-	
+
       /*
        * User defined
        */
@@ -438,18 +438,18 @@ void DifBuffer::vReinit( const Eref& e, ProcPtr p )
       // Nothing to be done here. Volume and inner-, outer areas specified by
       // user.
       break;
-	
+
     default:
       assert( 0 );
     }
-  
+
   bFree_ = bTot_/(1+activation_*kf_/kb_);
   prevFree_ = bFree_;
   bBound_ = bTot_ - bFree_;
   prevBound_ = bBound_;
   innerDifSourceOut()->send( e, prevFree_, thickness_ );
   outerDifSourceOut()->send( e, prevFree_, thickness_ );
-  
+
 }
 
 void DifBuffer::vFluxFromIn(const Eref& e,double innerC, double innerThickness)
diff --git a/biophysics/DifBufferBase.cpp b/biophysics/DifBufferBase.cpp
index 40628a21e44d95612293230d45824ccb52c1b638..5c6c43a20dd7034673fa8b0e10fe31fde7a5a839 100644
--- a/biophysics/DifBufferBase.cpp
+++ b/biophysics/DifBufferBase.cpp
@@ -12,7 +12,7 @@ SrcFinfo4< double, double, double, double >* DifBufferBase::reactionOut()
 								 " (free-buffer and bound-buffer molecules).");
   return &reactionOut;
 }
-                                                                 
+
 
 SrcFinfo2< double, double >* DifBufferBase::innerDifSourceOut(){
   static SrcFinfo2< double, double > sourceOut("innerDifSourceOut",
@@ -34,20 +34,20 @@ const Cinfo * DifBufferBase::initCinfo()
   static DestFinfo reinit( "reinit",
                            "Reinit happens only in stage 0",
                            new ProcOpFunc< DifBufferBase >( &DifBufferBase::reinit));
-    
+
   static Finfo* processShared[] = {
     &process,
     &reinit
   };
 
   static SharedFinfo proc(
-			  "proc", 
+			  "proc",
 			  "Here we create 2 shared finfos to attach with the Ticks. This is because we want to perform DifBufferBase "
 			  "computations in 2 stages, much as in the Compartment object. "
 			  "In the first stage we send out the concentration value to other DifBufferBases and Buffer elements. We also",
 			  processShared,
 			  sizeof( processShared ) / sizeof( Finfo* ));
-  
+
   static DestFinfo concentration("concentration",
                                  "Receives concentration (from DifShell).",
                                  new EpFunc1<DifBufferBase, double>(&DifBufferBase::buffer));
@@ -72,13 +72,13 @@ const Cinfo * DifBufferBase::initCinfo()
   static DestFinfo fluxFromOut( "fluxFromOut",
                                 "Destination message",
                                 new EpFunc2< DifBufferBase, double, double > ( &DifBufferBase::fluxFromOut ));
-    
+
   static Finfo* innerDifShared[] = {
     &fluxFromOut,
     DifBufferBase::innerDifSourceOut()
-    
+
   };
-    
+
   static SharedFinfo innerDif( "innerDif",
                                "This shared message (and the next) is between DifBufferBases: adjoining shells exchange information to "
                                "find out the flux between them. "
@@ -88,9 +88,9 @@ const Cinfo * DifBufferBase::initCinfo()
 
   static DestFinfo fluxFromIn( "fluxFromIn", "",
                                new EpFunc2< DifBufferBase, double, double> ( &DifBufferBase::fluxFromIn) );
-  
+
   static Finfo* outerDifShared[] = {
-    &fluxFromIn,  
+    &fluxFromIn,
     DifBufferBase::outerDifSourceOut(),
 
   };
@@ -99,7 +99,7 @@ const Cinfo * DifBufferBase::initCinfo()
                                 "Using this message, an outer shell sends to, and receives from its inner shell." ,
                                 outerDifShared,
                                 sizeof( outerDifShared ) / sizeof( Finfo* ));
-  
+
   ////////////////////////////
   // Field defs
   ////////////////////////////
@@ -130,7 +130,7 @@ const Cinfo * DifBufferBase::initCinfo()
   static ElementValueFinfo<DifBufferBase, double> bTot("bTot",
 						       "Total buffer concentration.",
 						       &DifBufferBase::setBTot,
-						       &DifBufferBase::getBTot);  
+						       &DifBufferBase::getBTot);
   static ElementValueFinfo<DifBufferBase, double> length("length",
 							 "Length of shell",
 							 &DifBufferBase::setLength,
@@ -143,12 +143,12 @@ const Cinfo * DifBufferBase::initCinfo()
 								  "shape of the shell: SHELL=0, SLICE=SLAB=1, USERDEF=3",
 								  &DifBufferBase::setShapeMode,
 								  &DifBufferBase::getShapeMode);
-  
+
   static ElementValueFinfo<DifBufferBase, double> thickness("thickness",
 							    "Thickness of shell",
 							    &DifBufferBase::setThickness,
 							    &DifBufferBase::getThickness);
- 
+
   static ElementValueFinfo<DifBufferBase, double> innerArea("innerArea",
 							    "Inner area of shell",
 							    &DifBufferBase::setInnerArea,
@@ -160,7 +160,7 @@ const Cinfo * DifBufferBase::initCinfo()
   static ElementValueFinfo< DifBufferBase, double> volume( "volume", "",
 							   &DifBufferBase::setVolume,
 							   &DifBufferBase::getVolume );
-  
+
   ////
   // DestFinfo
   ////
@@ -168,7 +168,7 @@ const Cinfo * DifBufferBase::initCinfo()
     //////////////////////////////////////////////////////////////////
     // Field definitions
     //////////////////////////////////////////////////////////////////
-    
+
     &activation,
     &D,
     &bFree,
@@ -199,7 +199,7 @@ const Cinfo * DifBufferBase::initCinfo()
     //////////////////////////////////////////////////////////////////
     // DestFinfo definitions
     //////////////////////////////////////////////////////////////////
-    &concentration,    
+    &concentration,
   };
 
   static string doc[] = {
@@ -379,7 +379,7 @@ void DifBufferBase::buffer(const Eref& e,double C)
 {
   vBuffer(e,C);
 }
-  
+
 void DifBufferBase::reinit( const Eref& e, ProcPtr p )
 {
   vReinit( e, p );
@@ -400,7 +400,7 @@ void DifBufferBase:: fluxFromIn(const Eref& e,double innerC, double innerThickne
 void DifBufferBase::vSetSolver( const Eref& e, Id hsolve )
 {;}
 
-void DifBufferBase::zombify( Element* orig, const Cinfo* zClass, 
+void DifBufferBase::zombify( Element* orig, const Cinfo* zClass,
 			     Id hsolve )
 {
   if ( orig->cinfo() == zClass )
@@ -413,10 +413,10 @@ void DifBufferBase::zombify( Element* orig, const Cinfo* zClass,
   vector< double > data( num * len );
 
   unsigned int j = 0;
-	
+
   for ( unsigned int i = 0; i < num; ++i ) {
     Eref er( orig, i + start );
-    const DifBufferBase* ds = 
+    const DifBufferBase* ds =
       reinterpret_cast< const DifBufferBase* >( er.data() );
     data[j + 0] = ds->getActivation( er );
     data[j + 1] = ds->getBFree( er );
@@ -438,7 +438,7 @@ void DifBufferBase::zombify( Element* orig, const Cinfo* zClass,
   j = 0;
   for ( unsigned int i = 0; i < num; ++i ) {
     Eref er( orig, i + start );
-    DifBufferBase* ds = 
+    DifBufferBase* ds =
       reinterpret_cast< DifBufferBase* >( er.data() );
     ds->vSetSolver(er,hsolve);
     ds->setActivation(er, data[j+0]);
@@ -457,5 +457,5 @@ void DifBufferBase::zombify( Element* orig, const Cinfo* zClass,
     ds->setInnerArea(er, data[j + 13]);
     j += len; //??
   }
-	
+
 }
diff --git a/biophysics/HHChannelBase.cpp b/biophysics/HHChannelBase.cpp
index 677d9554282e7fcbdd210227d0c9eb02c4bdefe1..147bb6e89bf092be1599226fc6da449ea823335b 100644
--- a/biophysics/HHChannelBase.cpp
+++ b/biophysics/HHChannelBase.cpp
@@ -45,7 +45,7 @@ const Cinfo* HHChannelBase::initCinfo()
 			&HHChannelBase::setInstant,
 			&HHChannelBase::getInstant
 		);
-		static ElementValueFinfo< HHChannelBase, double > X( "X", 
+		static ElementValueFinfo< HHChannelBase, double > X( "X",
 			"State variable for X gate",
 			&HHChannelBase::setX,
 			&HHChannelBase::getX
@@ -60,7 +60,7 @@ const Cinfo* HHChannelBase::initCinfo()
 			&HHChannelBase::setZ,
 			&HHChannelBase::getZ
 		);
-		static ElementValueFinfo< HHChannelBase, int > useConcentration( 
+		static ElementValueFinfo< HHChannelBase, int > useConcentration(
 			"useConcentration",
 			"Flag: when true, use concentration message rather than Vm to"
 			"control Z gate",
@@ -76,7 +76,7 @@ const Cinfo* HHChannelBase::initCinfo()
 ///////////////////////////////////////////////////////
 // MsgDest definitions
 ///////////////////////////////////////////////////////
-		static DestFinfo concen( "concen", 
+		static DestFinfo concen( "concen",
 			"Incoming message from Concen object to specific conc to use"
 			"in the Z gate calculations",
 			new EpFunc1< HHChannelBase, double >( &HHChannelBase::handleConc )
@@ -88,7 +88,7 @@ const Cinfo* HHChannelBase::initCinfo()
 		);
 ///////////////////////////////////////////////////////
 // FieldElementFinfo definition for HHGates. Note that these are made
-// with the deferCreate flag off, so that the HHGates are created 
+// with the deferCreate flag off, so that the HHGates are created
 // right away even if they are empty.
 // Assume only a single entry allocated in each gate.
 ///////////////////////////////////////////////////////
@@ -116,7 +116,7 @@ const Cinfo* HHChannelBase::initCinfo()
 			&HHChannelBase::getNumZgates
 			// 1
 		);
-	
+
 ///////////////////////////////////////////////////////
 	static Finfo* HHChannelBaseFinfos[] =
 	{
@@ -134,7 +134,7 @@ const Cinfo* HHChannelBase::initCinfo()
 		&gateY,				// FieldElement
 		&gateZ				// FieldElement
 	};
-	
+
 	static string doc[] =
 	{
 		"Name", "HHChannelBase",
@@ -144,9 +144,9 @@ const Cinfo* HHChannelBase::initCinfo()
 		"like the old tabchannel from GENESIS, but also presents "
 		"a similar interface as hhchan from GENESIS. ",
 	};
-        
+
     static  ZeroSizeDinfo< int > dinfo;
-        
+
 	static Cinfo HHChannelBaseCinfo(
 		"HHChannelBase",
 		ChanBase::initCinfo(),
@@ -168,9 +168,9 @@ static const Cinfo* hhChannelCinfo = HHChannelBase::initCinfo();
 // Constructor
 ///////////////////////////////////////////////////
 HHChannelBase::HHChannelBase()
-	: 
-			Xpower_( 0.0 ), 
-			Ypower_( 0.0 ), 
+	:
+			Xpower_( 0.0 ),
+			Ypower_( 0.0 ),
 			Zpower_( 0.0 ),
 			useConcentration_( 0 ),
 			modulation_( 1.0 )
@@ -321,7 +321,7 @@ HHGate* HHChannelBase::getZgate( unsigned int i )
 	return vGetZgate( i );
 }
 
-void HHChannelBase::setNumGates( unsigned int num ) 
+void HHChannelBase::setNumGates( unsigned int num )
 { ; }
 
 unsigned int  HHChannelBase::getNumXgates() const
@@ -384,7 +384,7 @@ void HHChannelBase::zombify( Element* orig, const Cinfo* zClass, Id hsolve )
 
 	for ( unsigned int i = 0; i < num; ++i ) {
 		Eref er( orig, i + start );
-		const HHChannelBase* hb = 
+		const HHChannelBase* hb =
 			reinterpret_cast< const HHChannelBase* >( er.data() );
 		*j = hb->vGetGbar( er );
 		*(j+1) = hb->vGetEk( er);
@@ -406,9 +406,8 @@ void HHChannelBase::zombify( Element* orig, const Cinfo* zClass, Id hsolve )
 		hb->vSetYpower( er, *(j+3) );
 		hb->vSetZpower( er, *(j+4) );
 		// hb->vSetUseConcentration( er, *(j+5) > 0.5 );
-		// Disable this assignment because the Solver already reads the 
+		// Disable this assignment because the Solver already reads the
 		// value, and it triggers an error msg.
 		j+= 6;
 	}
 }
-
diff --git a/biophysics/IntFire.cpp b/biophysics/IntFire.cpp
index b4478a11d745da1d95492678f4bc631f968639a8..990e62d751abdec03d780e19795dc9929d6ef5ae 100644
--- a/biophysics/IntFire.cpp
+++ b/biophysics/IntFire.cpp
@@ -12,8 +12,8 @@
 #include "IntFire.h"
 
 static SrcFinfo1< double > *spikeOut() {
-	static SrcFinfo1< double > spikeOut( 
-			"spikeOut", 
+	static SrcFinfo1< double > spikeOut(
+			"spikeOut",
 			"Sends out spike events. The argument is the timestamp of "
 			"the spike. "
 			);
@@ -101,7 +101,7 @@ const Cinfo* IntFire::initCinfo()
 static const Cinfo* intFireCinfo = IntFire::initCinfo();
 
 IntFire::IntFire()
-	: Vm_( 0.0 ), thresh_( 0.0 ), tau_( 1.0 ), 
+	: Vm_( 0.0 ), thresh_( 0.0 ), tau_( 1.0 ),
 		refractoryPeriod_( 0.1 ), lastSpike_( -0.1 ),
 		activation_( 0.0 )
 {
diff --git a/biophysics/MgBlock.cpp b/biophysics/MgBlock.cpp
index 2c946a51f6152d1e3e689208ff6e01d50910c11b..a070e7aa837780f3b72b5997bbd66c3a4787793c 100644
--- a/biophysics/MgBlock.cpp
+++ b/biophysics/MgBlock.cpp
@@ -22,19 +22,19 @@ const Cinfo* MgBlock::initCinfo()
 	///////////////////////////////////////////////////////
 	// Dest definitions
 	///////////////////////////////////////////////////////
-	static DestFinfo origChannel( "origChannel", 
+	static DestFinfo origChannel( "origChannel",
 		"",
 		new EpFunc2< MgBlock, double, double > (&MgBlock::origChannel )
 	);
 	///////////////////////////////////////////////////////
 	// Field definitions
 	///////////////////////////////////////////////////////
-	static ValueFinfo< MgBlock, double > KMg_A( "KMg_A", 
+	static ValueFinfo< MgBlock, double > KMg_A( "KMg_A",
 			"1/eta",
 			&MgBlock::setKMg_A,
 			&MgBlock::getKMg_A
 		);
-	static ValueFinfo< MgBlock, double > KMg_B( "KMg_B", 
+	static ValueFinfo< MgBlock, double > KMg_B( "KMg_B",
 			"1/gamma",
 			&MgBlock::setKMg_B,
 			&MgBlock::getKMg_B
@@ -66,7 +66,7 @@ const Cinfo* MgBlock::initCinfo()
 		"Description", "MgBlock: Hodgkin-Huxley type voltage-gated Ion channel. Something "
 				"like the old tabchannel from GENESIS, but also presents "
 				"a similar interface as hhchan from GENESIS. ",
-	};	
+	};
 	static Dinfo< MgBlock > dinfo;
 	static Cinfo MgBlockCinfo(
 		"MgBlock",
@@ -87,7 +87,7 @@ static const Cinfo* MgBlockCinfo = MgBlock::initCinfo();
 // Constructor
 ///////////////////////////////////////////////////
 MgBlock::MgBlock()
-	:	Zk_( 0.0 ), 
+	:	Zk_( 0.0 ),
 		KMg_A_( 1.0 ), // These are NOT the same as the A, B state
 		KMg_B_( 1.0 ), // variables used for Exp Euler integration.
 		CMg_( 1.0 ), 	// Conc of Mg in mM
@@ -185,4 +185,3 @@ void MgBlock::origChannel( const Eref& e, double Gk, double Ek )
 ///////////////////////////////////////////////////
 // Unit tests
 ///////////////////////////////////////////////////
-
diff --git a/biophysics/RandSpike.cpp b/biophysics/RandSpike.cpp
index ac5257d2a9699c85a60ca80f3dc4f6e50fd2ac00..0c2e09ffff1825cd06407a8931fd79dd41db58d7 100644
--- a/biophysics/RandSpike.cpp
+++ b/biophysics/RandSpike.cpp
@@ -15,7 +15,7 @@
 	// MsgSrc definitions
 	///////////////////////////////////////////////////////
 static SrcFinfo1< double > *spikeOut() {
-	static SrcFinfo1< double > spikeOut( "spikeOut", 
+	static SrcFinfo1< double > spikeOut( "spikeOut",
 			"Sends out a trigger for an event.");
 	return &spikeOut;
 }
@@ -25,10 +25,10 @@ const Cinfo* RandSpike::initCinfo()
 	///////////////////////////////////////////////////////
 	// Shared message definitions
 	///////////////////////////////////////////////////////
-	static DestFinfo process( "process", 
+	static DestFinfo process( "process",
 		"Handles process call",
 		new ProcOpFunc< RandSpike >( &RandSpike::process ) );
-	static DestFinfo reinit( "reinit", 
+	static DestFinfo reinit( "reinit",
 		"Handles reinit call",
 		new ProcOpFunc< RandSpike >( &RandSpike::reinit ) );
 
@@ -37,10 +37,10 @@ const Cinfo* RandSpike::initCinfo()
 		&process, &reinit
 	};
 
-	static SharedFinfo proc( "proc", 
+	static SharedFinfo proc( "proc",
 		"Shared message to receive Process message from scheduler",
 		processShared, sizeof( processShared ) / sizeof( Finfo* ) );
-		
+
 	//////////////////////////////////////////////////////////////////
 	// Dest Finfos.
 	//////////////////////////////////////////////////////////////////
@@ -48,7 +48,7 @@ const Cinfo* RandSpike::initCinfo()
 	//////////////////////////////////////////////////////////////////
 	// Value Finfos.
 	//////////////////////////////////////////////////////////////////
-	
+
 	static ValueFinfo< RandSpike, double > rate( "rate",
 		"Specifies rate for random spike train. Note that this is"
 		"probabilistic, so the instantaneous rate may differ. "
@@ -72,7 +72,7 @@ const Cinfo* RandSpike::initCinfo()
 		&RandSpike::getFired
 	);
 
-	static Finfo* spikeGenFinfos[] = 
+	static Finfo* spikeGenFinfos[] =
 	{
 		spikeOut(),	// SrcFinfo
 		&proc,		// Shared
@@ -96,7 +96,7 @@ const Cinfo* RandSpike::initCinfo()
 		spikeGenFinfos, sizeof( spikeGenFinfos ) / sizeof( Finfo* ),
 		&dinfo,
                 doc,
-                sizeof(doc)/sizeof(string)                
+                sizeof(doc)/sizeof(string)
 	);
 
 	return &spikeGenCinfo;
@@ -105,7 +105,7 @@ const Cinfo* RandSpike::initCinfo()
 static const Cinfo* spikeGenCinfo = RandSpike::initCinfo();
 
 RandSpike::RandSpike()
-	: 
+	:
 	  rate_( 0.0 ),
 	  realRate_( 0.0 ),
       refractT_(0.0),
@@ -159,11 +159,11 @@ void RandSpike::process( const Eref& e, ProcPtr p )
 	if ( refractT_ > p->currTime - lastEvent_ )
 		return;
 	double prob = realRate_ * p->dt;
-	if ( prob >= 1.0 || prob >= mtrand() ) 
+	if ( prob >= 1.0 || prob >= mtrand() )
 	{
 		lastEvent_ = p->currTime;
 		spikeOut()->send( e, p->currTime );
-		fired_ = true;                    
+		fired_ = true;
 	} else {
         fired_ = false;
 	}
diff --git a/biophysics/ReadSwc.cpp b/biophysics/ReadSwc.cpp
index 69ca680a553654da3d6b16ee7ed783abd618ca4b..6f6f5a2a3a9325533123cef054ee6302edf83585 100644
--- a/biophysics/ReadSwc.cpp
+++ b/biophysics/ReadSwc.cpp
@@ -23,7 +23,6 @@ static const double MinRadius = 0.04;
 
 ReadSwc::ReadSwc( const string& fname )
 {
-	bool verbose = false;
 	ifstream fin( fname.c_str() );
 	if ( !fin ) {
 		cerr << "ReadSwc:: could not open file " << fname << endl;
@@ -59,9 +58,10 @@ ReadSwc::ReadSwc( const string& fname )
 			", # Branches = " << branches_.size() << 
 			". # Segs = " << segs_.size() << 
 			", bad = " << badSegs <<
+			", Validated = " << valid << 
+			", numBranches = " << branches_.size() << 
 			endl;
-	if ( verbose )
-		diagnostics();
+	diagnostics();
 }
 
 bool ReadSwc::validate() const
diff --git a/builtins/Streamer.cpp b/builtins/Streamer.cpp
index fc21fc05612830c7bea3d8af0fa361fa39dc9b53..dd9c0bf2f1ab213981d4f64b737d047bfee96275 100644
--- a/builtins/Streamer.cpp
+++ b/builtins/Streamer.cpp
@@ -136,7 +136,7 @@ static const Cinfo* tableStreamCinfo = Streamer::initCinfo();
 
 // Class function definitions
 
-Streamer::Streamer() 
+Streamer::Streamer()
 {
     // Not all compilers allow initialization during the declaration of class
     // methods.
@@ -176,7 +176,7 @@ void Streamer::reinit(const Eref& e, ProcPtr p)
     }
 
     Clock* clk = reinterpret_cast<Clock*>( Id(1).eref().data() );
-    for (size_t i = 0; i < tableIds_.size(); i++) 
+    for (size_t i = 0; i < tableIds_.size(); i++)
     {
         int tickNum = tableIds_[i].element()->getTick();
         double tick = clk->getTickDt( tickNum );
@@ -206,14 +206,14 @@ void Streamer::reinit(const Eref& e, ProcPtr p)
 
     // Make sure all tables have same dt_ else disable the streamer.
     vector<unsigned int> invalidTables;
-    for (size_t i = 1; i < tableTick_.size(); i++) 
+    for (size_t i = 1; i < tableTick_.size(); i++)
     {
         if( tableTick_[i] != tableTick_[0] )
         {
             LOG( moose::warning
                     , "Table " << tableIds_[i].path()
                     << " has tick (dt) which is different than the first table."
-                    << endl 
+                    << endl
                     << " Got " << tableTick_[i] << " expected " << tableTick_[0]
                     << endl << " Disabling this table."
                     );
@@ -221,7 +221,7 @@ void Streamer::reinit(const Eref& e, ProcPtr p)
         }
     }
 
-    for (size_t i = 0; i < invalidTables.size(); i++) 
+    for (size_t i = 0; i < invalidTables.size(); i++)
     {
         tables_.erase( tables_.begin() + i );
         tableDt_.erase( tableDt_.begin() + i );
@@ -320,7 +320,7 @@ void Streamer::addTables( vector<Id> tables )
 void Streamer::removeTable( Id table )
 {
     int matchIndex = -1;
-    for (size_t i = 0; i < tableIds_.size(); i++) 
+    for (size_t i = 0; i < tableIds_.size(); i++)
         if( table.path() == tableIds_[i].path() )
         {
             matchIndex = i;
@@ -383,7 +383,7 @@ void Streamer::setFormat( string fmt )
 }
 
 /*  Get the format of all tables. */
-string Streamer::getFormat( void ) const 
+string Streamer::getFormat( void ) const
 {
     return format_;
 }
@@ -407,7 +407,7 @@ void Streamer::zipWithTime( )
         {
 #if 0
             LOG( moose::debug
-                    , "Table " << tables_[i]->getName( ) << " is not functional. Filling with zero " 
+                    , "Table " << tables_[i]->getName( ) << " is not functional. Filling with zero "
                     );
 #endif
             tVec.resize( numEntriesInEachTable, 0 );
diff --git a/cmake_modules/FindGSL.cmake b/cmake_modules/FindGSL.cmake
index 99ad9ea8effe8ff7bba87af49978bd14188f9d14..93c2686f78e6fbbdde540e86241d0995934c8813 100644
--- a/cmake_modules/FindGSL.cmake
+++ b/cmake_modules/FindGSL.cmake
@@ -63,34 +63,28 @@ ELSE(WIN32)
         SET(GSL_CBLAS_LIB_NAMES gslcblas)
     ENDIF( )
 
-    if(GSL_ROOT_DIR)
-        message("  Debug: Searching in user given path " )
-        FIND_LIBRARY(GSL_LIB 
-            NAMES ${GSL_LIB_NAMES} 
-            PATHS ${GSL_ROOT_DIR}/lib ${GSL_ROOT_DIR}/lib64
-            NO_DEFAULT_PATH
-            )
-
-        FIND_LIBRARY(GSLCBLAS_LIB 
-            NAMES ${GSL_CBLAS_LIB_NAMES}
-            PATHS ${GSL_ROOT_DIR}/lib ${GSL_ROOT_DIR}/lib64
-            NO_DEFAULT_PATH
-            )
-
-        FIND_PATH(GSL_INCLUDE_DIRS NAMES gsl/gsl_blas.h
-            PATHS ${GSL_ROOT_DIR}/include 
-            NO_DEFAULT_PATH
-            )
-    else( )
-        FIND_LIBRARY(GSL_LIB NAMES ${GSL_LIB_NAMES} )
-        FIND_LIBRARY(GSLCBLAS_LIB NAMES ${GSL_CBLAS_LIB_NAMES})
-        FIND_PATH(GSL_INCLUDE_DIRS NAMES gsl/gsl_blas.h )
-    endif()
+    FIND_LIBRARY(GSL_LIB 
+        NAMES ${GSL_LIB_NAMES} 
+        PATHS 
+            ${GSL_ROOT_DIR}/lib ${GSL_ROOT_DIR}/lib64
+            /opt/lib /opt/lib64
+        )
 
+    FIND_LIBRARY(GSLCBLAS_LIB 
+        NAMES ${GSL_CBLAS_LIB_NAMES}
+        PATHS 
+            ${GSL_ROOT_DIR}/lib ${GSL_ROOT_DIR}/lib64
+            /opt/lib /opt/lib64
+        )
     IF (GSL_LIB AND GSLCBLAS_LIB)
         SET (GSL_LIBRARIES ${GSL_LIB} ${GSLCBLAS_LIB})
     ENDIF (GSL_LIB AND GSLCBLAS_LIB)
 
+    FIND_PATH(GSL_INCLUDE_DIRS NAMES gsl/gsl_blas.h
+        PATHS ${GSL_ROOT_DIR}/include /opt/include 
+        )
+
+
 ENDIF(WIN32)
 
 # FIND version
@@ -106,7 +100,7 @@ endif(GSL_INCLUDE_DIRS)
 
 IF(GSL_LIBRARIES AND GSL_VERSION)
     IF(GSL_INCLUDE_DIRS)
-        MESSAGE(STATUS "Found GSL: ${GSL_INCLUDE_DIRS}, ${GSL_LIBRARIES}")
+        MESSAGE(STATUS "Found GSL ${GSL_LIBRARIES}")
         SET(GSL_FOUND 1)
     ENDIF(GSL_INCLUDE_DIRS)
 ENDIF()
diff --git a/cmake_modules/FindNumPy.cmake b/cmake_modules/FindNumPy.cmake
index 83c74d47b7592276d595d0e32be2a96577a9852a..b2813e9cd2c46a747b3ac31ee2c3459c32db59d0 100644
--- a/cmake_modules/FindNumPy.cmake
+++ b/cmake_modules/FindNumPy.cmake
@@ -52,7 +52,7 @@ if(NOT PYTHONINTERP_FOUND)
     return()
 endif()
 
-execute_process(COMMAND ${PYTHON_EXECUTABLE} -c
+execute_process(COMMAND "${PYTHON_EXECUTABLE}" "-c"
     "import numpy as n; print(n.__version__); print(n.get_include());"
     RESULT_VARIABLE _NUMPY_SEARCH_SUCCESS
     OUTPUT_VARIABLE _NUMPY_VALUES_OUTPUT
diff --git a/device/PulseGen.cpp b/device/PulseGen.cpp
index 2112191a47399821456e93a1dab3b66d9b523cb7..105aa8282b182ecc8255b352f25fea698065f34f 100644
--- a/device/PulseGen.cpp
+++ b/device/PulseGen.cpp
@@ -1,31 +1,31 @@
-// PulseGen.cpp --- 
-// 
+// PulseGen.cpp ---
+//
 // Filename: PulseGen.cpp
-// Description: 
+// Description:
 // Author: Subhasis Ray
-// Maintainer: 
+// Maintainer:
 // Created: Mon Feb 20 01:41:12 2012 (+0530)
-// Version: 
+// Version:
 // Last-Updated: Mon May 27 11:49:31 2013 (+0530)
 //           By: subha
 //     Update #: 170
-// URL: 
-// Keywords: 
-// Compatibility: 
-// 
-// 
-
-// Commentary: 
-// 
-// 
-// 
-// 
+// URL:
+// Keywords:
+// Compatibility:
+//
+//
+
+// Commentary:
+//
+//
+//
+//
 
 // Change log:
-// 
+//
 // 2012-02-20 01:41:16 (+0530) - Subha - started porting from old
 // moose.
-// 
+//
 
 // Code:
 
@@ -62,7 +62,7 @@ const Cinfo* PulseGen::initCinfo()
     static ValueFinfo< PulseGen, double > firstDelay("firstDelay",
                                                      "Delay to start of the first pulse in a sequence",
                                                      &PulseGen::setFirstDelay,
-                                                     &PulseGen::getFirstDelay); 
+                                                     &PulseGen::getFirstDelay);
     static ValueFinfo< PulseGen, double > secondLevel("secondLevel",
                                                      "Amplitude of the second pulse in a sequence",
                                                      &PulseGen::setSecondLevel,
@@ -112,7 +112,7 @@ const Cinfo* PulseGen::initCinfo()
     static DestFinfo delayIn("delayIn",
                              "Handle delay value coming from other objects",
                              new OpFunc2< PulseGen, unsigned int, double >(&PulseGen::setDelay));
-    
+
     static DestFinfo input("input",
                            "Handle incoming input that determines gating/triggering onset. "
                            "Note that although this is a double field, the underlying field is"
@@ -131,7 +131,7 @@ const Cinfo* PulseGen::initCinfo()
             {
 		&process, &reinit
             };
-    
+
     static SharedFinfo proc( "proc",
                              "This is a shared message to receive Process messages "
                              "from the scheduler objects."
@@ -169,7 +169,7 @@ const Cinfo* PulseGen::initCinfo()
         "Name", "PulseGen",
         "Author", "Subhasis Ray",
         "Description", "PulseGen: general purpose pulse generator. This can generate any "
-        "number of pulses with specified level and duration.",        
+        "number of pulses with specified level and duration.",
     };
     static Dinfo<PulseGen> dinfo;
     static Cinfo pulseGenCinfo("PulseGen",
@@ -179,8 +179,8 @@ const Cinfo* PulseGen::initCinfo()
                                &dinfo,
                                doc,
                                sizeof(doc)/sizeof(string));
-    return & pulseGenCinfo;    
-    
+    return & pulseGenCinfo;
+
 }
 
 static const Cinfo* pulseGenCinfo = PulseGen::initCinfo();
@@ -211,32 +211,32 @@ PulseGen::~PulseGen()
 
 void PulseGen::setFirstLevel( double level)
 {
-    level_[0] = level;    
+    level_[0] = level;
 }
 
 double PulseGen::getFirstLevel() const
 {
     return level_[0];
 }
-    
+
 void PulseGen::setFirstWidth(double width)
 {
-    width_[0] = width;    
+    width_[0] = width;
 }
 
 double PulseGen::getFirstWidth() const
 {
-    return width_[0];    
+    return width_[0];
 }
 void PulseGen::setFirstDelay( double delay)
 {
-    delay_[0] = delay;    
+    delay_[0] = delay;
 }
 double PulseGen::getFirstDelay() const
 {
     return delay_[0];
 }
-    
+
 void PulseGen::setSecondLevel( double level)
 {
     if (level_.size() >= 2){
@@ -284,15 +284,15 @@ double PulseGen::getSecondDelay() const
 
 void PulseGen::setBaseLevel( double level)
 {
-    baseLevel_ = level;    
+    baseLevel_ = level;
 }
 double PulseGen::getBaseLevel() const
 {
-    return baseLevel_;    
+    return baseLevel_;
 }
 void PulseGen::setTrigMode(unsigned int mode)
 {
-    trigMode_ = mode;    
+    trigMode_ = mode;
 }
 unsigned int PulseGen::getTrigMode() const
 {
@@ -326,7 +326,7 @@ void PulseGen::setCount(unsigned int count)
 
 unsigned int PulseGen::getCount() const
 {
-    return level_.size();        
+    return level_.size();
 }
 
 double PulseGen::getLevel(unsigned int index) const
@@ -338,7 +338,7 @@ double PulseGen::getLevel(unsigned int index) const
         return 0.0;
     }
 }
-    
+
 void PulseGen::setLevel( unsigned int index, double level)
 {
     if (index < level_.size()){
@@ -413,7 +413,7 @@ void PulseGen::process(const Eref& e, ProcPtr p )
         case PulseGen::EXT_TRIG:
             if (input_ == 0){
                 if (trigTime_ < 0){
-                    phase = period;                
+                    phase = period;
                 }else{
                     phase = currentTime - trigTime_;
                 }
@@ -423,7 +423,7 @@ void PulseGen::process(const Eref& e, ProcPtr p )
                 }
                 phase = currentTime - trigTime_;
             }
-            prevInput_ = input_;            
+            prevInput_ = input_;
             break;
         case PulseGen::EXT_GATE:
             if(input_ == 0)
@@ -431,7 +431,7 @@ void PulseGen::process(const Eref& e, ProcPtr p )
                 phase = period;		/* output = baselevel */
             }
             else
-            {				/* gate high */ 
+            {				/* gate high */
                 if(prevInput_ == 0)
                 {	/* low -> high */
                     trigTime_ = currentTime;
@@ -443,7 +443,7 @@ void PulseGen::process(const Eref& e, ProcPtr p )
         default:
             cerr << "ERROR: PulseGen::newProcessFunc( const Conn* , ProcInfo ) - invalid triggerMode - " << trigMode_ << endl;
     }
-    if (phase >= period){ // we have crossed all pulses 
+    if (phase >= period){ // we have crossed all pulses
         output_ = baseLevel_;
         return;
     }
@@ -468,9 +468,9 @@ void PulseGen::reinit(const Eref& e, ProcPtr p)
     trigTime_ = -1;
     prevInput_ = 0;
     output_ = baseLevel_;
-    input_ = 0;    
+    input_ = 0;
     outputOut()->send(e, output_);
 }
 
-// 
+//
 // PulseGen.cpp ends here
diff --git a/examples/Ex.cpp b/examples/Ex.cpp
index f10cdc49bb21a08936cf752c0c0d084181225e94..49fb32e2b0113e675f73ae3e53a23e07aa864931 100644
--- a/examples/Ex.cpp
+++ b/examples/Ex.cpp
@@ -84,7 +84,7 @@ const Cinfo* Ex::initCinfo()
 	
 	static SharedFinfo proc(
 		"proc",
-		"Shared message to receive Process messages",
+		"Handles 'reinit' and 'process' calls from a clock.",
 		processShared,
 		sizeof(processShared) / sizeof(Finfo*)
 	);
diff --git a/examples/Example.cpp b/examples/Example.cpp
index 83897eed33ac09b7c00043e777c56e07434701b4..de4a4d155f1ec9d65184c6e01b0656939d0ffec3 100644
--- a/examples/Example.cpp
+++ b/examples/Example.cpp
@@ -61,7 +61,7 @@ const Cinfo* Example::initCinfo(){
         &process, &reinit
     };
     static SharedFinfo proc( "proc",
-        "Shared message for process and reinit",
+        "Handles 'reinit' and 'process' calls from a clock.",
         procShared, sizeof( procShared ) / sizeof( const Finfo* )
     );
 
diff --git a/hsolve/HSolve.cpp b/hsolve/HSolve.cpp
index 2adad4f54ab7bb7668209728703343f904175531..05d5ff8ecbe3bb3e0b35d71f806faf49826e6922 100644
--- a/hsolve/HSolve.cpp
+++ b/hsolve/HSolve.cpp
@@ -533,4 +533,3 @@ void testHSolvePassiveSingleComp()
 
 
 #endif // if 0
-
diff --git a/kinetics/BufPool.cpp b/kinetics/BufPool.cpp
index 54e183780a6f76fcb1614878e70e02981b28ae25..230be5d6cebbb52abe1df35e25b93fcac4faee25 100644
--- a/kinetics/BufPool.cpp
+++ b/kinetics/BufPool.cpp
@@ -78,6 +78,7 @@ void BufPool::vSetConcInit( const Eref& e, double conc )
 	vSetConc( e, conc );
 }
 
+
 //////////////////////////////////////////////////////////////
 // MsgDest Definitions
 //////////////////////////////////////////////////////////////
@@ -96,4 +97,3 @@ void BufPool::vReinit( const Eref& e, ProcPtr p )
 //////////////////////////////////////////////////////////////
 // Field Definitions
 //////////////////////////////////////////////////////////////
-
diff --git a/kinetics/CplxEnzBase.cpp b/kinetics/CplxEnzBase.cpp
index 2b1498a901610f20ffbf2b0d01ebfec960a95a74..361f672fff1616d1c890107d59be25e59a5ba6ca 100644
--- a/kinetics/CplxEnzBase.cpp
+++ b/kinetics/CplxEnzBase.cpp
@@ -14,16 +14,16 @@
 #include "CplxEnzBase.h"
 
 static SrcFinfo2< double, double > *enzOut() {
-	static SrcFinfo2< double, double > enzOut( 
-			"enzOut", 
+	static SrcFinfo2< double, double > enzOut(
+			"enzOut",
 			"Sends out increment of molecules on product each timestep"
 			);
 	return &enzOut;
 }
 
 static SrcFinfo2< double, double > *cplxOut() {
-	static SrcFinfo2< double, double > cplxOut( 
-			"cplxOut", 
+	static SrcFinfo2< double, double > cplxOut(
+			"cplxOut",
 			"Sends out increment of molecules on product each timestep"
 			);
 	return &cplxOut;
@@ -40,8 +40,8 @@ DestFinfo* enzDest()
 }
 
 /*
-static DestFinfo* enzDest = 
-	dynamic_cast< DestFinfo* >( 
+static DestFinfo* enzDest =
+	dynamic_cast< DestFinfo* >(
 			const_cast< Finfo* >(
 			EnzBase::initCinfo()->findFinfo( "enzDest" ) ) );
 			*/
@@ -142,11 +142,11 @@ const Cinfo* CplxEnzBase::initCinfo()
 		&cplx,				// SharedFinfo
 	};
 
-	static string doc[] = 
+	static string doc[] =
 	{
 			"Name", "CplxEnzBase",
 			"Author", "Upi Bhalla",
-			"Description:", 
+			"Description:",
 			"Base class for mass-action enzymes in which there is an "
 			" explicit pool for the enzyme-substrate complex. "
  			"It models the reaction: "
@@ -264,7 +264,7 @@ void CplxEnzBase::zombify( Element* orig, const Cinfo* zClass, Id solver )
 	vector< double > kcat( num, 0.0 );
 	for ( unsigned int i = 0; i < num; ++i ) {
 		Eref er( orig, i + start );
-		const CplxEnzBase* ceb = 
+		const CplxEnzBase* ceb =
 			reinterpret_cast< const CplxEnzBase* >( er.data() );
 		concK1[ i ] = ceb->getConcK1( er );
 		k2[ i ] = ceb->getK2( er );
diff --git a/kinetics/Enz.cpp b/kinetics/Enz.cpp
index 785553943c7001a97b0479a00ebcc386b1f286db..2362c0b32eb83ce2247021aa762da822b0163776 100644
--- a/kinetics/Enz.cpp
+++ b/kinetics/Enz.cpp
@@ -115,7 +115,7 @@ void Enz::vProcess( const Eref& e, ProcPtr p )
 	cplxOut->send( e, r1_, r3_ + r2_ );
 
 	// cout << "	proc: " << r1_ << ", " << r2_ << ", " << r3_ << endl;
-	
+
 	r1_ = k1_;
 }
 
@@ -181,7 +181,7 @@ double Enz::vGetKcat( const Eref& e ) const
 void Enz::vSetKm( const Eref& e, double v )
 {
 	Km_ = v;
-	double volScale = 
+	double volScale =
 		convertConcToNumRateUsingMesh( e, subOut, 1 );
 	k1_ = ( k2_ + k3_ ) / ( v * volScale );
 }
@@ -207,7 +207,7 @@ double Enz::vGetNumKm( const Eref& e ) const
 void Enz::vSetRatio( const Eref& e, double v )
 {
 	k2_ = v * k3_;
-	double volScale = 
+	double volScale =
 		convertConcToNumRateUsingMesh( e, subOut, 1 );
 
 	k1_ = ( k2_ + k3_ ) / ( Km_ * volScale );
@@ -237,4 +237,3 @@ double Enz::vGetConcK1( const Eref& e ) const
 	}
 	return ( k2_ + k3_ ) / Km_;
 }
-
diff --git a/kinetics/EnzBase.cpp b/kinetics/EnzBase.cpp
index 76a726f1d04b5edf77f9de59b5678b8aeabfd310..0c4c136ceae179987e213bdcf60aa89d1bc21198 100644
--- a/kinetics/EnzBase.cpp
+++ b/kinetics/EnzBase.cpp
@@ -15,16 +15,16 @@
 #define EPSILON 1e-15
 
 static SrcFinfo2< double, double > *subOut() {
-	static SrcFinfo2< double, double > subOut( 
-			"subOut", 
+	static SrcFinfo2< double, double > subOut(
+			"subOut",
 			"Sends out increment of molecules on product each timestep"
 			);
 	return &subOut;
 }
 
 static SrcFinfo2< double, double > *prdOut() {
-	static SrcFinfo2< double, double > prdOut( 
-			"prdOut", 
+	static SrcFinfo2< double, double > prdOut(
+			"prdOut",
 			"Sends out increment of molecules on product each timestep"
 			);
 	return &prdOut;
@@ -132,7 +132,7 @@ const Cinfo* EnzBase::initCinfo()
 		&remesh,			// Destfinfo
 	};
 
-	static string doc[] = 
+	static string doc[] =
 	{
 		"Name", "EnzBase",
 		"Author", "Upi Bhalla",
@@ -253,7 +253,7 @@ double EnzBase::getKcat( const Eref& e ) const
 
 unsigned int EnzBase::getNumSub( const Eref& e ) const
 {
-	const vector< MsgFuncBinding >* mfb = 
+	const vector< MsgFuncBinding >* mfb =
 		e.element()->getMsgAndFunc( subOut()->getBindIndex() );
 	assert( mfb );
 	return ( mfb->size() );
@@ -285,7 +285,7 @@ void EnzBase::zombify( Element* orig, const Cinfo* zClass, Id solver )
 	vector< double > kcat( num, 0.0 );
 	for ( unsigned int i = 0; i < num; ++i ) {
 		Eref er( orig, i + start );
-		const EnzBase* eb = 
+		const EnzBase* eb =
 			reinterpret_cast< const EnzBase* >( er.data() );
 		kcat[ i ] = eb->getKcat( er );
 		Km[ i ] = eb->getKm( er );
@@ -305,4 +305,3 @@ void EnzBase::setSolver( Id solver, Id orig )
 {
 	;
 }
-
diff --git a/kinetics/Pool.cpp b/kinetics/Pool.cpp
index f39b1af84b766a41256edc2339c2d67977cb2a8b..86508cf4429f043e47483bbd419c88f2917d496b 100644
--- a/kinetics/Pool.cpp
+++ b/kinetics/Pool.cpp
@@ -20,21 +20,54 @@ const Cinfo* Pool::initCinfo()
 		//////////////////////////////////////////////////////////////
 		// Field Definitions: All inherited from PoolBase.
 		//////////////////////////////////////////////////////////////
+		static ElementValueFinfo< Pool, bool > isBuffered(
+			"isBuffered",
+			"Flag: True if Pool is buffered. This field changes the "
+			"type of the Pool object to BufPool, or vice versa. "
+			"None of the messages are affected. "
+			"This object class flip can only be done in the non-zombified "
+			"form of the Pool.",
+			&Pool::setIsBuffered,
+			&Pool::getIsBuffered
+		);
+
 		//////////////////////////////////////////////////////////////
-		// MsgDest Definitions: All inherited
+		// MsgDest Definitions: All but increment and decrement inherited
 		//////////////////////////////////////////////////////////////
+		static DestFinfo increment( "increment",
+			"Increments mol numbers by specified amount. Can be +ve or -ve",
+			new OpFunc1< Pool, double >( &Pool::increment )
+		);
+
+		static DestFinfo decrement( "decrement",
+			"Decrements mol numbers by specified amount. Can be +ve or -ve",
+			new OpFunc1< Pool, double >( &Pool::decrement )
+		);
+
+		static DestFinfo nIn( "nIn",
+			"Set the number of molecules by specified amount",
+			new OpFunc1< Pool, double >( &Pool::nIn )
+		);
+
 		//////////////////////////////////////////////////////////////
 		// SrcFinfo Definitions: All inherited.
 		//////////////////////////////////////////////////////////////
 		//////////////////////////////////////////////////////////////
 		// SharedMsg Definitions: All inherited.
 		//////////////////////////////////////////////////////////////
+	static Finfo* poolFinfos[] = {
+		&isBuffered,		// ElementValueFinfo
+		&increment,			// DestFinfo
+		&decrement,			// DestFinfo
+        &nIn,				// DestFinfo
+	};
+
 	static Dinfo< Pool > dinfo;
 	static Cinfo poolCinfo (
 		"Pool",
 		PoolBase::initCinfo(),
-		0,
-		0,
+		poolFinfos,
+		sizeof( poolFinfos ) / sizeof ( Finfo* ),
 		&dinfo
 	);
 
@@ -45,8 +78,8 @@ const Cinfo* Pool::initCinfo()
 // Class definitions
 //////////////////////////////////////////////////////////////
 static const Cinfo* poolCinfo = Pool::initCinfo();
-const SrcFinfo1< double >& nOut = 
-	*dynamic_cast< const SrcFinfo1< double >* >( 
+const SrcFinfo1< double >& nOut =
+	*dynamic_cast< const SrcFinfo1< double >* >(
 	poolCinfo->findFinfo( "nOut" ) );
 
 Pool::Pool()
@@ -62,13 +95,13 @@ Pool::~Pool()
 /**
  * setIsBuffered is a really nasty operation, made possible only because
  * BufPool is derived from Pool and has no other fields.
- * It uses a low-level replaceCinfo call to just change the 
+ * It uses a low-level replaceCinfo call to just change the
  * identity of the Cinfo used, leaving everything else as is.
  */
-void Pool::vSetIsBuffered( const Eref& e, bool v )
+void Pool::setIsBuffered( const Eref& e, bool v )
 {
 	static const Cinfo* bufPoolCinfo = Cinfo::find( "BufPool" );
-	if (vGetIsBuffered( e ) == v)
+	if (getIsBuffered( e ) == v)
 		return;
 	if (v) {
 		e.element()->replaceCinfo( bufPoolCinfo );
@@ -77,11 +110,8 @@ void Pool::vSetIsBuffered( const Eref& e, bool v )
 	}
 }
 
-bool Pool::vGetIsBuffered( const Eref& e ) const
+bool Pool::getIsBuffered( const Eref& e ) const
 {
-	/// We need this explicit check because when the moose class is
-	/// flipped, the internal C++ class isn't.
-	/// Inherited by BufPool.
 	return e.element()->cinfo()->name() == "BufPool";
 }
 
@@ -95,6 +125,14 @@ void Pool::vProcess( const Eref& e, ProcPtr p )
 {
 	// double A = e.sumBuf( aSlot );
 	// double B = e.sumBuf( bSlot );
+		/*
+	if ( n_ < 0 )
+		cout << "nugh" << e.objId().path() << endl;
+	if ( B_ < 0 )
+		cout << "bugh" << e.objId().path() << endl;
+	if ( p->dt < 0 )
+		cout << "tugh" << e.objId().path() << endl;
+		*/
 
 	if ( n_ > EPSILON && B_ > EPSILON ) {
 		double C = exp( -B_ * p->dt / n_ );
@@ -124,7 +162,7 @@ void Pool::vReac( double A, double B )
 	B_ += B;
 }
 
-void Pool::vIncrement( double val )
+void Pool::increment( double val )
 {
 	if ( val > 0 )
 		A_ += val;
@@ -132,7 +170,7 @@ void Pool::vIncrement( double val )
 		B_ -= val;
 }
 
-void Pool::vDecrement( double val )
+void Pool::decrement( double val )
 {
 	if ( val < 0 )
 		A_ -= val;
@@ -140,13 +178,37 @@ void Pool::vDecrement( double val )
 		B_ += val;
 }
 
-void Pool::vnIn( double val)
+void Pool::nIn( double val)
 {
     n_ = val;
     B_ = 0;
     A_ = 0;
 }
 
+/*
+void Pool::vRemesh( const Eref& e,
+	double oldvol,
+	unsigned int numTotalEntries, unsigned int startEntry,
+	const vector< unsigned int >& localIndices,
+	const vector< double >& vols )
+{
+	if ( e.dataIndex() != 0 )
+		return;
+	Neutral* n = reinterpret_cast< Neutral* >( e.data() );
+	assert( vols.size() > 0 );
+	double concInit = nInit_ / ( NA * oldvol );
+	if ( vols.size() != e.element()->dataHandler()->localEntries() )
+		n->setLastDimension( e, q, vols.size() );
+	// Note that at this point the Pool pointer may be invalid!
+	// But we need to update the concs anyway.
+	assert( e.element()->dataHandler()->localEntries() == vols.size() );
+	Pool* pooldata = reinterpret_cast< Pool* >( e.data() );
+	for ( unsigned int i = 0; i < vols.size(); ++i ) {
+		pooldata[i].nInit_ = pooldata[i].n_ = concInit * vols[i] * NA;
+	}
+}
+*/
+
 void Pool::vHandleMolWt( const Eref& e, double v )
 {
 	; // Here I should update DiffConst too.
@@ -177,7 +239,7 @@ double Pool::vGetNinit( const Eref& e ) const
 }
 
 // Conc is given in millimolar. Volume is in m^3
-void Pool::vSetConc( const Eref& e, double c ) 
+void Pool::vSetConc( const Eref& e, double c )
 {
 	n_ = NA * c * lookupVolumeFromMesh( e );
 }
diff --git a/kinetics/Pool.h b/kinetics/Pool.h
index 4a6b2d3ca761c2316cb79977dbe59a93b1adbb99..dec4dfa4f136057f79545254448ff89fa2d53227 100644
--- a/kinetics/Pool.h
+++ b/kinetics/Pool.h
@@ -57,8 +57,8 @@ class Pool: public PoolBase
 		/**
 		 * Functions to examine and change class between Pool and BufPool.
 		 */
-		void vSetIsBuffered( const Eref& e, bool v );
-		bool vGetIsBuffered( const Eref& e) const;
+		void setIsBuffered( const Eref& e, bool v );
+		bool getIsBuffered( const Eref& e ) const;
 
 		//////////////////////////////////////////////////////////////////
 		// Dest funcs. These too override virtual funcs in the Pool base 
@@ -69,13 +69,13 @@ class Pool: public PoolBase
 		void vProcess( const Eref& e, ProcPtr p );
 		void vReinit( const Eref& e, ProcPtr p );
 		void vReac( double A, double B );
-		void vIncrement( double val );
-		void vDecrement( double val );
-        void vnIn( double val );
 
 		//////////////////////////////////////////////////////////////////
 		// Novel Dest funcs not present in Pool base class.
 		//////////////////////////////////////////////////////////////////
+		void increment( double val );
+		void decrement( double val );
+                void nIn( double val );
 
 		//////////////////////////////////////////////////////////////////
 		static const Cinfo* initCinfo();
diff --git a/kinetics/PoolBase.cpp b/kinetics/PoolBase.cpp
index 0324c05e728e31b9bb97cb9375c103515ffa1bcb..b67e70cf7001372b166554d67311daadbfe7475e 100644
--- a/kinetics/PoolBase.cpp
+++ b/kinetics/PoolBase.cpp
@@ -84,18 +84,6 @@ const Cinfo* PoolBase::initCinfo()
 			&PoolBase::getSpecies
 		);
 
-		static ElementValueFinfo< PoolBase, bool > isBuffered(
-			"isBuffered",
-			"Flag: True if Pool is buffered. "
-			"In the case of Pool and BufPool the field can be assigned, to "
-			"change the type of the Pool object to BufPool, or vice versa. "
-			"None of the messages are affected. "
-			"This object class flip can only be done in the non-zombified "
-			"form of the Pool/BufPool. In Zombies it is read-only.",
-			&PoolBase::setIsBuffered,
-			&PoolBase::getIsBuffered
-		);
-
 		//////////////////////////////////////////////////////////////
 		// MsgDest Definitions
 		//////////////////////////////////////////////////////////////
@@ -116,36 +104,18 @@ const Cinfo* PoolBase::initCinfo()
 			"Should only be used in SharedMsg with species.",
 			new EpFunc1< PoolBase, double >( &PoolBase::handleMolWt )
 		);
-		//////////////////////////////////////////////////////////////
-		// MsgDest Definitions: These three are used for non-reaction 
-		// calculations involving algebraically defined rate terms.
-		//////////////////////////////////////////////////////////////
-		static DestFinfo increment( "increment",
-			"Increments mol numbers by specified amount. Can be +ve or -ve",
-			new OpFunc1< PoolBase, double >( &PoolBase::increment )
-		);
-
-		static DestFinfo decrement( "decrement",
-			"Decrements mol numbers by specified amount. Can be +ve or -ve",
-			new OpFunc1< PoolBase, double >( &PoolBase::decrement )
-		);
-
-		static DestFinfo nIn( "nIn",
-			"Assigns the number of molecules in Pool to specified value",
-			new OpFunc1< PoolBase, double >( &PoolBase::nIn )
-		);
 
 		//////////////////////////////////////////////////////////////
 		// SrcFinfo Definitions
 		//////////////////////////////////////////////////////////////
 
-		static SrcFinfo1< double > nOut( 
-				"nOut", 
+		static SrcFinfo1< double > nOut(
+				"nOut",
 				"Sends out # of molecules in pool on each timestep"
 		);
 
-		static SrcFinfo0 requestMolWt( 
-				"requestMolWt", 
+		static SrcFinfo0 requestMolWt(
+				"requestMolWt",
 				"Requests Species object for mol wt"
 		);
 
@@ -185,16 +155,12 @@ const Cinfo* PoolBase::initCinfo()
 		&concInit,	// Value
 		&volume,	// Readonly Value
 		&speciesId,	// Value
-		&isBuffered,	// Value
-		&increment,			// DestFinfo
-		&decrement,			// DestFinfo
-        &nIn,				// DestFinfo
 		&reac,				// SharedFinfo
 		&proc,				// SharedFinfo
 		&species,			// SharedFinfo
 	};
 
-	static string doc[] = 
+	static string doc[] =
 	{
 		"Name", "PoolBase",
 		"Author", "Upi Bhalla",
@@ -242,21 +208,6 @@ void PoolBase::reinit( const Eref& e, ProcPtr p )
 	vReinit( e, p );
 }
 
-void PoolBase::increment( double val )
-{
-	vIncrement(val);
-}
-
-void PoolBase::decrement( double val )
-{
-	vDecrement( val );
-}
-
-void PoolBase::nIn( double val)
-{
-	vnIn(val);
-}
-
 void PoolBase::reac( double A, double B )
 {
 	vReac( A, B );
@@ -283,15 +234,6 @@ void PoolBase::vReac( double A, double B )
 void PoolBase::vHandleMolWt( const Eref& e, double v )
 {;}
 
-void PoolBase::vIncrement( double val )
-{;}
-
-void PoolBase::vDecrement( double val )
-{;}
-
-void PoolBase::vnIn( double val)
-{;}
-
 //////////////////////////////////////////////////////////////
 // Field Definitions
 //////////////////////////////////////////////////////////////
@@ -318,7 +260,7 @@ double PoolBase::getNinit( const Eref& e ) const
 }
 
 // Conc is given in millimolar. Volume is in m^3
-void PoolBase::setConc( const Eref& e, double c ) 
+void PoolBase::setConc( const Eref& e, double c )
 {
 	vSetConc( e, c );
 }
@@ -386,19 +328,6 @@ unsigned int PoolBase::getSpecies( const Eref& e ) const
 	return vGetSpecies( e );
 }
 
-/**
- * setIsBuffered is active only for Pool and BufPool. Otherwise ignored.
- */
-void PoolBase::setIsBuffered( const Eref& e, bool v )
-{
-	vSetIsBuffered( e, v );
-}
-
-bool PoolBase::getIsBuffered( const Eref& e ) const
-{
-	return vGetIsBuffered( e );
-}
-
 //////////////////////////////////////////////////////////////
 // Virtual Field Definitions
 //////////////////////////////////////////////////////////////
@@ -412,10 +341,6 @@ double PoolBase::vGetMotorConst(const Eref& e ) const
 	return 0.0;
 }
 
-/// Dummy default function for most pool subclasses.
-void PoolBase::vSetIsBuffered( const Eref& e, bool v )
-{;}
-
 //////////////////////////////////////////////////////////////
 // Zombie conversion routine: Converts Pool subclasses. There
 // will typically be a target specific follow-up function, for example,
@@ -423,7 +348,7 @@ void PoolBase::vSetIsBuffered( const Eref& e, bool v )
 // There should also be a subsequent call to resched for the entire tree.
 //////////////////////////////////////////////////////////////
 // static func
-void PoolBase::zombify( Element* orig, const Cinfo* zClass, 
+void PoolBase::zombify( Element* orig, const Cinfo* zClass,
 				Id ksolve, Id dsolve )
 {
 	if ( orig->cinfo() == zClass )
@@ -438,7 +363,7 @@ void PoolBase::zombify( Element* orig, const Cinfo* zClass,
 	vector< double > motorConst( num, 0.0 );
 	for ( unsigned int i = 0; i < num; ++i ) {
 		Eref er( orig, i + start );
-		const PoolBase* pb = 
+		const PoolBase* pb =
 			reinterpret_cast< const PoolBase* >( er.data() );
 		species[ i ] = pb->getSpecies( er );
 		concInit[ i ] = pb->getConcInit( er );
diff --git a/kinetics/PoolBase.h b/kinetics/PoolBase.h
index 1bdf0a7822401ef52da6fb8ff7962f521796c18b..ace7ae86924b2b0680a837501d6aea5ff2942591 100644
--- a/kinetics/PoolBase.h
+++ b/kinetics/PoolBase.h
@@ -68,11 +68,6 @@ class PoolBase
 
 		void setSpecies( const Eref& e, SpeciesId v );
 		SpeciesId getSpecies( const Eref& e ) const;
-		/**
-		 * Functions to examine and change class between Pool and BufPool.
-		 */
-		void setIsBuffered( const Eref& e, bool v );
-		bool getIsBuffered( const Eref& e ) const;
 		
 		//////////////////////////////////////////////////////////////////
 		// Here are the inner virtual funcs for fields. 
@@ -96,9 +91,6 @@ class PoolBase
 		virtual void vSetVolume( const Eref& e, double v ) = 0;
 		virtual void vSetSpecies( const Eref& e, SpeciesId v ) = 0;
 		virtual SpeciesId vGetSpecies( const Eref& e ) const = 0;
-		/// I put in a default empty function for vSetIsBuffered.
-		virtual void vSetIsBuffered( const Eref& e, bool v );
-		virtual bool vGetIsBuffered( const Eref& e) const = 0;
 		/**
 		 * Assign whatever info is needed by the zombie based on the
 		 * solver Element. Encapsulates some unpleasant field extraction,
@@ -134,9 +126,6 @@ class PoolBase
 		void reinit( const Eref& e, ProcPtr p );
 		void reac( double A, double B );
 		void handleMolWt( const Eref& e, double v );
-		void increment( double val );
-		void decrement( double val );
-        void nIn( double val );
 
 		//////////////////////////////////////////////////////////////////
 		// Virtual Dest funcs. Most of these have a generic do-nothing
@@ -147,9 +136,6 @@ class PoolBase
 		virtual void vReinit( const Eref& e, ProcPtr p );
 		virtual void vReac( double A, double B );
 		virtual void vHandleMolWt( const Eref& e, double v);
-		virtual void vIncrement( double val );
-		virtual void vDecrement( double val );
-        virtual void vnIn( double val );
 
 		//////////////////////////////////////////////////////////////////
 		static const Cinfo* initCinfo();
diff --git a/kinetics/Reac.cpp b/kinetics/Reac.cpp
index 2b094578d309271b34e2cf59bc95ad4ddd3dc9ca..0f680cd536bf346b2d05440fd6df91831c36cb54 100644
--- a/kinetics/Reac.cpp
+++ b/kinetics/Reac.cpp
@@ -14,6 +14,7 @@
 #include "Reac.h"
 
 #define EPSILON 1e-15
+
 const Cinfo* Reac::initCinfo()
 {
 		//////////////////////////////////////////////////////////////
diff --git a/kinetics/ReadCspace.cpp b/kinetics/ReadCspace.cpp
index de0cef3e2889324163b1d9f219f53fad31527152..86b1f3f036b24455d2d2f6ee9a48d0ea19448d19 100644
--- a/kinetics/ReadCspace.cpp
+++ b/kinetics/ReadCspace.cpp
@@ -109,7 +109,7 @@ Id ReadCspace::readModelString( const string& model,
 	// SetGet2< double, unsigned int >::set( compt_, "buildDefaultMesh",     1e-18, 1 );
 	string temp = model.substr( pos + 1 );
 	pos = temp.find_first_of( " 	\n" );
-	
+
 	for (unsigned long i = 0 ; i < temp.length() && i < pos; i += 5 ) {
 		build( temp.c_str() + i );
 		if ( temp[ i + 4 ] != '|' )
@@ -151,7 +151,7 @@ void ReadCspace::makePlots( double plotdt )
     		Id tab = shell->doCreate( "Table2", graphs, plotname, 1 );
 			assert( tab != Id() );
 			// cout << "ReadCspace made plot " << plotname << endl;
-			ObjId mid = shell->doAddMsg( "Single", 
+			ObjId mid = shell->doAddMsg( "Single",
 				tab, "requestOut", children[i], "getConc" );
 			assert( mid != ObjId() );
 		}
@@ -160,7 +160,7 @@ void ReadCspace::makePlots( double plotdt )
     shell->doSetClock( 8, plotdt );
 
     string plotpath = basepath + "/graphs/##[TYPE=Table2]";
-    shell->doUseClock( plotpath, "process", 8 ); 
+    shell->doUseClock( plotpath, "process", 8 );
 	*/
 }
 
@@ -181,33 +181,33 @@ void ReadCspace::makePlots( double plotdt )
 //        else if (line == "A --B--> B + C") type = 'L';
 /////////////////////////////////////////////////////////////////////
 
-void ReadCspace::expandEnzyme( 
+void ReadCspace::expandEnzyme(
 	const char* name, int e, int s, int p, int p2 )
 {
 	static Shell* shell = reinterpret_cast< Shell* >( Id().eref().data() );
 
 	Id enzMolId = mol_[ name[e] - 'a' ];
-	
+
 	Id enzId = shell->doCreate( "Enz", enzMolId, name, 1 );
 	assert( enzId != Id() );
 	string cplxName = name;
 	cplxName += "_cplx";
 	Id cplxId = shell->doCreate( "Pool", enzId, cplxName, 1 );
 	assert( cplxId != Id() );
-	ObjId ret = shell->doAddMsg( "OneToOne", 
+	ObjId ret = shell->doAddMsg( "OneToOne",
 		enzId, "cplx", cplxId, "reac" );
 
-	ret = shell->doAddMsg( "OneToOne", 
+	ret = shell->doAddMsg( "OneToOne",
 		enzMolId, "reac", enzId, "enz" );
 
-	ret = shell->doAddMsg( "OneToOne", 
+	ret = shell->doAddMsg( "OneToOne",
 		mol_[ name[ s ] - 'a' ], "reac", enzId, "sub" );
 
-	ret = shell->doAddMsg( "OneToOne", 
+	ret = shell->doAddMsg( "OneToOne",
 		mol_[ name[ p ] - 'a' ], "reac", enzId, "prd" );
 
 	if ( p2 != 0 )
-		ret = shell->doAddMsg( "OneToOne", 
+		ret = shell->doAddMsg( "OneToOne",
 			mol_[ name[ p2 ] - 'a' ], "reac", enzId, "prd" );
 
 	assert( ret != ObjId() );
@@ -226,12 +226,12 @@ void ReadCspace::expandReaction( const char* name, int nm1 )
 	int i;
 
 	Id reacId = s->doCreate( "Reac", compt_, name, 1 );
-	
+
 	// A is always a substrate
 	for (i = 0; i < nm1; i++ ) {
 		s->doAddMsg( "OneToOne", reacId, "sub", mol_[ name[1] - 'a' ], "reac" );
 	}
-		
+
 	if ( name[0] < 'G' ) { // B is a product
 		s->doAddMsg( "OneToOne", reacId, "prd", mol_[ name[2] - 'a' ], "reac" );
 	} else { // B is a substrate
@@ -308,7 +308,7 @@ void ReadCspace::makeMolecule( char name )
 	unsigned int index = 1 + name - 'a';
 
 	// Put in molecule if it is a new one.
-	if ( find( molseq_.begin(), molseq_.end(), index - 1 ) == 
+	if ( find( molseq_.begin(), molseq_.end(), index - 1 ) ==
 					molseq_.end() )
 			molseq_.push_back( index - 1 );
 
@@ -444,7 +444,7 @@ void ReadCspace::testReadModel( )
 		Id temp( path );
 		r1 = Field< double >::get( temp, "Kf");
 		r2 = Field< double >::get( temp, "Kb");
-		assert( doubleEq( r1, i* 100 + 101 ) && 
+		assert( doubleEq( r1, i* 100 + 101 ) &&
 			doubleEq( r2, i * 100 + 102 ) );
 	}
 
diff --git a/kinetics/ReadKkit.cpp b/kinetics/ReadKkit.cpp
index 1c145e98d8571b42d621440a3e10a1157aa853c8..2529919a8714fb64013324656d13a545bfda446d 100644
--- a/kinetics/ReadKkit.cpp
+++ b/kinetics/ReadKkit.cpp
@@ -130,7 +130,7 @@ Id  makeStandardElements( Id pa, const string& modelname )
 		mgr = shell->doCreate( "Neutral", pa, modelname, 1, MooseGlobal );
 	Id kinetics( modelPath + "/kinetics" );
 	if ( kinetics == Id() ) {
-		kinetics = 
+		kinetics =
 		shell->doCreate( "CubeMesh", mgr, "kinetics", 1,  MooseGlobal );
 		SetGet2< double, unsigned int >::set( kinetics, "buildDefaultMesh", 1e-15, 1 );
 	}
@@ -143,7 +143,7 @@ Id  makeStandardElements( Id pa, const string& modelname )
 	Id geometry = shell->doCreate( "Neutral", mgr, "geometry", 1, MooseGlobal );
 	assert( geometry != Id() );
 
-	Id groups = 
+	Id groups =
 		shell->doCreate( "Neutral", mgr, "groups", 1, MooseGlobal );
 	assert( groups != Id() );
 	return mgr;
@@ -162,7 +162,7 @@ static void positionCompt( ObjId compt, double side, bool shiftUp )
 	}
 }
 
-void makeSolverOnCompt( Shell* s, const vector< ObjId >& compts, 
+void makeSolverOnCompt( Shell* s, const vector< ObjId >& compts,
 				bool isGsolve )
 {
 	if ( compts.size() > 3 ) {
@@ -180,8 +180,8 @@ void makeSolverOnCompt( Shell* s, const vector< ObjId >& compts,
 		positionCompt( compts[0], side, true );
 		positionCompt( compts[2], side, false );
 	}
-	
-	for ( vector< ObjId >::const_iterator 
+
+	for ( vector< ObjId >::const_iterator
 					i = compts.begin(); i != compts.end(); ++i ) {
 		string simpath = i->path() + "/##";
 		Id ksolve;
@@ -202,19 +202,19 @@ void makeSolverOnCompt( Shell* s, const vector< ObjId >& compts,
 		SetGet1< Id >::set( stoichVec[1], "buildXreacs", stoichVec[0] );
 		SetGet1< Id >::set( stoichVec[1], "buildXreacs", stoichVec[2] );
 	}
-	for ( vector< Id >::iterator 
+	for ( vector< Id >::iterator
 					i = stoichVec.begin(); i != stoichVec.end(); ++i ) {
 		SetGet0::set( *i, "filterXreacs" );
 	}
 }
 
-void setMethod( Shell* s, Id mgr, double simdt, double plotdt, 
+void setMethod( Shell* s, Id mgr, double simdt, double plotdt,
 				const string& method )
 {
 	vector< ObjId > ret;
 	simpleWildcardFind( mgr.path() + "/#[ISA=ChemCompt]", ret );
 	assert( ret.size() > 0 );
-				
+
 	Id compt( mgr.path() + "/kinetics" );
 	assert( compt != Id() );
 	string simpath2 = mgr.path() + "/##[ISA=StimulusTable]," +
@@ -224,11 +224,11 @@ void setMethod( Shell* s, Id mgr, double simdt, double plotdt,
 	if ( m == "rk4" ) {
 		cout << "Warning, not yet implemented. Using rk5 instead\n";
 		m = "rk5";
-	}	
-	if ( m == "ksolve" || m == "gsl" || 
+	}
+	if ( m == "ksolve" || m == "gsl" ||
 		m == "rk5" || m == "rkf" || m == "rk" ) {
 			makeSolverOnCompt( s, ret, false );
-	} else if ( m == "gssa" || m == "gsolve" || 
+	} else if ( m == "gssa" || m == "gsolve" ||
 		m == "gillespie" || m == "stochastic" ) {
 			makeSolverOnCompt( s, ret, true );
 	} else if ( m == "ee" || m == "neutral" ) {
@@ -257,10 +257,10 @@ void setMethod( Shell* s, Id mgr, double simdt, double plotdt,
  * of parser and is likely to remain a legacy for a while.
  */
 Id ReadKkit::read(
-	const string& filename, 
+	const string& filename,
 	const string& modelname,
 	Id pa, const string& methodArg )
-{   
+{
 	string method = methodArg;
 	ifstream fin( filename.c_str() );
 	if (!fin){
@@ -298,7 +298,7 @@ Id ReadKkit::read(
 	convertParametersToConcUnits();
 
 	// s->doSetClock( 8, plotdt_ );
-	
+
 	// string plotpath = basePath_ + "/graphs/##[TYPE=Table]," + basePath_ + "/moregraphs/##[TYPE=Table]";
 	// s->doUseClock( plotpath, "process", 8 );
 
@@ -335,7 +335,7 @@ void ReadKkit::run()
 	/*
 	string poolpath = basePath_ + "/kinetics/##[ISA=Pool]";
 	string reacpath = basePath_ + "/kinetics/##[ISA!=Pool]";
-	string plotpath = basePath_ + "/graphs/##[TYPE=Table]," + 
+	string plotpath = basePath_ + "/graphs/##[TYPE=Table]," +
 		basePath_ + "/moregraphs/##[TYPE=Table]";
 	shell_->doUseClock( reacpath, "process", 4 );
 	shell_->doUseClock( poolpath, "process", 5 );
@@ -362,10 +362,10 @@ void ReadKkit::dumpPlots( const string& filename )
 {
 	// ofstream fout ( filename.c_str() );
 	vector< ObjId > plots;
-	string plotpath = basePath_ + "/graphs/##[TYPE=Table2]," + 
+	string plotpath = basePath_ + "/graphs/##[TYPE=Table2]," +
 		basePath_ + "/moregraphs/##[TYPE=Table2]";
 	wildcardFind( plotpath, plots );
-	for ( vector< ObjId >::iterator 
+	for ( vector< ObjId >::iterator
 					i = plots.begin(); i != plots.end(); ++i )
 		SetGet2< string, string >::set( *i, "xplot",
 			filename, i->element()->getName() );
@@ -388,8 +388,8 @@ void ReadKkit::innerRead( ifstream& fin )
 		if ( temp.length() == 0 )
 				continue;
 		pos = temp.find_last_not_of( "\t " );
-		if ( pos == string::npos ) { 
-			// Nothing new in line, go with what was left earlier, 
+		if ( pos == string::npos ) {
+			// Nothing new in line, go with what was left earlier,
 			// and clear out line for the next cycle.
 			temp = "";
 			clearLine = 1;
@@ -404,7 +404,7 @@ void ReadKkit::innerRead( ifstream& fin )
 				clearLine = 1;
 			}
 		}
-			
+
 		pos = line.find_first_not_of( "\t " );
 		if ( pos == string::npos )
 				continue;
@@ -412,7 +412,7 @@ void ReadKkit::innerRead( ifstream& fin )
 			line = line.substr( pos );
 		if ( line.substr( 0, 2 ) == "//" )
 				continue;
-		if ( (pos = line.find("//")) != string::npos ) 
+		if ( (pos = line.find("//")) != string::npos )
 			line = line.substr( 0, pos );
 		if ( line.substr( 0, 2 ) == "/*" ) {
 				parseMode = COMMENT;
@@ -434,15 +434,15 @@ void ReadKkit::innerRead( ifstream& fin )
 				parseMode = readInit( line );
 		}
 	}
-	
+
 	/*
 	cout << " innerRead: " <<
-			lineNum_ << " lines read, " << 
-			numCompartments_ << " compartments, " << 
-			numPools_ << " molecules, " << 
-			numReacs_ << " reacs, " << 
-			numEnz_ << " enzs, " << 
-			numMMenz_ << " MM enzs, " << 
+			lineNum_ << " lines read, " <<
+			numCompartments_ << " compartments, " <<
+			numPools_ << " molecules, " <<
+			numReacs_ << " reacs, " <<
+			numEnz_ << " enzs, " <<
+			numMMenz_ << " MM enzs, " <<
 			numOthers_ << " others," <<
 			numPlot_ << " plots," <<
 			" PlotDt = " << plotdt_ <<
@@ -453,7 +453,7 @@ void ReadKkit::innerRead( ifstream& fin )
 ReadKkit::ParseMode ReadKkit::readInit( const string& line )
 {
 	vector< string > argv;
-	chopLine( line, argv ); 
+	chopLine( line, argv );
 	if ( argv.size() < 3 )
 		return INIT;
 
@@ -505,8 +505,8 @@ ReadKkit::ParseMode ReadKkit::readInit( const string& line )
 void ReadKkit::readData( const string& line )
 {
 	vector< string > argv;
-	chopLine( line, argv ); 
-	
+	chopLine( line, argv );
+
 	if ( argv[0] == "simundump" )
 		undump( argv );
 	else if ( argv[0] == "addmsg" )
@@ -526,7 +526,7 @@ string ReadKkit::pathTail( const string& path, string& head ) const
 	string::size_type pos = path.find_last_of( "/" );
 	assert( pos != string::npos );
 
-	head = basePath_ + path.substr( 0, pos ); 
+	head = basePath_ + path.substr( 0, pos );
 	return path.substr( pos + 1 );
 }
 
@@ -535,11 +535,11 @@ string ReadKkit::cleanPath( const string& path ) const
 	// Could surely do this better with STL. But harder to understand.
 	// Harsha: Cleaned up this function
 	// minus was getting replaced with underscore, but in some genesis model
-	// pool and reaction/Enzyme has same string name with 
+	// pool and reaction/Enzyme has same string name with
 	// difference of minus and underscore like eIF4G_A-clx and eIF4G_A_clx,
 	// which later created a problem as the same name exist in moose when minus
 	// was replaced with underscore.
-	//So replacing minus with _minus_ like I do in SBML 
+	//So replacing minus with _minus_ like I do in SBML
 	string ret = path;
 	string cleanString;
 	for ( unsigned int i = 0; i < path.length(); ++i ) {
@@ -680,10 +680,10 @@ Id ReadKkit::buildReac( const vector< string >& args )
 	// the model has been created, once we know the order of each reac.
 
 	Id reac = shell_->doCreate( "Reac", pa, tail, 1 );
-	reacIds_[ clean.substr( 10 ) ] = reac; 
+	reacIds_[ clean.substr( 10 ) ] = reac;
 	// Here is another hack: The native values stored in the reac are
 	// Kf and Kb, in conc units. However the 'clean' values from kkit
-	// are the number values numKf and numKb. In the 
+	// are the number values numKf and numKb. In the
 	// function convertReacRatesToNumUnits we take the numKf and numKb and
 	// do proper conc scaling.
 	Field< double >::set( reac, "Kf", kf );
@@ -709,7 +709,7 @@ void ReadKkit::separateVols( Id pool, double vol )
 	volCategories_.push_back( temp );
 }
 
-bool volCompare( 
+bool volCompare(
 				const pair< unsigned int, double >& A,
 				const pair< unsigned int, double >& B )
 {
@@ -717,7 +717,7 @@ bool volCompare(
 }
 // Returns the ranking of each volume. Largest is 0. This would be the
 // suffix to attach to the compartment name.
-vector< unsigned int > findVolOrder( const vector< double >& vols ) 
+vector< unsigned int > findVolOrder( const vector< double >& vols )
 {
 	vector< pair< unsigned int, double > > p( vols.size() );
 	for ( unsigned int i = 0; i < vols.size(); ++i ) {
@@ -758,7 +758,7 @@ void ReadKkit::assignPoolCompartments()
 			ss << "compartment_" << j;
 			name = ss.str();
 			comptId = Neutral::child( baseId_.eref(), name );
-			if ( comptId == Id() ) 
+			if ( comptId == Id() )
 				comptId = shell_->doCreate( "CubeMesh", baseId_, name, 1 );
 		}
 		SetGet1< double >::set( comptId, "setVolumeNotRates",vols_[i]);
@@ -793,7 +793,7 @@ Id findParentComptOfReac( Id reac )
 		reac.element()->getNeighbors( subVec, subFinfo );
 		if ( subVec.size() == 0 ) // Dangling reaction
 			return Id();
-		// For now just put the reac in the compt belonging to the 
+		// For now just put the reac in the compt belonging to the
 		// first substrate
 		return getCompt( subVec[0] );
 }
@@ -806,7 +806,7 @@ Id findParentComptOfReac( Id reac )
  */
 void ReadKkit::assignReacCompartments()
 {
-	for ( map< string, Id >::iterator i = reacIds_.begin(); 
+	for ( map< string, Id >::iterator i = reacIds_.begin();
 		i != reacIds_.end(); ++i ) {
 		Id compt = findParentComptOfReac( i->second );
 		if ( compt != Id() ) {
@@ -845,7 +845,7 @@ void ReadKkit::assignEnzCompartments()
 {
 		/*
 		Should not be needed, because the parent pool will move.
-	for ( map< string, Id >::iterator i = enzIds_.begin(); 
+	for ( map< string, Id >::iterator i = enzIds_.begin();
 		i != enzIds_.end(); ++i ) {
 		Id compt = getCompt( Neutral::parent( i->second ).id );
 		if ( moveOntoCompartment_ ) {
@@ -866,7 +866,7 @@ void ReadKkit::assignMMenzCompartments()
 {
 		/*
 		Should not be needed, because the parent pool will move.
-	for ( map< string, Id >::iterator i = mmEnzIds_.begin(); 
+	for ( map< string, Id >::iterator i = mmEnzIds_.begin();
 		i != mmEnzIds_.end(); ++i ) {
 		Id compt = getCompt( Neutral::parent( i->second ).id );
 		if ( moveOntoCompartment_ ) {
@@ -889,13 +889,13 @@ Id ReadKkit::buildEnz( const vector< string >& args )
 	double k2 = atof( args[ enzMap_[ "k2" ] ].c_str() );
 	double k3 = atof( args[ enzMap_[ "k3" ] ].c_str() );
 	// double volscale = atof( args[ enzMap_[ "vol" ] ].c_str() );
-	double nComplexInit = 
+	double nComplexInit =
 		atof( args[ enzMap_[ "nComplexInit" ] ].c_str() );
 	// double vol = atof( args[ enzMap_[ "vol" ] ].c_str());
 	bool isMM = atoi( args[ enzMap_[ "usecomplex" ] ].c_str());
 	assert( poolVols_.find( pa ) != poolVols_.end() );
 	double vol = poolVols_[ pa ];
-	
+
 	/**
 	 * vsf is vol scale factor, which is what GENESIS stores in 'vol' field
 	 * n = vsf * conc( uM )
@@ -907,7 +907,7 @@ Id ReadKkit::buildEnz( const vector< string >& args )
 		Id enz = shell_->doCreate( "MMenz", pa, tail, 1 );
 		assert( enz != Id () );
 		string mmEnzPath = clean.substr( 10 );
-		mmEnzIds_[ mmEnzPath ] = enz; 
+		mmEnzIds_[ mmEnzPath ] = enz;
 
 		assert( k1 > EPSILON );
 		double Km = ( k2 + k3 ) / k1;
@@ -922,7 +922,7 @@ Id ReadKkit::buildEnz( const vector< string >& args )
 		// double parentVol = Field< double >::get( pa, "volume" );
 		assert( enz != Id () );
 		string enzPath = clean.substr( 10 );
-		enzIds_[ enzPath ] = enz; 
+		enzIds_[ enzPath ] = enz;
 
 		// Need to figure out what to do about these. Perhaps it is OK
 		// to do this assignments in raw #/cell units.
@@ -939,7 +939,7 @@ Id ReadKkit::buildEnz( const vector< string >& args )
 		string cplxPath = enzPath + "/" + cplxName;
 		Id cplx = shell_->doCreate( "Pool", enz, cplxName, 1 );
 		assert( cplx != Id () );
-		poolIds_[ cplxPath ] = cplx; 
+		poolIds_[ cplxPath ] = cplx;
 		// Field< double >::set( cplx, "nInit", nComplexInit );
 		Field< double >::set( cplx, "nInit", nComplexInit );
 
@@ -947,9 +947,9 @@ Id ReadKkit::buildEnz( const vector< string >& args )
 		enzCplxMols_.push_back( pair< Id, Id >(  pa, cplx ) );
 		separateVols( cplx, -1 ); // -1 vol is a flag to defer mesh assignment for the cplx pool.
 
-		ObjId ret = shell_->doAddMsg( "OneToAll", 
+		ObjId ret = shell_->doAddMsg( "OneToAll",
 			ObjId( enz, 0 ), "cplx",
-			ObjId( cplx, 0 ), "reac" ); 
+			ObjId( cplx, 0 ), "reac" );
 		assert( ret != ObjId() );
 
 
@@ -969,7 +969,7 @@ Id ReadKkit::buildText( const vector< string >& args )
 	return text;
 }
 
-Id ReadKkit::buildInfo( Id parent, 
+Id ReadKkit::buildInfo( Id parent,
 	map< string, int >& m, const vector< string >& args )
 {
 	Id info = shell_->doCreate( "Annotator", parent, "info", 1 );
@@ -982,7 +982,7 @@ Id ReadKkit::buildInfo( Id parent,
 	Field< double >::set( info, "x", x );
 	Field< double >::set( info, "y", y );
 	Field< string >::set( info, "color", args[ m[ "xtree_fg_req" ] ] );
-	Field< string >::set( info, "textColor", 
+	Field< string >::set( info, "textColor",
 		args[ m[ "xtree_textfg_req" ] ] );
 	return info;
 }
@@ -1004,7 +1004,7 @@ Id ReadKkit::buildGroup( const vector< string >& args )
 
 /**
  * There is a problem with this conversion, because of the discrepancy of
- * the correct NA and the version (6e23) used in kkit. I take the 
+ * the correct NA and the version (6e23) used in kkit. I take the
  * concentration as authoritative, not the # of molecules. This is because
  * I use conc units for the rates as well, and to use n for pools and
  * conc for reactions will always introduce errors. This is still not
@@ -1020,7 +1020,7 @@ Id ReadKkit::buildPool( const vector< string >& args )
 	assert( pa != Id() );
 
 	double nInit = atof( args[ poolMap_[ "nInit" ] ].c_str() );
-	double vsf = atof( args[ poolMap_[ "vol" ] ].c_str() ); 
+	double vsf = atof( args[ poolMap_[ "vol" ] ].c_str() );
 	/**
 	 * vsf is vol scale factor, which is what GENESIS stores in 'vol' field
 	 * n = vsf * conc( uM )
@@ -1031,9 +1031,9 @@ Id ReadKkit::buildPool( const vector< string >& args )
 	int slaveEnable = atoi( args[ poolMap_[ "slave_enable" ] ].c_str() );
 	double diffConst = atof( args[ poolMap_[ "DiffConst" ] ].c_str() );
 
-	// I used -ve D as a flag to replace pool-specific D 
+	// I used -ve D as a flag to replace pool-specific D
 	// with the global value of D. Here we just ignore it.
-	if ( diffConst < 0 ) 
+	if ( diffConst < 0 )
 		diffConst = 0;
 
 	Id pool;
@@ -1044,14 +1044,14 @@ Id ReadKkit::buildPool( const vector< string >& args )
 	} else {
 		pool = shell_->doCreate( "Pool", pa, tail, 1 );
 		/*
-		cout << "ReadKkit::buildPool: Unknown slave_enable flag '" << 
+		cout << "ReadKkit::buildPool: Unknown slave_enable flag '" <<
 			slaveEnable << "' on " << clean << "\n";
 			*/
 		poolFlags_[pool] = slaveEnable;
 	}
 	assert( pool != Id() );
 	// skip the 10 chars of "/kinetics/"
-	poolIds_[ clean.substr( 10 ) ] = pool; 
+	poolIds_[ clean.substr( 10 ) ] = pool;
 
 	Field< double >::set( pool, "nInit", nInit );
 	Field< double >::set( pool, "diffConst", diffConst );
@@ -1062,8 +1062,8 @@ Id ReadKkit::buildPool( const vector< string >& args )
 	Id info = buildInfo( pool, poolMap_, args );
 
 	/*
-	cout << setw( 20 ) << head << setw( 15 ) << tail << "	" << 
-		setw( 12 ) << nInit << "	" << 
+	cout << setw( 20 ) << head << setw( 15 ) << tail << "	" <<
+		setw( 12 ) << nInit << "	" <<
 		vol << "	" << diffConst << "	" <<
 		slaveEnable << endl;
 		*/
@@ -1072,13 +1072,13 @@ Id ReadKkit::buildPool( const vector< string >& args )
 }
 
 /**
- * Finds the source pool for a SumTot. It also deals with cases where 
+ * Finds the source pool for a SumTot. It also deals with cases where
  * the source is an enz-substrate complex
  */
 Id ReadKkit::findSumTotSrc( const string& src )
 {
 	map< string, Id >::iterator i = poolIds_.find( src );
-	if ( i != poolIds_.end() ) { 
+	if ( i != poolIds_.end() ) {
 		return i->second;
 	}
 	i = enzIds_.find( src );
@@ -1086,7 +1086,7 @@ Id ReadKkit::findSumTotSrc( const string& src )
 		string head;
 		string cplx = src + '/' + pathTail( src, head ) + "_cplx";
 		i = poolIds_.find( cplx );
-		if ( i != poolIds_.end() ) { 
+		if ( i != poolIds_.end() ) {
 			return i->second;
 		}
 	}
@@ -1100,7 +1100,7 @@ void ReadKkit::buildSumTotal( const string& src, const string& dest )
 	map< string, Id >::iterator i = poolIds_.find( dest );
 	assert( i != poolIds_.end() );
 	Id destId = i->second;
-	
+
 	Id sumId;
 	// Check if the pool has not yet been converted to handle SumTots.
 	if ( destId.element()->cinfo()->name() == "Pool" ) {
@@ -1108,9 +1108,9 @@ void ReadKkit::buildSumTotal( const string& src, const string& dest )
 		// Turn dest into a FuncPool.
 		destId.element()->zombieSwap( BufPool::initCinfo() );
 
-		ObjId ret = shell_->doAddMsg( "single", 
+		ObjId ret = shell_->doAddMsg( "single",
 			ObjId( sumId, 0 ), "valueOut",
-			ObjId( destId, 0 ), "setN" ); 
+			ObjId( destId, 0 ), "setN" );
 		assert( ret != ObjId() );
 	} else {
 		sumId = Neutral::child( destId.eref(), "func" );
@@ -1121,15 +1121,15 @@ void ReadKkit::buildSumTotal( const string& src, const string& dest )
 		<< dest << "'\n";
 		return;
 	}
-	
+
 	Id srcId = findSumTotSrc( src );
 	unsigned int numVars = Field< unsigned int >::get( sumId, "numVars" );
 	ObjId xi( sumId.value() + 1, 0, numVars );
 	Field< unsigned int >::set( sumId, "numVars", numVars + 1 );
 
-	ObjId ret = shell_->doAddMsg( "single", 
+	ObjId ret = shell_->doAddMsg( "single",
 		ObjId( srcId, 0 ), "nOut",
-		xi, "input" ); 
+		xi, "input" );
 	assert( ret != ObjId() );
 
 
@@ -1152,12 +1152,12 @@ Id ReadKkit::buildStim( const vector< string >& args )
 	Id pa = shell_->doFind( head ).id;
 	assert( pa != Id() );
 
-	double level1 = atof( args[ stimMap_[ "firstLevel" ] ].c_str() ); 
-	double width1 = atof( args[ stimMap_[ "firstWidth" ] ].c_str() ); 
-	double delay1 = atof( args[ stimMap_[ "firstDelay" ] ].c_str() ); 
-	double level2 = atof( args[ stimMap_[ "secondLevel" ] ].c_str() ); 
-	double width2 = atof( args[ stimMap_[ "secondWidth" ] ].c_str() ); 
-	double delay2 = atof( args[ stimMap_[ "secondLevel" ] ].c_str() ); 
+	double level1 = atof( args[ stimMap_[ "firstLevel" ] ].c_str() );
+	double width1 = atof( args[ stimMap_[ "firstWidth" ] ].c_str() );
+	double delay1 = atof( args[ stimMap_[ "firstDelay" ] ].c_str() );
+	double level2 = atof( args[ stimMap_[ "secondLevel" ] ].c_str() );
+	double width2 = atof( args[ stimMap_[ "secondWidth" ] ].c_str() );
+	double delay2 = atof( args[ stimMap_[ "secondLevel" ] ].c_str() );
 	double baselevel = atof( args[ stimMap_[ "baseLevel" ] ].c_str() );
 
 	Id stim = shell_->doCreate( "PulseGen", pa, tail, 1 );
@@ -1195,7 +1195,7 @@ Id ReadKkit::buildChan( const vector< string >& args )
 	chanIds_[ chanPath ] = chan;
 	return chan;
 }
-	
+
 
 Id ReadKkit::buildGeometry( const vector< string >& args )
 {
@@ -1231,7 +1231,7 @@ Id ReadKkit::buildPlot( const vector< string >& args )
 	assert( plot != Id() );
 
 	temp = graph + "/" + tail;
-	plotIds_[ temp ] = plot; 
+	plotIds_[ temp ] = plot;
 
 	numPlot_++;
 	return plot;
@@ -1267,7 +1267,7 @@ Id ReadKkit::buildTable( const vector< string >& args )
 
 
 	string temp = clean.substr( 10 );
-	tabIds_[ temp ] = tab; 
+	tabIds_[ temp ] = tab;
 
 	Id info = buildInfo( tab, tableMap_, args );
 
@@ -1306,14 +1306,14 @@ unsigned int ReadKkit::loadTab( const vector< string >& args )
 	Field< vector< double > >::set( tab, "vector", tabEntries_ );
 
 	// cout << "Loading table for " << args[0] << "," << args[1] << "," << clean << endl;
-	
+
 	if ( args[1] == "-end" )
 		lastTab_ = Id();
 
 	return 0;
 }
 
-void ReadKkit::innerAddMsg( 
+void ReadKkit::innerAddMsg(
 	const string& src, const map< string, Id >& m1, const string& srcMsg,
 	const string& dest, const map< string, Id >& m2, const string& destMsg,
 	bool isBackward )
@@ -1328,14 +1328,14 @@ void ReadKkit::innerAddMsg(
 
 	// dest pool is substrate of src reac
 	if ( isBackward ) {
-		ObjId ret = shell_->doAddMsg( "AllToOne", 
+		ObjId ret = shell_->doAddMsg( "AllToOne",
 			ObjId( srcId, 0 ), srcMsg,
-			ObjId( destId, 0 ), destMsg ); 
+			ObjId( destId, 0 ), destMsg );
 		assert( ret != ObjId() );
 	} else {
-		ObjId ret = shell_->doAddMsg( "OneToAll", 
+		ObjId ret = shell_->doAddMsg( "OneToAll",
 			ObjId( srcId, 0 ), srcMsg,
-			ObjId( destId, 0 ), destMsg ); 
+			ObjId( destId, 0 ), destMsg );
 		assert( ret != ObjId() );
 	}
 }
@@ -1345,7 +1345,7 @@ void ReadKkit::addmsg( const vector< string >& args)
 {
 	string src = cleanPath( args[1] ).substr( 10 );
 	string dest = cleanPath( args[2] ).substr( 10 );
-	
+
 	if ( args[3] == "REAC" ) {
 		if ( args[4] == "A" && args[5] == "B" ) {
 			// Ignore kchans
@@ -1353,7 +1353,7 @@ void ReadKkit::addmsg( const vector< string >& args)
 				; // found a kchan, do nothing
 			else
 				innerAddMsg( src, reacIds_, "sub", dest, poolIds_, "reac");
-		} 
+		}
 		else if ( args[4] == "B" && args[5] == "A" ) {
 			// Ignore kchans
 			if ( chanIds_.find( src ) != chanIds_.end() )
@@ -1410,7 +1410,7 @@ void ReadKkit::addmsg( const vector< string >& args)
 				return;
 			}
 			vector< Id > enzcplx;
-			i->second.element()->getNeighbors( enzcplx, 
+			i->second.element()->getNeighbors( enzcplx,
 				i->second.element()->cinfo()->findFinfo( "cplxOut" ) );
 			assert( enzcplx.size() == 1 );
 			pool = enzcplx[0];
@@ -1461,7 +1461,7 @@ void ReadKkit::setupSlaveMsg( const string& src, const string& dest )
 		nameMap = &stimIds_;
 		output = "output";
 	} else {
-		cout << "Error: Unknown source for SLAVE msg: (" << src << 
+		cout << "Error: Unknown source for SLAVE msg: (" << src <<
 			", " << dest << ")\n";
 		return;
 	}
@@ -1469,7 +1469,7 @@ void ReadKkit::setupSlaveMsg( const string& src, const string& dest )
 	// NSLAVE is 1, CONCSLAVE is 2.
 	map< Id, int >::iterator i = poolFlags_.find( destId );
 	if ( i == poolFlags_.end() || !( i->second & 2 ) ) {
-		innerAddMsg( src, *nameMap, output, dest, poolIds_, 
+		innerAddMsg( src, *nameMap, output, dest, poolIds_,
 			"setNInit" );
 	} else {
 		innerAddMsg( src, *nameMap, output, dest, poolIds_,
@@ -1510,7 +1510,7 @@ void ReadKkit::convertParametersToConcUnits()
 void ReadKkit::convertPoolAmountToConcUnits()
 {
 	const double NA_RATIO = KKIT_NA / NA;
-	for ( map< string, Id >::iterator i = poolIds_.begin(); 
+	for ( map< string, Id >::iterator i = poolIds_.begin();
 		i != poolIds_.end(); ++i ) {
 		Id pool = i->second;
 		double nInit = Field< double >::get( pool, "nInit" );
@@ -1526,7 +1526,7 @@ void ReadKkit::convertPoolAmountToConcUnits()
 void ReadKkit::convertReacRatesToConcUnits()
 {
 	const double NA_RATIO = KKIT_NA / NA;
-	for ( map< string, Id >::iterator i = reacIds_.begin(); 
+	for ( map< string, Id >::iterator i = reacIds_.begin();
 		i != reacIds_.end(); ++i ) {
 		Id reac = i->second;
 		double kf = Field< double >::get( reac, "Kf" );
@@ -1537,9 +1537,9 @@ void ReadKkit::convertReacRatesToConcUnits()
 
 		// At this point the kf and kb are off because the
 		// NA for kkit is not accurate. So we correct for this.
-		unsigned int numSub = 
+		unsigned int numSub =
 			Field< unsigned int >::get( reac, "numSubstrates" );
-		unsigned int numPrd = 
+		unsigned int numPrd =
 			Field< unsigned int >::get( reac, "numProducts" );
 
 		if ( numSub > 1 )
@@ -1548,7 +1548,7 @@ void ReadKkit::convertReacRatesToConcUnits()
 		if ( numPrd > 1 )
 			kb *= pow( NA_RATIO, numPrd - 1.0 );
 
-		// Now we have the correct numKf and numKb, plug them into the 
+		// Now we have the correct numKf and numKb, plug them into the
 		// reac, and let it internally fix up the Kf and Kb.
 		Field< double >::set( reac, "numKf", kf );
 		Field< double >::set( reac, "numKb", kb );
@@ -1558,17 +1558,17 @@ void ReadKkit::convertReacRatesToConcUnits()
 void ReadKkit::convertMMenzRatesToConcUnits()
 {
 	const double NA_RATIO = KKIT_NA / NA;
-	for ( map< string, Id >::iterator i = mmEnzIds_.begin(); 
+	for ( map< string, Id >::iterator i = mmEnzIds_.begin();
 		i != mmEnzIds_.end(); ++i ) {
 		Id enz = i->second;
 		// This was set in the original # units.
 		double numKm = Field< double >::get( enz, "Km" );
 		// At this point the numKm is inaaccurate because the
 		// NA for kkit is not accurate. So we correct for this.
-		double numSub = 
+		double numSub =
 			Field< unsigned int >::get( enz, "numSubstrates" );
 		// Note that we always have the enz itself as a substrate term.
-		if ( numSub > 0 ) 
+		if ( numSub > 0 )
 			numKm *= pow( NA_RATIO, -numSub );
 
 		// Now we have the correct numKm, plug it into the MMenz, and
@@ -1584,16 +1584,16 @@ void ReadKkit::convertMMenzRatesToConcUnits()
 void ReadKkit::convertEnzRatesToConcUnits()
 {
 	const double NA_RATIO = KKIT_NA / NA;
-	for ( map< string, Id >::iterator i = enzIds_.begin(); 
+	for ( map< string, Id >::iterator i = enzIds_.begin();
 		i != enzIds_.end(); ++i ) {
 		Id enz = i->second;
 		double k1 = Field< double >::get( enz, "k1" );
 		// At this point the k1 is inaaccurate because the
 		// NA for kkit is not accurate. So we correct for this.
-		double numSub = 
+		double numSub =
 			Field< unsigned int >::get( enz, "numSubstrates" );
 		// Note that we always have the enz itself as a substrate term.
-		if ( numSub > 0 ) 
+		if ( numSub > 0 )
 			k1 *= pow( NA_RATIO, numSub );
 		Field< double >::set( enz, "k1", k1 );
 	}
diff --git a/kinetics/WriteKkit.cpp b/kinetics/WriteKkit.cpp
index 6546c9d49b6b92cd8f36dde17bc7899a839b564e..0f8533c05c0df96ed788913205ee10f0c4eac097 100644
--- a/kinetics/WriteKkit.cpp
+++ b/kinetics/WriteKkit.cpp
@@ -25,13 +25,13 @@
 #include <set>
 
 
-void writeHeader( ofstream& fout, 
+void writeHeader( ofstream& fout,
 		double simdt, double plotdt, double maxtime, double defaultVol)
 {
 	time_t rawtime;
 	time( &rawtime );
 
-	fout << 
+	fout <<
 	"//genesis\n"
 	"// kkit Version 11 flat dumpfile\n\n";
 	fout << "// Saved on " << ctime( &rawtime ) << endl;
@@ -48,7 +48,7 @@ void writeHeader( ofstream& fout,
 	"setfield /file/modpath value ~/scripts/modules\n"
 	"kparms\n\n";
 
-	fout << 
+	fout <<
 	"initdump -version 3 -ignoreorphans 1\n"
 	"simobjdump table input output alloced step_mode stepsize x y z\n"
 	"simobjdump xtree path script namemode sizescale\n"
@@ -77,7 +77,7 @@ void writeHeader( ofstream& fout,
 }
 
 string trimPath(Id id, Id  comptid)
-{	
+{
 	string msgpath = Field <string> :: get(id,"path");
 	ObjId compartment(msgpath);
 	string path1;
@@ -95,7 +95,7 @@ string trimPath(Id id, Id  comptid)
 		else
 			{
 				path1 = msgpath;
-				
+
 			}
 	}
 	else
@@ -130,9 +130,9 @@ void writeEnz( ofstream& fout, Id id,
 			 	double x, double y, Id comptid )
 {
 	string path = id.path();
-	string comptname = Field < string > :: get(comptid,"name"); 
+	string comptname = Field < string > :: get(comptid,"name");
 	string poolpath = trimPath(id,comptid);
-	
+
 
 	double k1 = 0;
 	double k2 = 0;
@@ -143,7 +143,7 @@ void writeEnz( ofstream& fout, Id id,
 	double conc = 0;
 	Id enzMol = getEnzMol( id );
 	assert( enzMol != Id() );
-	double vol = Field< double >::get( enzMol, "volume" ) * NA * 1e-3; 
+	double vol = Field< double >::get( enzMol, "volume" ) * NA * 1e-3;
 	unsigned int isMichaelisMenten = 0;
 	string enzClass = Field < string > :: get(id,"className");
 	if (enzClass == "ZombieMMenz" or enzClass == "MMenz")
@@ -164,9 +164,9 @@ void writeEnz( ofstream& fout, Id id,
 		concInit = Field< double >::get( cplx, "concInit" );
 		conc = Field< double >::get( cplx, "conc" );
 	}
-	fout << "simundump kenz /kinetics" << poolpath << " 0 " << 
+	fout << "simundump kenz /kinetics" << poolpath << " 0 " <<
 			concInit << " " <<
-			conc << " " << 
+			conc << " " <<
 			nInit << " " <<
 			n << " " <<
 			vol << " " <<
@@ -175,8 +175,8 @@ void writeEnz( ofstream& fout, Id id,
 			k3 << " " <<
 			0 << " " <<
 			isMichaelisMenten << " " <<
-			"\"\"" << " " << 
-			colour << " " << textcolour << " \"\"" << 
+			"\"\"" << " " <<
+			colour << " " << textcolour << " \"\"" <<
 			" " << x << " " << y << " 0\n";
 }
 
@@ -188,21 +188,21 @@ void writeReac( ofstream& fout, Id id,
 	string reacname = Field<string> :: get(id, "name");
 	double kf = Field< double >::get( id, "numKf" );
 	double kb = Field< double >::get( id, "numKb" );
-	
-	unsigned int numSub = 
+
+	unsigned int numSub =
 			Field< unsigned int >::get( id, "numSubstrates" );
-	unsigned int numPrd = 
+	unsigned int numPrd =
 			Field< unsigned int >::get( id, "numProducts" );
-	fout << "simundump kreac /kinetics" << trimPath(id,comptid) << " 0 " << 
-			kf << " " << kb << " \"\" " << 
+	fout << "simundump kreac /kinetics" << trimPath(id,comptid) << " 0 " <<
+			kf << " " << kb << " \"\" " <<
 			colour << " " << textcolour << " " << x << " " << y << " 0\n";
 }
 
 unsigned int getSlaveEnable( Id id )
 {
-	static const Finfo* setNinitFinfo = 
+	static const Finfo* setNinitFinfo =
 			PoolBase::initCinfo()->findFinfo( "set_nInit" );
-	static const Finfo* setConcInitFinfo = 
+	static const Finfo* setConcInitFinfo =
 			PoolBase::initCinfo()->findFinfo( "set_concInit" );
 	unsigned int ret = 0;
 	vector< Id > src;
@@ -219,7 +219,7 @@ unsigned int getSlaveEnable( Id id )
 			return 4; // Just simple buffered molecule
 	if ( src[0].element()->cinfo()->isA( "StimulusTable" ) )
 			return ret; // Following a table, this is fine.
-	
+
 	// Fallback: I have no idea what sent it the input, assume it is legit.
 	return ret;
 }
@@ -243,7 +243,7 @@ void writePool( ofstream& fout, Id id,
 	{	vector< Id > children = Field< vector< Id > >::get( id, "children" );
 		if (children.size() == 0)
 			slave_enable = 4;
-		for ( vector< Id >::iterator i = children.begin(); i != children.end(); ++i ) 
+		for ( vector< Id >::iterator i = children.begin(); i != children.end(); ++i )
 		{	string funcpath = Field <string> :: get(*i,"path");
 		  	string clsname = Field <string> :: get(*i,"className");
 		  	if (clsname == "Function" or clsname == "ZombieFunction")
@@ -252,13 +252,13 @@ void writePool( ofstream& fout, Id id,
 		  		slave_enable = 4;
 
 		}
-	}	
+	}
 	if (comptIndex > 0)
 		geometryTemp << "/geometry[" << comptIndex <<"]";
 	else
 		geometryTemp << "/geometry";
 
-	// simobjdump kpool DiffConst CoInit Co n nInit mwt nMin vol slave_enable 
+	// simobjdump kpool DiffConst CoInit Co n nInit mwt nMin vol slave_enable
 
 	fout << "simundump kpool /kinetics" << trimPath(id,comptid) << " 0 " <<
 			diffConst << " " <<
@@ -270,21 +270,21 @@ void writePool( ofstream& fout, Id id,
 			volume * NA * 1e-3 << " " << // volscale
 			slave_enable << //GENESIS FIELD HERE.
 			" /kinetics"<< geometryTemp.str() << " " <<
-			colour << " " << textcolour << " " << x << " " << y << " 0\n"; 
+			colour << " " << textcolour << " " << x << " " << y << " 0\n";
 }
 void writePlot( ofstream& fout, Id id,
 				string colour, string textcolour,
 			 	double x, double y )
-{	
+{
 	string path = id.path();
 	size_t pos = path.find( "/graphs" );
-	if ( pos == string::npos ) 
+	if ( pos == string::npos )
 		pos = path.find( "/moregraphs" );
-		if ( pos == string::npos ) 
+		if ( pos == string::npos )
 			return;
 	path = path.substr( pos );
-	fout << "simundump xplot " << path << " 3 524288 \\\n" << 
-	"\"delete_plot.w <s> <d>; edit_plot.D <w>\" " << textcolour << " 0 0 1\n";	
+	fout << "simundump xplot " << path << " 3 524288 \\\n" <<
+	"\"delete_plot.w <s> <d>; edit_plot.D <w>\" " << textcolour << " 0 0 1\n";
 }
 
 void writeGui( ofstream& fout )
@@ -313,7 +313,7 @@ void storeMMenzMsgs( Id enz, vector< string >& msgs, Id comptid )
 
 	vector < Id > srct = LookupField <string,vector < Id> >::get(enz, "neighbors","sub");
 	for (vector <Id> :: iterator rsub = srct.begin();rsub != srct.end();rsub++)
-	{	
+	{
 		string s = "addmsg /kinetics" + trimPath(*rsub, comptid) + " /kinetics" + trimPath(enz, comptid) + " SUBSTRATE n";
 		msgs.push_back( s );
 		s = "addmsg /kinetics" + trimPath(enz, comptid) + " /kinetics" + trimPath( *rsub, comptid ) + 	" REAC sA B";
@@ -340,7 +340,7 @@ void storeCplxEnzMsgs( Id enz, vector< string >& msgs, Id comptid )
 
 	vector < Id > srct = LookupField <string,vector < Id> >::get(enz, "neighbors","sub");
 	for (vector <Id> :: iterator rsub = srct.begin();rsub != srct.end();rsub++)
-	{	
+	{
 		string s = "addmsg /kinetics" + trimPath(*rsub, comptid) + " /kinetics" + trimPath(enz, comptid) + " SUBSTRATE n";
 		msgs.push_back( s );
 		s = "addmsg /kinetics" + trimPath(enz, comptid) + " /kinetics" + trimPath( *rsub, comptid ) + 	" REAC sA B";
@@ -372,7 +372,7 @@ void storeEnzMsgs( Id enz, vector< string >& msgs, Id comptid )
 }
 
 void storeReacMsgs( Id reac, vector< string >& msgs, Id comptid )
-{	
+{
 	vector < Id > srct = LookupField <string,vector < Id> >::get(reac, "neighbors","sub");
 	for (vector <Id> :: iterator rsub = srct.begin();rsub != srct.end();rsub++)
 	{	string s = "addmsg /kinetics" + trimPath(*rsub, comptid) + " /kinetics" + trimPath(reac, comptid) + " SUBSTRATE n";
@@ -401,7 +401,7 @@ void storeFunctionMsgs( Id func, vector< string >& msgs,map < double, pair<Id, i
 	string poolParent = Field <string> :: get(compt_vol[poolvol].first,"name");
 	Id xi(func.value()+1);
 	vector < Id > func_input = LookupField <string,vector < Id> >::get(xi, "neighbors","input");
-	
+
 	for (vector <Id> :: iterator funcIp = func_input.begin();funcIp != func_input.end();funcIp++)
 	{	string funcIp_path = Field < string > :: get(*funcIp,"path");
 		double vol = Field < double > :: get(*funcIp,"Volume");
@@ -419,17 +419,17 @@ void storePlotMsgs( Id tab, vector< string >& msgs, Id pool, string bg, Id compt
 	string poolName = Field <string> :: get(pool,"name");
 
 	size_t pos = tabPath.find( "/graphs" );
-	if ( pos == string::npos ) 
+	if ( pos == string::npos )
 		pos = tabPath.find( "/moregraphs" );
 		assert( pos != string::npos );
 	tabPath = tabPath.substr( pos );
-	string s = "addmsg /kinetics" + trimPath( poolPath, comptid) + " " + tabPath + 
+	string s = "addmsg /kinetics" + trimPath( poolPath, comptid) + " " + tabPath +
 	 			" PLOT Co *" + poolName + " *" + bg;
 	msgs.push_back( s );
 }
 
 /**
- * A bunch of heuristics to find good SimTimes to use for kkit. 
+ * A bunch of heuristics to find good SimTimes to use for kkit.
  * Returns runTime.
  */
 double estimateSimTimes( double& simDt, double& plotDt )
@@ -437,9 +437,9 @@ double estimateSimTimes( double& simDt, double& plotDt )
 		double runTime = Field< double >::get( Id( 1 ), "runTime" );
 		if ( runTime <= 0 )
 				runTime = 100.0;
-		vector< double > dts = 
+		vector< double > dts =
 				Field< vector< double> >::get( Id( 1 ), "dts" );
-		
+
 		simDt = dts[11];
 		plotDt = dts[18];
 		cout <<  "estimatesimtimes" << simDt << plotDt;
@@ -456,18 +456,18 @@ double estimateSimTimes( double& simDt, double& plotDt )
 /// Returns an estimate of the default volume used in the model.
 double estimateDefaultVol( Id model )
 {
-		vector< Id > children = 
+		vector< Id > children =
 				Field< vector< Id > >::get( model, "children" );
 		vector< double > vols;
 		double maxVol = 0;
-		for ( vector< Id >::iterator i = children.begin(); 
+		for ( vector< Id >::iterator i = children.begin();
 						i != children.end(); ++i ) {
 				if ( i->element()->cinfo()->isA( "ChemCompt" ) ) {
 						double v = Field< double >::get( *i, "volume" );
 						if ( i->element()->getName() == "kinetics" )
 								return v;
 						vols.push_back( v );
-						if ( maxVol < v ) 
+						if ( maxVol < v )
 								maxVol = v;
 				}
 		}
@@ -482,19 +482,19 @@ void writeMsgs( ofstream& fout, const vector< string >& msgs )
 			fout << *i << endl;
 }
 void writeGroup(ofstream& fout,Id model)
-{ 	
+{
     vector < ObjId> group;
     int x = 10;
     int y = 20;
     int num = wildcardFind( model.path() + "/##[TYPE=Neutral]", group );
     for ( vector< ObjId >::iterator itr = group.begin(); itr != group.end();itr++)
-    {	
+    {
         string path = Field<string>::get(*itr,"path");
         size_t pos = path.find( "/kinetics" );
         if (pos != std::string::npos)
         {
             path = path.substr( pos );
-            fout << "simundump group " << path << " 0 " << 
+            fout << "simundump group " << path << " 0 " <<
                 "blue" << " " << "green"	 << " x 0 0 \"\" defaultfile \\\n";
             fout << "  defaultfile.g 0 0 0 " << x << " " << y << " 0\n";
         }
@@ -514,17 +514,17 @@ void writeKkit( Id model, const string& fname )
 		string fg = "black";
 		double x = 0;
 		double y = 0;
-			
+
 		map < double, pair<Id, int> > compt_vol;
-		
+
 		unsigned int num = wildcardFind( model.path() + "/##[ISA=ChemCompt]", chemCompt );
 		if ( num == 0 ) {
-			cout << "Warning: writeKkit:: No model found on " << model << 
+			cout << "Warning: writeKkit:: No model found on " << model <<
 					endl;
 			return;
 		}
 		for ( vector< ObjId >::iterator itr = chemCompt.begin(); itr != chemCompt.end();itr++)
-		{	
+		{
 			vector < unsigned int>dims;
       		unsigned int dims_size;
       		dims_size = 1;
@@ -533,7 +533,7 @@ void writeKkit( Id model, const string& fname )
       		string comptname = Field<string>::get(*itr,"name");
       		if (comptname != "kinetics")
       		{
-      			fout << "simundump group /kinetics/" << comptname << " 0 " << 
+      			fout << "simundump group /kinetics/" << comptname << " 0 " <<
 			"blue" << " " << "green"	 << " x 0 0 \"\" defaultfile \\\n";
 				fout << "  defaultfile.g 0 0 0 " << rand() % 10 + 1 << " " << rand() % 10 + 1 << " 0\n";
       		}
@@ -544,8 +544,8 @@ void writeKkit( Id model, const string& fname )
       		if (vecIndex > 0)
 		   		geometry << "simundump geometry /kinetics" <<  "/geometry[" << vecIndex <<"] 0 " << size << " " << ndim << " sphere " <<" \"\" white black 0 0 0\n";
 		   	else
-		  		geometry << "simundump geometry /kinetics"  <<  "/geometry 0 " << size << " " << ndim << " sphere " <<" \"\" white black 0 0 0\n"; 		
-			fout << geometry.str();	
+		  		geometry << "simundump geometry /kinetics"  <<  "/geometry 0 " << size << " " << ndim << " sphere " <<" \"\" white black 0 0 0\n";
+			fout << geometry.str();
 			compt_vol.insert(make_pair(size,make_pair(*itr,vecIndex)));
 		} // compartmentclose
 		writeGroup(fout, model);
@@ -553,7 +553,7 @@ void writeKkit( Id model, const string& fname )
        	for (compt = compt_vol.begin(); compt != compt_vol.end(); compt++)
        	{
         	string comptPath = Field<string>::get(compt->second.first,"path");
-			//  Species 
+			//  Species
 			vector< ObjId > Compt_spe;
 		  	wildcardFind(comptPath+"/##[ISA=PoolBase]",Compt_spe);
 		  	int species_size = 1;
@@ -578,11 +578,11 @@ void writeKkit( Id model, const string& fname )
 			for (vector <ObjId> :: iterator itrF= Compt_Func.begin();itrF != Compt_Func.end();itrF++)
 			{	storeFunctionMsgs( *itrF, msgs,compt_vol);
 			}
-	  		// Reaction 
+	  		// Reaction
 			vector< ObjId > Compt_Reac;
 			wildcardFind(comptPath+"/##[ISA=ReacBase]",Compt_Reac);
 			for (vector <ObjId> :: iterator itrR= Compt_Reac.begin();itrR != Compt_Reac.end();itrR++)
-			{ 	
+			{
 				string path = Field<string> :: get(*itrR,"path");
 				Id annotaId( path+"/info");
 			    string noteClass = Field<string> :: get(annotaId,"className");
@@ -608,7 +608,7 @@ void writeKkit( Id model, const string& fname )
 			    writeEnz( fout, *itrE, bg, fg, x, y, compt->second.first);
 			    storeEnzMsgs( *itrE, msgs, compt->second.first);
 			}// reaction
-			
+
 		} //compatment loop
 	writeGui ( fout);
 
@@ -623,7 +623,7 @@ void writeKkit( Id model, const string& fname )
 		{ 	string path = Field <string> :: get(*tabItem,"path");
 			double vol = Field < double> :: get (*tabItem,"Volume");
 			//Trying to find the compartment name via volume
-			//otherwise if we go via parent, sometimes it might 
+			//otherwise if we go via parent, sometimes it might
 			// get groupname so maped compartment Id and volume
 
 			Id parentId = compt_vol[vol].first;
diff --git a/kinetics/lookupVolumeFromMesh.cpp b/kinetics/lookupVolumeFromMesh.cpp
index 0b4e7ec38fcc0fcb67b3b7dbd74de13c46fb1d9e..84f9ebf925d0a6bf9a00f91039994a733454bd0e 100644
--- a/kinetics/lookupVolumeFromMesh.cpp
+++ b/kinetics/lookupVolumeFromMesh.cpp
@@ -46,21 +46,21 @@ double lookupVolumeFromMesh( const Eref& e )
  * Figures out all the volumes of the substrates or products on the
  * specified reaction 'reac'. The SrcFinfo is for the sub or prd msg.
  * Returns the index of the smallest vol. Passes back a vector of volumes.
- * The meshIndex is zero. Reasoning is as follows: both in the case of 
+ * The meshIndex is zero. Reasoning is as follows: both in the case of
  * well-stirred (single mesh entry) models, and in the case of spatial
- * models with consistent mesh sizes and alignments, the mesh entry 
+ * models with consistent mesh sizes and alignments, the mesh entry
  * volumes are in the same ratio.
  * Cases with more complex arrangements may also use the current vols as
  * a starting point, but will need to add index-specific scaling factors
  * to their reaction system.
  */
 
-unsigned int getReactantVols( const Eref& reac, const SrcFinfo* pools, 
+unsigned int getReactantVols( const Eref& reac, const SrcFinfo* pools,
 	vector< double >& vols )
 {
 	static const unsigned int meshIndex = 0;
 
-	const vector< MsgFuncBinding >* mfb = 
+	const vector< MsgFuncBinding >* mfb =
 		reac.element()->getMsgAndFunc( pools->getBindIndex() );
 	unsigned int smallIndex = 0;
 
@@ -88,22 +88,22 @@ unsigned int getReactantVols( const Eref& reac, const SrcFinfo* pools,
 }
 
 /**
- * Returns conversion factor to convert rates from concentration to 
+ * Returns conversion factor to convert rates from concentration to
  * mol# units.
  * Handles arbitrary combinations of volumes.
- * Assumes that the reference volume for computing rates is the 
+ * Assumes that the reference volume for computing rates is the
  * smallest volume.
  * 26 Feb 2013: This is now changed to use the volume of the first entry.
  * Should only be used for substrates. For products need to find the
  * first substrate, separately, and use that to scale down the conv factor.
  * Assumes all calculations are in SI: cubic metres and millimolar.
- * 27 Feb 2013: This is changed to use the volume of a voxel of the 
+ * 27 Feb 2013: This is changed to use the volume of a voxel of the
  * the home compartment of the reac.
  * Be warned: this can cause unexpected problems if the home compartment
- * isn't according to convention. For example, if there is a single 
+ * isn't according to convention. For example, if there is a single
  * substrate and the home compartment is elsewhere, you will get very odd
  * Kf:kf values.
- * 9 Oct 2013: This is now changed to use the volume of the first 
+ * 9 Oct 2013: This is now changed to use the volume of the first
  * substrate. Note that if the conversion is for products, then the
  * routine has to look up the substrate list to get the first substrate.
  * Reason is that the home compartment was often wrong in ReadKkit.
@@ -111,7 +111,7 @@ unsigned int getReactantVols( const Eref& reac, const SrcFinfo* pools,
  * conventions they use for cross-compartment reactions.
  */
 
-double convertConcToNumRateUsingMesh( const Eref& e, const SrcFinfo* pools, 
+double convertConcToNumRateUsingMesh( const Eref& e, const SrcFinfo* pools,
 	bool doPartialConversion )
 {
 	vector< double > vols;
@@ -157,10 +157,10 @@ double convertConcToNumRateUsingMesh( const Eref& e, const SrcFinfo* pools,
  * This variant already knows the volume, but has to figure out # of
  * reactants.
  */
-double convertConcToNumRateUsingVol( const Eref& e, const SrcFinfo* pools, 
+double convertConcToNumRateUsingVol( const Eref& e, const SrcFinfo* pools,
 	double volume, double scale, bool doPartialConversion )
 {
-	const vector< MsgFuncBinding >* mfb = 
+	const vector< MsgFuncBinding >* mfb =
 		e.element()->getMsgAndFunc( pools->getBindIndex() );
 	double conversion = 1.0;
 	if ( mfb && mfb->size() > 0 ) {
@@ -171,7 +171,7 @@ double convertConcToNumRateUsingVol( const Eref& e, const SrcFinfo* pools,
 				conversion = pow( conversion, power );
 			}
 		}
-		if ( conversion <= 0 ) 
+		if ( conversion <= 0 )
 			conversion = 1.0;
 	}
 
@@ -184,7 +184,7 @@ double convertConcToNumRateUsingVol( const Eref& e, const SrcFinfo* pools,
  * or mesh entries, and may therefore have different volumes.
  * We already know the reactants and their affiliations.
  */
-double convertConcToNumRateInTwoCompts( double v1, unsigned int n1, 
+double convertConcToNumRateInTwoCompts( double v1, unsigned int n1,
 	double v2, unsigned int n2, double scale )
 {
 	double conversion = 1.0;
@@ -194,7 +194,7 @@ double convertConcToNumRateInTwoCompts( double v1, unsigned int n1,
 	for ( unsigned int i = 0; i < n2; ++i )
 		conversion *= scale * NA * v2;
 
-	if ( conversion <= 0 ) 
+	if ( conversion <= 0 )
 			conversion = 1.0;
 
 	return conversion;
diff --git a/ksolve/Gsolve.cpp b/ksolve/Gsolve.cpp
index 736ca1f84a9499a35a6a43a1a36934aaf501ccc0..a1c576ac18c65fe39c7570050a2f6456fa6f7123 100644
--- a/ksolve/Gsolve.cpp
+++ b/ksolve/Gsolve.cpp
@@ -30,199 +30,195 @@
 const unsigned int OFFNODE = ~0;
 
 // static function
-SrcFinfo2< Id, vector< double > >* Gsolve::xComptOut()
-{
-    static SrcFinfo2< Id, vector< double > > xComptOut( "xComptOut",
-            "Sends 'n' of all molecules participating in cross-compartment "
-            "reactions between any juxtaposed voxels between current compt "
-            "and another compartment. This includes molecules local to this "
-            "compartment, as well as proxy molecules belonging elsewhere. "
-            "A(t+1) = (Alocal(t+1) + AremoteProxy(t+1)) - Alocal(t) "
-            "A(t+1) = (Aremote(t+1) + Aproxy(t+1)) - Aproxy(t) "
-            "Then we update A on the respective solvers with: "
-            "Alocal(t+1) = Aproxy(t+1) = A(t+1) "
-            "This is equivalent to sending dA over on each timestep. "
-                                                      );
-    return &xComptOut;
+SrcFinfo2< Id, vector< double > >* Gsolve::xComptOut() {
+	static SrcFinfo2< Id, vector< double > > xComptOut( "xComptOut",
+		"Sends 'n' of all molecules participating in cross-compartment "
+		"reactions between any juxtaposed voxels between current compt "
+		"and another compartment. This includes molecules local to this "
+		"compartment, as well as proxy molecules belonging elsewhere. "
+		"A(t+1) = (Alocal(t+1) + AremoteProxy(t+1)) - Alocal(t) "
+		"A(t+1) = (Aremote(t+1) + Aproxy(t+1)) - Aproxy(t) "
+		"Then we update A on the respective solvers with: "
+		"Alocal(t+1) = Aproxy(t+1) = A(t+1) "
+		"This is equivalent to sending dA over on each timestep. "
+   	);
+	return &xComptOut;
 }
 
 const Cinfo* Gsolve::initCinfo()
 {
-    ///////////////////////////////////////////////////////
-    // Field definitions
-    ///////////////////////////////////////////////////////
-
-    static ValueFinfo< Gsolve, Id > stoich (
-        "stoich",
-        "Stoichiometry object for handling this reaction system.",
-        &Gsolve::setStoich,
-        &Gsolve::getStoich
-    );
-
-    static ValueFinfo< Gsolve, Id > compartment (
-        "compartment",
-        "Compartment that contains this reaction system.",
-        &Gsolve::setCompartment,
-        &Gsolve::getCompartment
-    );
-
-    static ReadOnlyValueFinfo< Gsolve, unsigned int > numLocalVoxels(
-        "numLocalVoxels",
-        "Number of voxels in the core reac-diff system, on the "
-        "current solver. ",
-        &Gsolve::getNumLocalVoxels
-    );
-    static LookupValueFinfo<
-    Gsolve, unsigned int, vector< double > > nVec(
-        "nVec",
-        "vector of pool counts",
-        &Gsolve::setNvec,
-        &Gsolve::getNvec
-    );
-    static ValueFinfo< Gsolve, unsigned int > numAllVoxels(
-        "numAllVoxels",
-        "Number of voxels in the entire reac-diff system, "
-        "including proxy voxels to represent abutting compartments.",
-        &Gsolve::setNumAllVoxels,
-        &Gsolve::getNumAllVoxels
-    );
-
-    static ValueFinfo< Gsolve, unsigned int > numPools(
-        "numPools",
-        "Number of molecular pools in the entire reac-diff system, "
-        "including variable, function and buffered.",
-        &Gsolve::setNumPools,
-        &Gsolve::getNumPools
-    );
-
-    static ValueFinfo< Gsolve, bool > useRandInit(
-        "useRandInit",
-        "Flag: True when using probabilistic (random) rounding.\n "
-        "Default: True.\n "
-        "When initializing the mol# from floating-point Sinit values, "
-        "we have two options. One is to look at each Sinit, and round "
-        "to the nearest integer. The other is to look at each Sinit, "
-        "and probabilistically round up or down depending on the  "
-        "value. For example, if we had a Sinit value of 1.49,  "
-        "this would always be rounded to 1.0 if the flag is false, "
-        "and would be rounded to 1.0 and 2.0 in the ratio 51:49 if "
-        "the flag is true. ",
-        &Gsolve::setRandInit,
-        &Gsolve::getRandInit
-    );
-
-    static ValueFinfo< Gsolve, bool > useClockedUpdate(
-        "useClockedUpdate",
-        "Flag: True to cause all reaction propensities to be updated "
-        "on every clock tick.\n"
-        "Default: False.\n"
-        "This flag should be set when the reaction system "
-        "includes a function with a dependency on time or on external "
-        "events. It has a significant speed penalty so the flag "
-        "should not be set unless there are such functions. " ,
-        &Gsolve::setClockedUpdate,
-        &Gsolve::getClockedUpdate
-    );
-    static ReadOnlyLookupValueFinfo<
-    Gsolve, unsigned int, vector< unsigned int > > numFire(
-        "numFire",
-        "Vector of the number of times each reaction has fired."
-        "Indexed by the voxel number."
-        "Zeroed out at reinit.",
-        &Gsolve::getNumFire
-    );
-
-    ///////////////////////////////////////////////////////
-    // DestFinfo definitions
-    ///////////////////////////////////////////////////////
-
-    static DestFinfo process( "process",
-                              "Handles process call",
-                              new ProcOpFunc< Gsolve >( &Gsolve::process ) );
-    static DestFinfo reinit( "reinit",
-                             "Handles reinit call",
-                             new ProcOpFunc< Gsolve >( &Gsolve::reinit ) );
-
-    static DestFinfo voxelVol( "voxelVol",
-                               "Handles updates to all voxels. Comes from parent "
-                               "ChemCompt object.",
-                               new OpFunc1< Gsolve, vector< double > >(
-                                   &Gsolve::updateVoxelVol )
-                             );
-
-    static DestFinfo initProc( "initProc",
-                               "Handles initProc call from Clock",
-                               new ProcOpFunc< Gsolve >( &Gsolve::initProc ) );
-    static DestFinfo initReinit( "initReinit",
-                                 "Handles initReinit call from Clock",
-                                 new ProcOpFunc< Gsolve >( &Gsolve::initReinit ) );
-
-    static DestFinfo xComptIn( "xComptIn",
-                               "Handles arriving pool 'n' values used in cross-compartment "
-                               "reactions.",
-                               new EpFunc2< Gsolve, Id, vector< double > >( &Gsolve::xComptIn )
-                             );
-    ///////////////////////////////////////////////////////
-    // Shared definitions
-    ///////////////////////////////////////////////////////
-    static Finfo* procShared[] =
-    {
-        &process, &reinit
-    };
-    static SharedFinfo proc( "proc",
-                             "Shared message for process and reinit",
-                             procShared, sizeof( procShared ) / sizeof( const Finfo* )
-                           );
-
-    static Finfo* initShared[] =
-    {
-        &initProc, &initReinit
-    };
-    static SharedFinfo init( "init",
-                             "Shared message for initProc and initReinit. This is used"
-                             " when the system has cross-compartment reactions. ",
-                             initShared, sizeof( initShared ) / sizeof( const Finfo* )
-                           );
-
-    static Finfo* xComptShared[] =
-    {
-        xComptOut(), &xComptIn
-    };
-    static SharedFinfo xCompt( "xCompt",
-                               "Shared message for pool exchange for cross-compartment "
-                               "reactions. Exchanges latest values of all pools that "
-                               "participate in such reactions.",
-                               xComptShared, sizeof( xComptShared ) / sizeof( const Finfo* )
-                             );
-    ///////////////////////////////////////////////////////
-
-    static Finfo* gsolveFinfos[] =
-    {
-        &stoich,			// Value
-        &numLocalVoxels,	// ReadOnlyValue
-        &nVec,				// LookupValue
-        &numAllVoxels,		// ReadOnlyValue
-        &numPools,			// Value
-        &voxelVol,			// DestFinfo
-        &proc,				// SharedFinfo
-        &init,				// SharedFinfo
-        &xCompt,			// SharedFinfo
-        // Here we put new fields that were not there in the Ksolve.
-        &useRandInit,		// Value
-        &useClockedUpdate,	// Value
-        &numFire,			// ReadOnlyLookupValue
-    };
-
-    static Dinfo< Gsolve > dinfo;
-    static  Cinfo gsolveCinfo(
-        "Gsolve",
-        Neutral::initCinfo(),
-        gsolveFinfos,
-        sizeof(gsolveFinfos)/sizeof(Finfo *),
-        &dinfo
-    );
-
-    return &gsolveCinfo;
+		///////////////////////////////////////////////////////
+		// Field definitions
+		///////////////////////////////////////////////////////
+		
+		static ValueFinfo< Gsolve, Id > stoich (
+			"stoich",
+			"Stoichiometry object for handling this reaction system.",
+			&Gsolve::setStoich,
+			&Gsolve::getStoich
+		);
+
+		static ValueFinfo< Gsolve, Id > compartment (
+			"compartment",
+			"Compartment that contains this reaction system.",
+			&Gsolve::setCompartment,
+			&Gsolve::getCompartment
+		);
+
+		static ReadOnlyValueFinfo< Gsolve, unsigned int > numLocalVoxels(
+			"numLocalVoxels",
+			"Number of voxels in the core reac-diff system, on the "
+			"current solver. ",
+			&Gsolve::getNumLocalVoxels
+		);
+		static LookupValueFinfo< 
+				Gsolve, unsigned int, vector< double > > nVec(
+			"nVec",
+			"vector of pool counts",
+			&Gsolve::setNvec,
+			&Gsolve::getNvec
+		);
+		static ValueFinfo< Gsolve, unsigned int > numAllVoxels(
+			"numAllVoxels",
+			"Number of voxels in the entire reac-diff system, "
+			"including proxy voxels to represent abutting compartments.",
+			&Gsolve::setNumAllVoxels,
+			&Gsolve::getNumAllVoxels
+		);
+
+		static ValueFinfo< Gsolve, unsigned int > numPools(
+			"numPools",
+			"Number of molecular pools in the entire reac-diff system, "
+			"including variable, function and buffered.",
+			&Gsolve::setNumPools,
+			&Gsolve::getNumPools
+		);
+
+		static ValueFinfo< Gsolve, bool > useRandInit(
+			"useRandInit",
+			"Flag: True when using probabilistic (random) rounding.\n "
+			"Default: True.\n "
+			"When initializing the mol# from floating-point Sinit values, "
+			"we have two options. One is to look at each Sinit, and round "
+			"to the nearest integer. The other is to look at each Sinit, "
+			"and probabilistically round up or down depending on the  "
+			"value. For example, if we had a Sinit value of 1.49,  "
+			"this would always be rounded to 1.0 if the flag is false, "
+			"and would be rounded to 1.0 and 2.0 in the ratio 51:49 if "
+			"the flag is true. ",
+			&Gsolve::setRandInit,
+			&Gsolve::getRandInit
+		);
+
+		static ValueFinfo< Gsolve, bool > useClockedUpdate(
+			"useClockedUpdate",
+			"Flag: True to cause all reaction propensities to be updated "
+			"on every clock tick.\n"
+			"Default: False.\n"
+			"This flag should be set when the reaction system "
+			"includes a function with a dependency on time or on external "
+			"events. It has a significant speed penalty so the flag "
+			"should not be set unless there are such functions. " ,
+			&Gsolve::setClockedUpdate,
+			&Gsolve::getClockedUpdate
+		);
+		static ReadOnlyLookupValueFinfo< 
+				Gsolve, unsigned int, vector< unsigned int > > numFire(
+			"numFire",
+			"Vector of the number of times each reaction has fired."
+			"Indexed by the voxel number."
+			"Zeroed out at reinit.",
+			&Gsolve::getNumFire
+		);
+
+		///////////////////////////////////////////////////////
+		// DestFinfo definitions
+		///////////////////////////////////////////////////////
+
+		static DestFinfo process( "process",
+			"Handles process call",
+			new ProcOpFunc< Gsolve >( &Gsolve::process ) );
+		static DestFinfo reinit( "reinit",
+			"Handles reinit call",
+			new ProcOpFunc< Gsolve >( &Gsolve::reinit ) );
+		
+		static DestFinfo voxelVol( "voxelVol",
+			"Handles updates to all voxels. Comes from parent "
+			"ChemCompt object.",
+			new OpFunc1< Gsolve, vector< double > >(
+			&Gsolve::updateVoxelVol )
+		);
+
+		static DestFinfo initProc( "initProc",
+			"Handles initProc call from Clock",
+			new ProcOpFunc< Gsolve >( &Gsolve::initProc ) );
+		static DestFinfo initReinit( "initReinit",
+			"Handles initReinit call from Clock",
+			new ProcOpFunc< Gsolve >( &Gsolve::initReinit ) );
+
+		static DestFinfo xComptIn( "xComptIn",
+			"Handles arriving pool 'n' values used in cross-compartment "
+			"reactions.",
+			new EpFunc2< Gsolve, Id, vector< double > >( &Gsolve::xComptIn )
+		);
+		///////////////////////////////////////////////////////
+		// Shared definitions
+		///////////////////////////////////////////////////////
+		static Finfo* procShared[] = {
+			&process, &reinit
+		};
+		static SharedFinfo proc( "proc",
+			"Shared message for process and reinit",
+			procShared, sizeof( procShared ) / sizeof( const Finfo* )
+		);
+
+		static Finfo* initShared[] = {
+			&initProc, &initReinit
+		};
+		static SharedFinfo init( "init",
+			"Shared message for initProc and initReinit. This is used"
+		    " when the system has cross-compartment reactions. ",
+			initShared, sizeof( initShared ) / sizeof( const Finfo* )
+		);
+
+		static Finfo* xComptShared[] = {
+			xComptOut(), &xComptIn
+		};
+		static SharedFinfo xCompt( "xCompt",
+			"Shared message for pool exchange for cross-compartment "
+			"reactions. Exchanges latest values of all pools that "
+			"participate in such reactions.",
+			xComptShared, sizeof( xComptShared ) / sizeof( const Finfo* )
+		);
+		///////////////////////////////////////////////////////
+
+	static Finfo* gsolveFinfos[] =
+	{
+		&stoich,			// Value
+		&numLocalVoxels,	// ReadOnlyValue
+		&nVec,				// LookupValue
+		&numAllVoxels,		// ReadOnlyValue
+		&numPools,			// Value
+		&voxelVol,			// DestFinfo
+		&proc,				// SharedFinfo
+		&init,				// SharedFinfo
+		&xCompt,			// SharedFinfo
+		// Here we put new fields that were not there in the Ksolve. 
+		&useRandInit,		// Value
+		&useClockedUpdate,	// Value
+		&numFire,			// ReadOnlyLookupValue
+	};
+	
+	static Dinfo< Gsolve > dinfo;
+	static  Cinfo gsolveCinfo(
+		"Gsolve",
+		Neutral::initCinfo(),
+		gsolveFinfos,
+		sizeof(gsolveFinfos)/sizeof(Finfo *),
+		&dinfo
+	);
+
+	return &gsolveCinfo;
 }
 
 static const Cinfo* gsolveCinfo = Gsolve::initCinfo();
@@ -232,20 +228,16 @@ static const Cinfo* gsolveCinfo = Gsolve::initCinfo();
 //////////////////////////////////////////////////////////////
 
 Gsolve::Gsolve()
-    :
-    pools_( 1 ),
-    startVoxel_( 0 ),
-    dsolve_(),
-    dsolvePtr_( 0 ),
-    useClockedUpdate_( false )
-{
-    ;
-}
+	: 
+		pools_( 1 ),
+		startVoxel_( 0 ),
+		dsolve_(),
+		dsolvePtr_( 0 ),
+		useClockedUpdate_( false )
+{;}
 
 Gsolve::~Gsolve()
-{
-    ;
-}
+{;}
 
 //////////////////////////////////////////////////////////////
 // Field Access functions
@@ -253,131 +245,121 @@ Gsolve::~Gsolve()
 
 Id Gsolve::getStoich() const
 {
-    return stoich_;
+	return stoich_;
 }
 
 void Gsolve::setCompartment( Id compt )
 {
-    if ( ( compt.element()->cinfo()->isA( "ChemCompt" ) ) )
-    {
-        compartment_ = compt;
-        vector< double > vols =
-            Field< vector< double > >::get( compt, "voxelVolume" );
-        if ( vols.size() > 0 )
-        {
-            pools_.resize( vols.size() );
-            for ( unsigned int i = 0; i < vols.size(); ++i )
-            {
-                pools_[i].setVolume( vols[i] );
-            }
-        }
-    }
+	if ( ( compt.element()->cinfo()->isA( "ChemCompt" ) ) ) {
+		compartment_ = compt;
+		vector< double > vols = 
+			Field< vector< double > >::get( compt, "voxelVolume" );
+		if ( vols.size() > 0 ) {
+			pools_.resize( vols.size() );
+			for ( unsigned int i = 0; i < vols.size(); ++i ) {
+				pools_[i].setVolume( vols[i] );
+			}
+		}
+	}
 }
 
 Id Gsolve::getCompartment() const
 {
-    return compartment_;
+	return compartment_;
 }
 
 void Gsolve::setStoich( Id stoich )
 {
-    // This call is done _before_ setting the path on stoich
-    assert( stoich.element()->cinfo()->isA( "Stoich" ) );
-    stoich_ = stoich;
-    stoichPtr_ = reinterpret_cast< Stoich* >( stoich.eref().data() );
-    if ( stoichPtr_->getNumAllPools() == 0 )
-    {
-        stoichPtr_ = 0;
-        return;
-    }
-    sys_.stoich = stoichPtr_;
-    sys_.isReady = false;
-    for ( unsigned int i = 0; i < pools_.size(); ++i )
-        pools_[i].setStoich( stoichPtr_ );
+	// This call is done _before_ setting the path on stoich
+	assert( stoich.element()->cinfo()->isA( "Stoich" ) );
+	stoich_ = stoich;
+	stoichPtr_ = reinterpret_cast< Stoich* >( stoich.eref().data() );
+    if ( stoichPtr_->getNumAllPools() == 0 ) {
+		stoichPtr_ = 0;
+		return;
+	}
+	sys_.stoich = stoichPtr_;
+	sys_.isReady = false;
+	for ( unsigned int i = 0; i < pools_.size(); ++i )
+		pools_[i].setStoich( stoichPtr_ );
 }
 
 unsigned int Gsolve::getNumLocalVoxels() const
 {
-    return pools_.size();
+	return pools_.size();
 }
 
 unsigned int Gsolve::getNumAllVoxels() const
 {
-    return pools_.size(); // Need to redo.
+	return pools_.size(); // Need to redo.
 }
 
 // If we're going to do this, should be done before the zombification.
 void Gsolve::setNumAllVoxels( unsigned int numVoxels )
 {
-    if ( numVoxels == 0 )
-    {
-        return;
-    }
-    pools_.resize( numVoxels );
-    sys_.isReady = false;
+	if ( numVoxels == 0 ) {
+		return;
+	}
+	pools_.resize( numVoxels );
+	sys_.isReady = false;
 }
 
 vector< double > Gsolve::getNvec( unsigned int voxel) const
 {
-    static vector< double > dummy;
-    if ( voxel < pools_.size() )
-    {
-        return const_cast< GssaVoxelPools* >( &( pools_[ voxel ]) )->Svec();
-    }
-    return dummy;
+	static vector< double > dummy;
+	if ( voxel < pools_.size() ) {
+		return const_cast< GssaVoxelPools* >( &( pools_[ voxel ]) )->Svec();
+	}
+	return dummy;
 }
 
 void Gsolve::setNvec( unsigned int voxel, vector< double > nVec )
 {
-    if ( voxel < pools_.size() )
-    {
-        if ( nVec.size() != pools_[voxel].size() )
-        {
-            cout << "Warning: Gsolve::setNvec: size mismatch ( " <<
-                 nVec.size() << ", " << pools_[voxel].size() << ")\n";
-            return;
-        }
-        double* s = pools_[voxel].varS();
-        for ( unsigned int i = 0; i < nVec.size(); ++i )
-        {
-            s[i] = round( nVec[i] );
-            if ( s[i] < 0.0 )
-                s[i] = 0.0;
-        }
-        if ( sys_.isReady )
-            pools_[voxel].refreshAtot( &sys_ );
-    }
+	if ( voxel < pools_.size() ) {
+		if ( nVec.size() != pools_[voxel].size() ) {
+			cout << "Warning: Gsolve::setNvec: size mismatch ( " <<
+				nVec.size() << ", " << pools_[voxel].size() << ")\n";
+			return;
+		}
+		double* s = pools_[voxel].varS();
+		for ( unsigned int i = 0; i < nVec.size(); ++i ) {
+			s[i] = round( nVec[i] );
+			if ( s[i] < 0.0 ) 
+				s[i] = 0.0;
+		}
+		if ( sys_.isReady )
+			pools_[voxel].refreshAtot( &sys_ );
+	}
 }
 
 vector< unsigned int > Gsolve::getNumFire( unsigned int voxel) const
 {
-    static vector< unsigned int > dummy;
-    if ( voxel < pools_.size() )
-    {
-        return const_cast< GssaVoxelPools* >( &( pools_[ voxel ]) )->numFire();
-    }
-    return dummy;
+	static vector< unsigned int > dummy;
+	if ( voxel < pools_.size() ) {
+		return const_cast< GssaVoxelPools* >( &( pools_[ voxel ]) )->numFire();
+	}
+	return dummy;
 }
 
 
 bool Gsolve::getRandInit() const
 {
-    return sys_.useRandInit;
+	return sys_.useRandInit;
 }
 
 void Gsolve::setRandInit( bool val )
 {
-    sys_.useRandInit = val;
+	sys_.useRandInit = val;
 }
 
 bool Gsolve::getClockedUpdate() const
 {
-    return useClockedUpdate_;
+	return useClockedUpdate_;
 }
 
 void Gsolve::setClockedUpdate( bool val )
 {
-    useClockedUpdate_ = val;
+	useClockedUpdate_ = val;
 }
 
 //////////////////////////////////////////////////////////////
@@ -385,143 +367,122 @@ void Gsolve::setClockedUpdate( bool val )
 //////////////////////////////////////////////////////////////
 void Gsolve::process( const Eref& e, ProcPtr p )
 {
-    // cout << stoichPtr_ << "	dsolve = " <<	dsolvePtr_ << endl;
-    if ( !stoichPtr_ )
-        return;
-
-    // First, handle incoming diffusion values. Note potential for
-    // issues with roundoff if diffusion is not integral.
-    if ( dsolvePtr_ )
-    {
-        vector< double > dvalues( 4 );
-        dvalues[0] = 0;
-        dvalues[1] = getNumLocalVoxels();
-        dvalues[2] = 0;
-        dvalues[3] = stoichPtr_->getNumVarPools();
-        dsolvePtr_->getBlock( dvalues );
-
-        // Here we need to convert to integers, just in case. Normally
-        // one would use a stochastic (integral) diffusion method with
-        // the GSSA, but in mixed models it may be more complicated.
-        vector< double >::iterator i = dvalues.begin() + 4;
-
-        for ( ; i != dvalues.end(); ++i )
-        {
-            //	cout << *i << "	" << round( *i ) << "		";
+	// cout << stoichPtr_ << "	dsolve = " <<	dsolvePtr_ << endl;
+	if ( !stoichPtr_ )
+		return;
+	// First, handle incoming diffusion values. Note potential for
+	// issues with roundoff if diffusion is not integral.
+	if ( dsolvePtr_ ) {
+		vector< double > dvalues( 4 );
+		dvalues[0] = 0;
+		dvalues[1] = getNumLocalVoxels();
+		dvalues[2] = 0;
+		dvalues[3] = stoichPtr_->getNumVarPools();
+		dsolvePtr_->getBlock( dvalues );
+		// Here we need to convert to integers, just in case. Normally
+		// one would use a stochastic (integral) diffusion method with 
+		// the GSSA, but in mixed models it may be more complicated.
+		vector< double >::iterator i = dvalues.begin() + 4;
+		for ( ; i != dvalues.end(); ++i ) {
+		//	cout << *i << "	" << round( *i ) << "		";
 #if SIMPLE_ROUNDING
-            *i = round( *i );
+			*i = round( *i );
 #else
-            double base = floor( *i );
-            if ( mtrand() >= (*i - base) )
-                *i = base;
-            else
-                *i = base + 1.0;
+			double base = floor( *i );
+			if ( mtrand() > *i - base )
+				*i = base;
+			else
+				*i = base + 1.0;
 #endif
-        }
-        setBlock( dvalues );
-    }
-    // Second, take the arrived xCompt reac values and update S with them.
-    // Here the roundoff issues are handled by the GssaVoxelPools functions
-    for ( unsigned int i = 0; i < xfer_.size(); ++i )
-    {
-        XferInfo& xf = xfer_[i];
-        // cout << xfer_.size() << "	" << xf.xferVoxel.size() << endl;
-        for ( unsigned int j = 0; j < xf.xferVoxel.size(); ++j )
-        {
-            pools_[xf.xferVoxel[j]].xferIn( xf, j, &sys_ );
-        }
-    }
-    // Third, record the current value of pools as the reference for the
-    // next cycle.
-    for ( unsigned int i = 0; i < xfer_.size(); ++i )
-    {
-        XferInfo& xf = xfer_[i];
-        for ( unsigned int j = 0; j < xf.xferVoxel.size(); ++j )
-        {
-            pools_[xf.xferVoxel[j]].xferOut( j, xf.lastValues, xf.xferPoolIdx );
-        }
-    }
-
-    // Fourth: Fix the rates if we have had any diffusion or xreacs
-    // happening. This is very inefficient at this point, need to fix.
-    if ( dsolvePtr_ || xfer_.size() > 0 )
-    {
-        for ( vector< GssaVoxelPools >::iterator
-                i = pools_.begin(); i != pools_.end(); ++i )
-        {
-            i->refreshAtot( &sys_ );
-        }
-    }
-    // Fifth, update the mol #s.
-    // First we advance the simulation.
-    for ( vector< GssaVoxelPools >::iterator
-            i = pools_.begin(); i != pools_.end(); ++i )
-    {
-        i->advance( p, &sys_ );
-    }
-    if ( useClockedUpdate_ )   // Check if a clocked stim is to be updated
-    {
-        for ( vector< GssaVoxelPools >::iterator
-                i = pools_.begin(); i != pools_.end(); ++i )
-        {
-            i->recalcTime( &sys_, p->currTime );
-        }
-    }
-
-    // Finally, assemble and send the integrated values off for the Dsolve.
-    if ( dsolvePtr_ )
-    {
-        vector< double > kvalues( 4 );
-        kvalues[0] = 0;
-        kvalues[1] = getNumLocalVoxels();
-        kvalues[2] = 0;
-        kvalues[3] = stoichPtr_->getNumVarPools();
-        getBlock( kvalues );
-        dsolvePtr_->setBlock( kvalues );
-    }
+		}
+		setBlock( dvalues );
+	}
+	// Second, take the arrived xCompt reac values and update S with them.
+	// Here the roundoff issues are handled by the GssaVoxelPools functions
+	for ( unsigned int i = 0; i < xfer_.size(); ++i ) {
+		XferInfo& xf = xfer_[i];
+		// cout << xfer_.size() << "	" << xf.xferVoxel.size() << endl;
+		for ( unsigned int j = 0; j < xf.xferVoxel.size(); ++j ) {
+			pools_[xf.xferVoxel[j]].xferIn( xf, j, &sys_ );
+		}
+	}
+	// Third, record the current value of pools as the reference for the
+	// next cycle.
+	for ( unsigned int i = 0; i < xfer_.size(); ++i ) {
+		XferInfo& xf = xfer_[i];
+		for ( unsigned int j = 0; j < xf.xferVoxel.size(); ++j ) {
+			pools_[xf.xferVoxel[j]].xferOut( j, xf.lastValues, xf.xferPoolIdx );
+		}
+	}
+
+	// Fourth: Fix the rates if we have had any diffusion or xreacs 
+	// happening. This is very inefficient at this point, need to fix.
+	if ( dsolvePtr_ || xfer_.size() > 0 ) {
+		for ( vector< GssaVoxelPools >::iterator 
+					i = pools_.begin(); i != pools_.end(); ++i ) {
+			i->refreshAtot( &sys_ );
+		}
+	}
+	// Fifth, update the mol #s.
+	// First we advance the simulation.
+	for ( vector< GssaVoxelPools >::iterator 
+					i = pools_.begin(); i != pools_.end(); ++i ) {
+		i->advance( p, &sys_ );
+	}
+	if ( useClockedUpdate_ ) { // Check if a clocked stim is to be updated
+		for ( vector< GssaVoxelPools >::iterator 
+					i = pools_.begin(); i != pools_.end(); ++i ) {
+			i->recalcTime( &sys_, p->currTime );
+		}
+	} 
+
+	// Finally, assemble and send the integrated values off for the Dsolve.
+	if ( dsolvePtr_ ) {
+		vector< double > kvalues( 4 );
+		kvalues[0] = 0;
+		kvalues[1] = getNumLocalVoxels();
+		kvalues[2] = 0;
+		kvalues[3] = stoichPtr_->getNumVarPools();
+		getBlock( kvalues );
+		dsolvePtr_->setBlock( kvalues );
+	}
 }
 
 void Gsolve::reinit( const Eref& e, ProcPtr p )
 {
-    if ( !stoichPtr_ )
-        return;
-    if ( !sys_.isReady )
-        rebuildGssaSystem();
-    // First reinit concs.
-    for ( vector< GssaVoxelPools >::iterator
-            i = pools_.begin(); i != pools_.end(); ++i )
-    {
-        i->reinit( &sys_ );
-    }
-
-    // Second, take the arrived xCompt reac values and update S with them.
-    // Here the roundoff issues are handled by the GssaVoxelPools functions
-    for ( unsigned int i = 0; i < xfer_.size(); ++i )
-    {
-        const XferInfo& xf = xfer_[i];
-        for ( unsigned int j = 0; j < xf.xferVoxel.size(); ++j )
-        {
-            pools_[xf.xferVoxel[j]].xferInOnlyProxies(
-                xf.xferPoolIdx, xf.values,
-                stoichPtr_->getNumProxyPools(), j );
-        }
-    }
-    // Third, record the current value of pools as the reference for the
-    // next cycle.
-    for ( unsigned int i = 0; i < xfer_.size(); ++i )
-    {
-        XferInfo& xf = xfer_[i];
-        for ( unsigned int j = 0; j < xf.xferVoxel.size(); ++j )
-        {
-            pools_[xf.xferVoxel[j]].xferOut( j, xf.lastValues, xf.xferPoolIdx );
-        }
-    }
-    // Fourth, update the atots.
-    for ( vector< GssaVoxelPools >::iterator
-            i = pools_.begin(); i != pools_.end(); ++i )
-    {
-        i->refreshAtot( &sys_ );
-    }
+	if ( !stoichPtr_ )
+		return;
+	if ( !sys_.isReady )
+		rebuildGssaSystem();
+	// First reinit concs.
+	for ( vector< GssaVoxelPools >::iterator 
+					i = pools_.begin(); i != pools_.end(); ++i ) {
+		i->reinit( &sys_ );
+	}
+	
+	// Second, take the arrived xCompt reac values and update S with them.
+	// Here the roundoff issues are handled by the GssaVoxelPools functions
+	for ( unsigned int i = 0; i < xfer_.size(); ++i ) {
+		const XferInfo& xf = xfer_[i];
+		for ( unsigned int j = 0; j < xf.xferVoxel.size(); ++j ) {
+			pools_[xf.xferVoxel[j]].xferInOnlyProxies( 
+					xf.xferPoolIdx, xf.values, 
+					stoichPtr_->getNumProxyPools(), j );
+		}
+	}
+	// Third, record the current value of pools as the reference for the
+	// next cycle.
+	for ( unsigned int i = 0; i < xfer_.size(); ++i ) {
+		XferInfo& xf = xfer_[i];
+		for ( unsigned int j = 0; j < xf.xferVoxel.size(); ++j ) {
+			pools_[xf.xferVoxel[j]].xferOut( j, xf.lastValues, xf.xferPoolIdx );
+		}
+	}
+	// Fourth, update the atots.
+	for ( vector< GssaVoxelPools >::iterator 
+					i = pools_.begin(); i != pools_.end(); ++i ) {
+		i->refreshAtot( &sys_ );
+	}
 }
 
 //////////////////////////////////////////////////////////////
@@ -529,46 +490,41 @@ void Gsolve::reinit( const Eref& e, ProcPtr p )
 //////////////////////////////////////////////////////////////
 void Gsolve::initProc( const Eref& e, ProcPtr p )
 {
-    if ( !stoichPtr_ )
-        return;
-    // vector< vector< double > > values( xfer_.size() );
-    for ( unsigned int i = 0; i < xfer_.size(); ++i )
-    {
-        XferInfo& xf = xfer_[i];
-        unsigned int size = xf.xferPoolIdx.size() * xf.xferVoxel.size();
-        // values[i].resize( size, 0.0 );
-        vector< double > values( size, 0.0 );
-        for ( unsigned int j = 0; j < xf.xferVoxel.size(); ++j )
-        {
-            unsigned int vox = xf.xferVoxel[j];
-            pools_[vox].xferOut( j, values, xf.xferPoolIdx );
-        }
-        xComptOut()->sendTo( e, xf.ksolve, e.id(), values );
-    }
+	if ( !stoichPtr_ )
+		return;
+	// vector< vector< double > > values( xfer_.size() );
+	for ( unsigned int i = 0; i < xfer_.size(); ++i ) {
+		XferInfo& xf = xfer_[i];
+		unsigned int size = xf.xferPoolIdx.size() * xf.xferVoxel.size();
+		// values[i].resize( size, 0.0 );
+		vector< double > values( size, 0.0 );
+		for ( unsigned int j = 0; j < xf.xferVoxel.size(); ++j ) {
+			unsigned int vox = xf.xferVoxel[j];
+			pools_[vox].xferOut( j, values, xf.xferPoolIdx );
+		}
+		xComptOut()->sendTo( e, xf.ksolve, e.id(), values );
+	}
 }
 
 void Gsolve::initReinit( const Eref& e, ProcPtr p )
 {
-    if ( !stoichPtr_ )
-        return;
-    for ( unsigned int i = 0 ; i < pools_.size(); ++i )
-    {
-        pools_[i].reinit( &sys_ );
-    }
-    // vector< vector< double > > values( xfer_.size() );
-    for ( unsigned int i = 0; i < xfer_.size(); ++i )
-    {
-        XferInfo& xf = xfer_[i];
-        unsigned int size = xf.xferPoolIdx.size() * xf.xferVoxel.size();
-        xf.lastValues.assign( size, 0.0 );
-        for ( unsigned int j = 0; j < xf.xferVoxel.size(); ++j )
-        {
-            unsigned int vox = xf.xferVoxel[j];
-            pools_[ vox ].xferOut( j, xf.lastValues, xf.xferPoolIdx );
-            // values[i] = xf.lastValues;
-        }
-        xComptOut()->sendTo( e, xf.ksolve, e.id(), xf.lastValues );
-    }
+	if ( !stoichPtr_ )
+		return;
+	for ( unsigned int i = 0 ; i < pools_.size(); ++i ) {
+		pools_[i].reinit( &sys_ );
+	}
+	// vector< vector< double > > values( xfer_.size() );
+	for ( unsigned int i = 0; i < xfer_.size(); ++i ) {
+		XferInfo& xf = xfer_[i];
+		unsigned int size = xf.xferPoolIdx.size() * xf.xferVoxel.size();
+		xf.lastValues.assign( size, 0.0 );
+		for ( unsigned int j = 0; j < xf.xferVoxel.size(); ++j ) {
+			unsigned int vox = xf.xferVoxel[j];
+			pools_[ vox ].xferOut( j, xf.lastValues, xf.xferPoolIdx );
+			// values[i] = xf.lastValues;
+		}
+		xComptOut()->sendTo( e, xf.ksolve, e.id(), xf.lastValues );
+	}
 }
 //////////////////////////////////////////////////////////////
 // Solver setup
@@ -576,28 +532,26 @@ void Gsolve::initReinit( const Eref& e, ProcPtr p )
 
 void Gsolve::rebuildGssaSystem()
 {
-    stoichPtr_->convertRatesToStochasticForm();
-    sys_.transposeN = stoichPtr_->getStoichiometryMatrix();
-    sys_.transposeN.transpose();
-    sys_.transposeN.truncateRow( stoichPtr_->getNumVarPools() + stoichPtr_->getNumProxyPools() );
-    vector< vector< unsigned int > > & dep = sys_.dependency;
-    dep.resize( stoichPtr_->getNumRates() );
-    for ( unsigned int i = 0; i < stoichPtr_->getNumRates(); ++i )
-    {
-        sys_.transposeN.getGillespieDependence( i, dep[i] );
-    }
-    fillMmEnzDep();
-    fillPoolFuncDep();
-    fillIncrementFuncDep();
-    makeReacDepsUnique();
-    for ( vector< GssaVoxelPools >::iterator
-            i = pools_.begin(); i != pools_.end(); ++i )
-    {
-        i->setNumReac( stoichPtr_->getNumRates() );
-        i->updateAllRateTerms( stoichPtr_->getRateTerms(),
-                               stoichPtr_->getNumCoreRates() );
-    }
-    sys_.isReady = true;
+	stoichPtr_->convertRatesToStochasticForm();
+	sys_.transposeN = stoichPtr_->getStoichiometryMatrix();
+	sys_.transposeN.transpose();
+	sys_.transposeN.truncateRow( stoichPtr_->getNumVarPools() + stoichPtr_->getNumProxyPools() );
+	vector< vector< unsigned int > > & dep = sys_.dependency;
+	dep.resize( stoichPtr_->getNumRates() );
+	for ( unsigned int i = 0; i < stoichPtr_->getNumRates(); ++i ) {
+		sys_.transposeN.getGillespieDependence( i, dep[i] );
+	}
+	fillMmEnzDep();
+	fillPoolFuncDep();
+	fillIncrementFuncDep();
+	makeReacDepsUnique();
+	for ( vector< GssaVoxelPools >::iterator 
+					i = pools_.begin(); i != pools_.end(); ++i ) {
+		i->setNumReac( stoichPtr_->getNumRates() );
+		i->updateAllRateTerms( stoichPtr_->getRateTerms(), 
+						stoichPtr_->getNumCoreRates() );
+	}
+	sys_.isReady = true;
 }
 
 /**
@@ -608,48 +562,44 @@ void Gsolve::rebuildGssaSystem()
  */
 void Gsolve::fillMmEnzDep()
 {
-    unsigned int numRates = stoichPtr_->getNumRates();
-    vector< unsigned int > indices;
-
-    // Make a map to look up enzyme RateTerm using
-    // the key of the enzyme molecule.
-    map< unsigned int, unsigned int > enzMolMap;
-    for ( unsigned int i = 0; i < numRates; ++i )
-    {
-        const MMEnzymeBase* mme = dynamic_cast< const MMEnzymeBase* >(
-                                      stoichPtr_->rates( i ) );
-        if ( mme )
-        {
-            vector< unsigned int > reactants;
-            mme->getReactants( reactants );
-            if ( reactants.size() > 1 )
-                enzMolMap[ reactants.front() ] = i; // front is enzyme.
-        }
-    }
-
-    // Use the map to fill in deps.
-    for ( unsigned int i = 0; i < numRates; ++i )
-    {
-        // Extract the row of all molecules that depend on the reac.
-        const int* entry;
-        const unsigned int* colIndex;
-
-        unsigned int numInRow =
-            sys_.transposeN.getRow( i, &entry, &colIndex );
-        for( unsigned int j = 0; j < numInRow; ++j )
-        {
-            map< unsigned int, unsigned int >::iterator pos =
-                enzMolMap.find( colIndex[j] );
-            if ( pos != enzMolMap.end() )
-                sys_.dependency[i].push_back( pos->second );
-        }
-    }
+	unsigned int numRates = stoichPtr_->getNumRates();
+	vector< unsigned int > indices;
+
+	// Make a map to look up enzyme RateTerm using 
+	// the key of the enzyme molecule.
+	map< unsigned int, unsigned int > enzMolMap;
+	for ( unsigned int i = 0; i < numRates; ++i ) {
+		const MMEnzymeBase* mme = dynamic_cast< const MMEnzymeBase* >(
+			stoichPtr_->rates( i ) );
+		if ( mme ) {
+			vector< unsigned int > reactants;
+			mme->getReactants( reactants );
+			if ( reactants.size() > 1 )
+				enzMolMap[ reactants.front() ] = i; // front is enzyme.
+		}
+	}
+
+	// Use the map to fill in deps.
+	for ( unsigned int i = 0; i < numRates; ++i ) {
+		// Extract the row of all molecules that depend on the reac.
+		const int* entry;
+		const unsigned int* colIndex;
+
+		unsigned int numInRow = 
+				sys_.transposeN.getRow( i, &entry, &colIndex );
+		for( unsigned int j = 0; j < numInRow; ++j ) {
+			map< unsigned int, unsigned int >::iterator pos = 
+				enzMolMap.find( colIndex[j] );
+			if ( pos != enzMolMap.end() )
+				sys_.dependency[i].push_back( pos->second );
+		}
+	}
 }
 
 /**
  * Here we fill in the dependencies involving poolFuncs. These are
  * the functions that evaluate an expression and assign directly to the
- * # of a target molecule.
+ * # of a target molecule. 
  * There are two dependencies:
  * 1. When a reaction fires, all the Functions that depend on the reactants
  * must update their target molecule. This is in sys_.dependentMathExpn[].
@@ -659,59 +609,55 @@ void Gsolve::fillMmEnzDep()
  */
 void Gsolve::fillPoolFuncDep()
 {
-    // create map of funcs that depend on specified molecule.
-    vector< vector< unsigned int > > funcMap(
-        stoichPtr_->getNumAllPools() );
-    unsigned int numFuncs = stoichPtr_->getNumFuncs();
-    for ( unsigned int i = 0; i < numFuncs; ++i )
-    {
-        const FuncTerm *f = stoichPtr_->funcs( i );
-        vector< unsigned int > molIndex = f->getReactantIndex();
-        for ( unsigned int j = 0; j < molIndex.size(); ++j )
-            funcMap[ molIndex[j] ].push_back( i );
-    }
-    // The output of each func is a mol indexed as
-    // numVarMols + numBufMols + i
-    unsigned int numRates = stoichPtr_->getNumRates();
-    sys_.dependentMathExpn.resize( numRates );
-    vector< unsigned int > indices;
-    for ( unsigned int i = 0; i < numRates; ++i )
-    {
-        vector< unsigned int >& dep = sys_.dependentMathExpn[ i ];
-        dep.resize( 0 );
-        // Extract the row of all molecules that depend on the reac.
-        const int* entry;
-        const unsigned int* colIndex;
-        unsigned int numInRow =
-            sys_.transposeN.getRow( i, &entry, &colIndex );
-        for ( unsigned int j = 0; j < numInRow; ++j )
-        {
-            unsigned int molIndex = colIndex[j];
-            vector< unsigned int >& funcs = funcMap[ molIndex ];
-            dep.insert( dep.end(), funcs.begin(), funcs.end() );
-            for ( unsigned int k = 0; k < funcs.size(); ++k )
-            {
-                // unsigned int outputMol = funcs[k] + funcOffset;
-                unsigned int outputMol = stoichPtr_->funcs( funcs[k] )->getTarget();
-                // Insert reac deps here. Columns are reactions.
-                vector< int > e; // Entries: we don't need.
-                vector< unsigned int > c; // Column index: the reactions.
-                stoichPtr_->getStoichiometryMatrix().
-                getRow( outputMol, e, c );
-                // Each of the reacs (col entries) depend on this func.
-                vector< unsigned int > rdep = sys_.dependency[i];
-                rdep.insert( rdep.end(), c.begin(), c.end() );
-            }
-        }
-    }
+	// create map of funcs that depend on specified molecule.
+	vector< vector< unsigned int > > funcMap( 
+			stoichPtr_->getNumAllPools() );
+	unsigned int numFuncs = stoichPtr_->getNumFuncs();
+	for ( unsigned int i = 0; i < numFuncs; ++i ) {
+		const FuncTerm *f = stoichPtr_->funcs( i );
+		vector< unsigned int > molIndex = f->getReactantIndex();
+		for ( unsigned int j = 0; j < molIndex.size(); ++j )
+			funcMap[ molIndex[j] ].push_back( i );
+	}
+	// The output of each func is a mol indexed as 
+	// numVarMols + numBufMols + i
+	unsigned int numRates = stoichPtr_->getNumRates();
+	sys_.dependentMathExpn.resize( numRates );
+	vector< unsigned int > indices;
+	for ( unsigned int i = 0; i < numRates; ++i ) {
+		vector< unsigned int >& dep = sys_.dependentMathExpn[ i ];
+		dep.resize( 0 );
+		// Extract the row of all molecules that depend on the reac.
+		const int* entry;
+		const unsigned int* colIndex;
+		unsigned int numInRow = 
+				sys_.transposeN.getRow( i, &entry, &colIndex );
+		for ( unsigned int j = 0; j < numInRow; ++j ) {
+			unsigned int molIndex = colIndex[j];
+			vector< unsigned int >& funcs = funcMap[ molIndex ];
+			dep.insert( dep.end(), funcs.begin(), funcs.end() );
+			for ( unsigned int k = 0; k < funcs.size(); ++k ) {
+				// unsigned int outputMol = funcs[k] + funcOffset;
+				unsigned int outputMol = stoichPtr_->funcs( funcs[k] )->getTarget();
+				// Insert reac deps here. Columns are reactions.
+				vector< int > e; // Entries: we don't need.
+				vector< unsigned int > c; // Column index: the reactions.
+				stoichPtr_->getStoichiometryMatrix().
+						getRow( outputMol, e, c );
+				// Each of the reacs (col entries) depend on this func.
+				vector< unsigned int > rdep = sys_.dependency[i];
+				rdep.insert( rdep.end(), c.begin(), c.end() );
+			}
+		}
+	}
 }
 
 /**
  * Here we fill in the dependencies involving incrementFuncs. These are
  * the functions that evaluate an expression that specifies rate of change
- * of # of a target molecule.
+ * of # of a target molecule. 
  * There are two dependencies:
- * 1. When a reaction fires, all the incrementFuncs that depend on the
+ * 1. When a reaction fires, all the incrementFuncs that depend on the 
  * reactants must update their rates. This is added to sys_.dependency[]
  * which is the usual handler for reac dependencies. Note that the inputs
  * to the incrementFuncs are NOT present in the stoichiometry matrix, so
@@ -722,67 +668,62 @@ void Gsolve::fillPoolFuncDep()
  */
 void Gsolve::fillIncrementFuncDep()
 {
-    // create map of funcs that depend on specified molecule.
-    vector< vector< unsigned int > > funcMap(
-        stoichPtr_->getNumAllPools() );
-    const vector< RateTerm* >& rates = stoichPtr_->getRateTerms();
-    vector< FuncRate* > incrementRates;
-    vector< unsigned int > incrementRateIndex;
-    const vector< RateTerm* >::const_iterator q;
-    for ( unsigned int i = 0; i < rates.size(); ++i )
-    {
-        FuncRate *term =
-            dynamic_cast< FuncRate* >( rates[i] );
-        if (term)
-        {
-            incrementRates.push_back( term );
-            incrementRateIndex.push_back( i );
-        }
-    }
-
-    for ( unsigned int k = 0; k < incrementRates.size(); ++k )
-    {
-        const vector< unsigned int >& molIndex =
-            incrementRates[k]->getFuncArgIndex();
-        for ( unsigned int j = 0; j < molIndex.size(); ++j )
-            funcMap[ molIndex[j] ].push_back( incrementRateIndex[k] );
-    }
-
-    unsigned int numRates = stoichPtr_->getNumRates();
-    sys_.dependentMathExpn.resize( numRates );
-    vector< unsigned int > indices;
-    for ( unsigned int i = 0; i < numRates; ++i )
-    {
-        // Algorithm:
-        // 1.Go through stoich matrix finding all the poolIndices affected
-        // by each Rate Term.
-        // 2.Use funcMap to look up FuncRateTerms affected by these indices
-        // 3. Add the rateTerm->FuncRateTerm mapping to the dependencies.
-
-        const int* entry;
-        const unsigned int* colIndex;
-        unsigned int numInRow =
-            sys_.transposeN.getRow( i, &entry, &colIndex );
-        // 1.Go through stoich matrix finding all the poolIndices affected
-        // by each Rate Term.
-        for ( unsigned int j = 0; j < numInRow; ++j )
-        {
-            unsigned int molIndex = colIndex[j]; // Affected poolIndex
-
-            // 2.Use funcMap to look up FuncRateTerms affected by these indices
-            vector< unsigned int >& funcs = funcMap[ molIndex ];
-            // 3. Add the rateTerm->FuncRateTerm mapping to the dependencies.
-            vector< unsigned int >& rdep = sys_.dependency[i];
-            rdep.insert( rdep.end(), funcs.begin(), funcs.end() );
-        }
-    }
+	// create map of funcs that depend on specified molecule.
+	vector< vector< unsigned int > > funcMap( 
+			stoichPtr_->getNumAllPools() );
+	const vector< RateTerm* >& rates = stoichPtr_->getRateTerms();
+	vector< FuncRate* > incrementRates;
+	vector< unsigned int > incrementRateIndex;
+	const vector< RateTerm* >::const_iterator q;
+	for ( unsigned int i = 0; i < rates.size(); ++i ) {
+		FuncRate *term = 
+			dynamic_cast< FuncRate* >( rates[i] );
+		if (term) {
+			incrementRates.push_back( term );
+			incrementRateIndex.push_back( i );
+		}
+	}
+
+	for ( unsigned int k = 0; k < incrementRates.size(); ++k ) {
+		const vector< unsigned int >& molIndex = 
+				incrementRates[k]->getFuncArgIndex();
+		for ( unsigned int j = 0; j < molIndex.size(); ++j )
+			funcMap[ molIndex[j] ].push_back( incrementRateIndex[k] );
+	}
+		
+	unsigned int numRates = stoichPtr_->getNumRates();
+	sys_.dependentMathExpn.resize( numRates );
+	vector< unsigned int > indices;
+	for ( unsigned int i = 0; i < numRates; ++i ) {
+		// Algorithm:
+		// 1.Go through stoich matrix finding all the poolIndices affected
+		// by each Rate Term.
+		// 2.Use funcMap to look up FuncRateTerms affected by these indices
+		// 3. Add the rateTerm->FuncRateTerm mapping to the dependencies.
+
+		const int* entry;
+		const unsigned int* colIndex;
+		unsigned int numInRow = 
+				sys_.transposeN.getRow( i, &entry, &colIndex );
+		// 1.Go through stoich matrix finding all the poolIndices affected
+		// by each Rate Term.
+		for ( unsigned int j = 0; j < numInRow; ++j ) { 
+			unsigned int molIndex = colIndex[j]; // Affected poolIndex
+
+		// 2.Use funcMap to look up FuncRateTerms affected by these indices
+			vector< unsigned int >& funcs = funcMap[ molIndex ];
+		// 3. Add the rateTerm->FuncRateTerm mapping to the dependencies.
+			vector< unsigned int >& rdep = sys_.dependency[i];
+			rdep.insert( rdep.end(), funcs.begin(), funcs.end() );
+		}
+	}
 }
 
 /*
 void Gsolve::fillMathDep()
 {
 	// create map of funcs that depend on specified molecule.
-	vector< vector< unsigned int > > funcMap(
+	vector< vector< unsigned int > > funcMap( 
 			stoichPtr_->getNumAllPools() );
 	unsigned int numFuncs = stoichPtr_->getNumFuncs();
 	for ( unsigned int i = 0; i < numFuncs; ++i ) {
@@ -791,9 +732,9 @@ void Gsolve::fillMathDep()
 		for ( unsigned int j = 0; j < molIndex.size(); ++j )
 			funcMap[ molIndex[j] ].push_back( i );
 	}
-	// The output of each func is a mol indexed as
+	// The output of each func is a mol indexed as 
 	// numVarMols + numBufMols + i
-	unsigned int funcOffset =
+	unsigned int funcOffset = 
 			stoichPtr_->getNumVarPools() + stoichPtr_->getNumProxyPools() + stoichPtr_->getNumBufPools();
 	unsigned int numRates = stoichPtr_->getNumRates();
 	sys_.dependentMathExpn.resize( numRates );
@@ -804,7 +745,7 @@ void Gsolve::fillMathDep()
 		// Extract the row of all molecules that depend on the reac.
 		const int* entry;
 		const unsigned int* colIndex;
-		unsigned int numInRow =
+		unsigned int numInRow = 
 				sys_.transposeN.getRow( i, &entry, &colIndex );
 		for ( unsigned int j = 0; j < numInRow; ++j ) {
 			unsigned int molIndex = colIndex[j];
@@ -832,39 +773,38 @@ void Gsolve::fillMathDep()
  * Later.
  */
 void Gsolve::insertMathDepReacs( unsigned int mathDepIndex,
-                                 unsigned int firedReac )
+	unsigned int firedReac )
 {
-    /*
-    unsigned int molIndex = sumTotals_[ mathDepIndex ].target( S_ );
-    vector< unsigned int > reacIndices;
-
-    // Extract the row of all reacs that depend on the target molecule
-    if ( N_.getRowIndices( molIndex, reacIndices ) > 0 ) {
-    	vector< unsigned int >& dep = dependency_[ firedReac ];
-    	dep.insert( dep.end(), reacIndices.begin(), reacIndices.end() );
-    }
-    */
+	/*
+	unsigned int molIndex = sumTotals_[ mathDepIndex ].target( S_ );
+	vector< unsigned int > reacIndices;
+
+	// Extract the row of all reacs that depend on the target molecule
+	if ( N_.getRowIndices( molIndex, reacIndices ) > 0 ) {
+		vector< unsigned int >& dep = dependency_[ firedReac ];
+		dep.insert( dep.end(), reacIndices.begin(), reacIndices.end() );
+	}
+	*/
 }
 
 // Clean up dependency lists: Ensure only unique entries.
 // Also a reac cannot depend on itself.
 void Gsolve::makeReacDepsUnique()
 {
-    unsigned int numRates = stoichPtr_->getNumRates();
-    for ( unsigned int i = 0; i < numRates; ++i )
-    {
-        vector< unsigned int >& dep = sys_.dependency[ i ];
-        // Here we want to remove self-entries as well as duplicates.
-        sort( dep.begin(), dep.end() );
-        vector< unsigned int >::iterator k = dep.begin();
-
-        /// STL stuff follows, with the usual weirdness.
-        vector< unsigned int >::iterator pos =
-            unique( dep.begin(), dep.end() );
-        dep.resize( pos - dep.begin() );
-        /*
-        */
-    }
+	unsigned int numRates = stoichPtr_->getNumRates();
+	for ( unsigned int i = 0; i < numRates; ++i ) {
+		vector< unsigned int >& dep = sys_.dependency[ i ];
+		// Here we want to remove self-entries as well as duplicates.
+		sort( dep.begin(), dep.end() );
+		vector< unsigned int >::iterator k = dep.begin();
+
+		/// STL stuff follows, with the usual weirdness.
+		vector< unsigned int >::iterator pos = 
+			unique( dep.begin(), dep.end() );
+		dep.resize( pos - dep.begin() );
+		/*
+		*/
+	}
 }
 
 //////////////////////////////////////////////////////////////
@@ -872,36 +812,31 @@ void Gsolve::makeReacDepsUnique()
 //////////////////////////////////////////////////////////////
 unsigned int Gsolve::getPoolIndex( const Eref& e ) const
 {
-    return stoichPtr_->convertIdToPoolIndex( e.id() );
+	return stoichPtr_->convertIdToPoolIndex( e.id() );
 }
 
 unsigned int Gsolve::getVoxelIndex( const Eref& e ) const
 {
-    unsigned int ret = e.dataIndex();
-    if ( ret < startVoxel_  || ret >= startVoxel_ + pools_.size() )
-        return OFFNODE;
-    return ret - startVoxel_;
+	unsigned int ret = e.dataIndex();
+	if ( ret < startVoxel_  || ret >= startVoxel_ + pools_.size() ) 
+		return OFFNODE;
+	return ret - startVoxel_;
 }
 
 void Gsolve::setDsolve( Id dsolve )
 {
-    if ( dsolve == Id () )
-    {
-        dsolvePtr_ = 0;
-        dsolve_ = Id();
-    }
-    else if ( dsolve.element()->cinfo()->isA( "Dsolve" ) )
-    {
-        dsolve_ = dsolve;
-        dsolvePtr_ = reinterpret_cast< ZombiePoolInterface* >(
-                         dsolve.eref().data() );
-    }
-    else
-    {
-        cout << "Warning: Gsolve::setDsolve: Object '" << dsolve.path() <<
-             "' should be class Dsolve, is: " <<
-             dsolve.element()->cinfo()->name() << endl;
-    }
+	if ( dsolve == Id () ) {
+		dsolvePtr_ = 0;
+		dsolve_ = Id();
+	} else if ( dsolve.element()->cinfo()->isA( "Dsolve" ) ) {
+		dsolve_ = dsolve;
+		dsolvePtr_ = reinterpret_cast< ZombiePoolInterface* >( 
+						dsolve.eref().data() );
+	} else {
+		cout << "Warning: Gsolve::setDsolve: Object '" << dsolve.path() <<
+				"' should be class Dsolve, is: " << 
+				dsolve.element()->cinfo()->name() << endl;
+	}
 }
 
 
@@ -911,185 +846,166 @@ void Gsolve::setDsolve( Id dsolve )
 
 void Gsolve::setN( const Eref& e, double v )
 {
-    unsigned int vox = getVoxelIndex( e );
-    if ( vox != OFFNODE )
-    {
-        if ( e.element()->cinfo()->isA( "ZombieBufPool" ) )
-        {
-            // Do NOT round it here, it is folded into rate term.
-            pools_[vox].setN( getPoolIndex( e ), v );
-            // refresh rates because nInit controls ongoing value of n.
-            if ( sys_.isReady )
-                pools_[vox].refreshAtot( &sys_ );
-        }
-        else
-        {
-            pools_[vox].setN( getPoolIndex( e ), round( v ) );
-        }
-    }
+	unsigned int vox = getVoxelIndex( e );
+	if ( vox != OFFNODE ) {
+		if ( e.element()->cinfo()->isA( "ZombieBufPool" ) ) {
+			// Do NOT round it here, it is folded into rate term.
+			pools_[vox].setN( getPoolIndex( e ), v );
+			// refresh rates because nInit controls ongoing value of n.
+			if ( sys_.isReady )
+				pools_[vox].refreshAtot( &sys_ ); 
+		} else {
+			pools_[vox].setN( getPoolIndex( e ), round( v ) );
+		}
+	}
 }
 
 double Gsolve::getN( const Eref& e ) const
 {
-    unsigned int vox = getVoxelIndex( e );
-    if ( vox != OFFNODE )
-        return pools_[vox].getN( getPoolIndex( e ) );
-    return 0.0;
+	unsigned int vox = getVoxelIndex( e );
+	if ( vox != OFFNODE )
+		return pools_[vox].getN( getPoolIndex( e ) );
+	return 0.0;
 }
 
 void Gsolve::setNinit( const Eref& e, double v )
 {
-    unsigned int vox = getVoxelIndex( e );
-    if ( vox != OFFNODE )
-    {
-        if ( e.element()->cinfo()->isA( "ZombieBufPool" ) )
-        {
-            // Do NOT round it here, it is folded into rate term.
-            pools_[vox].setNinit( getPoolIndex( e ), v );
-            // refresh rates because nInit controls ongoing value of n.
-            if ( sys_.isReady )
-                pools_[vox].refreshAtot( &sys_ );
-        }
-        else
-        {
-            // I now do the rounding at reinit time. It is better there as
-            // it can give a distinct value each cycle. It is also better
-            // to keep the full resolution of Ninit for volume scaling.
-            // pools_[vox].setNinit( getPoolIndex( e ), round( v ) );
-            pools_[vox].setNinit( getPoolIndex( e ), v );
-        }
-    }
+	unsigned int vox = getVoxelIndex( e );
+	if ( vox != OFFNODE ) {
+		if ( e.element()->cinfo()->isA( "ZombieBufPool" ) ) {
+			// Do NOT round it here, it is folded into rate term.
+			pools_[vox].setNinit( getPoolIndex( e ), v );
+			// refresh rates because nInit controls ongoing value of n.
+			if ( sys_.isReady )
+				pools_[vox].refreshAtot( &sys_ ); 
+		} else {
+			// I now do the rounding at reinit time. It is better there as
+			// it can give a distinct value each cycle. It is also better
+			// to keep the full resolution of Ninit for volume scaling.
+			// pools_[vox].setNinit( getPoolIndex( e ), round( v ) );
+			pools_[vox].setNinit( getPoolIndex( e ), v );
+		}
+	}
 }
 
 double Gsolve::getNinit( const Eref& e ) const
 {
-    unsigned int vox = getVoxelIndex( e );
-    if ( vox != OFFNODE )
-        return pools_[vox].getNinit( getPoolIndex( e ) );
-    return 0.0;
+	unsigned int vox = getVoxelIndex( e );
+	if ( vox != OFFNODE )
+		return pools_[vox].getNinit( getPoolIndex( e ) );
+	return 0.0;
 }
 
 void Gsolve::setDiffConst( const Eref& e, double v )
 {
-    ; // Do nothing.
+		; // Do nothing.
 }
 
 double Gsolve::getDiffConst( const Eref& e ) const
 {
-    return 0;
+		return 0;
 }
 
 void Gsolve::setNumPools( unsigned int numPoolSpecies )
 {
-    sys_.isReady = false;
-    unsigned int numVoxels = pools_.size();
-    for ( unsigned int i = 0 ; i < numVoxels; ++i )
-    {
-        pools_[i].resizeArrays( numPoolSpecies );
-    }
+	sys_.isReady = false;
+	unsigned int numVoxels = pools_.size();
+	for ( unsigned int i = 0 ; i < numVoxels; ++i ) {
+		pools_[i].resizeArrays( numPoolSpecies );
+	}
 }
 
 unsigned int Gsolve::getNumPools() const
 {
-    if ( pools_.size() > 0 )
-        return pools_[0].size();
-    return 0;
+	if ( pools_.size() > 0 )
+		return pools_[0].size();
+	return 0;
 }
 
 void Gsolve::getBlock( vector< double >& values ) const
 {
-    unsigned int startVoxel = values[0];
-    unsigned int numVoxels = values[1];
-    unsigned int startPool = values[2];
-    unsigned int numPools = values[3];
-
-    assert( startVoxel >= startVoxel_ );
-    assert( numVoxels <= pools_.size() );
-    assert( pools_.size() > 0 );
-    assert( numPools + startPool <= pools_[0].size() );
-    values.resize( 4 + numVoxels * numPools );
-
-    for ( unsigned int i = 0; i < numVoxels; ++i )
-    {
-        const double* v = pools_[ startVoxel + i ].S();
-        for ( unsigned int j = 0; j < numPools; ++j )
-        {
-            values[ 4 + j * numVoxels + i]  = v[ j + startPool ];
-        }
-    }
+	unsigned int startVoxel = values[0];
+	unsigned int numVoxels = values[1];
+	unsigned int startPool = values[2];
+	unsigned int numPools = values[3];
+
+	assert( startVoxel >= startVoxel_ );
+	assert( numVoxels <= pools_.size() );
+	assert( pools_.size() > 0 );
+	assert( numPools + startPool <= pools_[0].size() );
+	values.resize( 4 + numVoxels * numPools );
+
+	for ( unsigned int i = 0; i < numVoxels; ++i ) {
+		const double* v = pools_[ startVoxel + i ].S();
+		for ( unsigned int j = 0; j < numPools; ++j ) {
+			values[ 4 + j * numVoxels + i]  = v[ j + startPool ];
+		}
+	}
 }
 
 void Gsolve::setBlock( const vector< double >& values )
 {
-    unsigned int startVoxel = values[0];
-    unsigned int numVoxels = values[1];
-    unsigned int startPool = values[2];
-    unsigned int numPools = values[3];
-
-    assert( startVoxel >= startVoxel_ );
-    assert( numVoxels <= pools_.size() );
-    assert( pools_.size() > 0 );
-    assert( numPools + startPool <= pools_[0].size() );
-
-    for ( unsigned int i = 0; i < numVoxels; ++i )
-    {
-        double* v = pools_[ startVoxel + i ].varS();
-        for ( unsigned int j = 0; j < numPools; ++j )
-        {
-            v[ j + startPool ] = values[ 4 + j * numVoxels + i ];
-        }
-    }
+	unsigned int startVoxel = values[0];
+	unsigned int numVoxels = values[1];
+	unsigned int startPool = values[2];
+	unsigned int numPools = values[3];
+
+	assert( startVoxel >= startVoxel_ );
+	assert( numVoxels <= pools_.size() );
+	assert( pools_.size() > 0 );
+	assert( numPools + startPool <= pools_[0].size() );
+
+	for ( unsigned int i = 0; i < numVoxels; ++i ) {
+		double* v = pools_[ startVoxel + i ].varS();
+		for ( unsigned int j = 0; j < numPools; ++j ) {
+			v[ j + startPool ] = values[ 4 + j * numVoxels + i ];
+		}
+	}
 }
 
 //////////////////////////////////////////////////////////////////////////
 void Gsolve::updateVoxelVol( vector< double > vols )
 {
-    // For now we assume identical numbers of voxels. Also assume
-    // identical voxel junctions. But it should not be too hard to
-    // update those too.
-    if ( vols.size() == pools_.size() )
-    {
-        for ( unsigned int i = 0; i < vols.size(); ++i )
-        {
-            pools_[i].setVolumeAndDependencies( vols[i] );
-        }
-        stoichPtr_->setupCrossSolverReacVols();
-        updateRateTerms( ~0U );
-    }
+	// For now we assume identical numbers of voxels. Also assume
+	// identical voxel junctions. But it should not be too hard to
+	// update those too.
+	if ( vols.size() == pools_.size() ) {
+		for ( unsigned int i = 0; i < vols.size(); ++i ) {
+			pools_[i].setVolumeAndDependencies( vols[i] );
+		}
+		stoichPtr_->setupCrossSolverReacVols();
+		updateRateTerms( ~0U );
+	}
 }
 
 void Gsolve::updateRateTerms( unsigned int index )
 {
-    if ( index == ~0U )
-    {
-        // unsigned int numCrossRates = stoichPtr_->getNumRates() - stoichPtr_->getNumCoreRates();
-        for ( unsigned int i = 0 ; i < pools_.size(); ++i )
-        {
-            // pools_[i].resetXreacScale( numCrossRates );
-            pools_[i].updateAllRateTerms( stoichPtr_->getRateTerms(),
-                                          stoichPtr_->getNumCoreRates() );
-        }
-    }
-    else if ( index < stoichPtr_->getNumRates() )
-    {
-        for ( unsigned int i = 0 ; i < pools_.size(); ++i )
-            pools_[i].updateRateTerms( stoichPtr_->getRateTerms(),
-                                       stoichPtr_->getNumCoreRates(), index );
-    }
+	if ( index == ~0U ) {
+		// unsigned int numCrossRates = stoichPtr_->getNumRates() - stoichPtr_->getNumCoreRates();
+		for ( unsigned int i = 0 ; i < pools_.size(); ++i ) {
+			// pools_[i].resetXreacScale( numCrossRates );
+			pools_[i].updateAllRateTerms( stoichPtr_->getRateTerms(),
+						   stoichPtr_->getNumCoreRates() );
+		}
+	} else if ( index < stoichPtr_->getNumRates() ) {
+		for ( unsigned int i = 0 ; i < pools_.size(); ++i )
+			pools_[i].updateRateTerms( stoichPtr_->getRateTerms(),
+						   stoichPtr_->getNumCoreRates(), index );
+	}
 }
 
 //////////////////////////////////////////////////////////////////////////
 
 VoxelPoolsBase* Gsolve::pools( unsigned int i )
 {
-    if ( pools_.size() > i )
-        return &pools_[i];
-    return 0;
+	if ( pools_.size() > i )
+		return &pools_[i];
+	return 0;
 }
 
 double Gsolve::volume( unsigned int i ) const
 {
-    if ( pools_.size() > i )
-        return pools_[i].getVolume();
-    return 0.0;
+	if ( pools_.size() > i )
+		return pools_[i].getVolume();
+	return 0.0;
 }
diff --git a/ksolve/GssaVoxelPools.cpp b/ksolve/GssaVoxelPools.cpp
index 810c9481ee376fd7f87732bad02a3ee88c2b99f3..b74900aa7bf9183474b51e4144c234bb4eaf183a 100644
--- a/ksolve/GssaVoxelPools.cpp
+++ b/ksolve/GssaVoxelPools.cpp
@@ -205,10 +205,10 @@ void GssaVoxelPools::advance( const ProcInfo* p, const GssaSystem* g )
 		numFire_[rindex]++;
 		
         double r = rng_.uniform();
-
-        while ( r == 0.0 )
+        while ( r <= 0.0 )
+        {
             r = rng_.uniform();
-
+        }
         t_ -= ( 1.0 / atot_ ) * log( r );
         // g->stoich->updateFuncs( varS(), t_ ); // Handled next line.
         updateDependentMathExpn( g, rindex, t_ );
@@ -234,7 +234,7 @@ void GssaVoxelPools::reinit( const GssaSystem* g )
             double base = floor( n[i] );
             assert( base >= 0.0 );
             double frac = n[i] - base;
-            if ( rng_.uniform() >= frac )
+            if ( rng_.uniform() > frac )
                 n[i] = base;
             else
                 n[i] = base + 1.0;
@@ -369,9 +369,9 @@ void GssaVoxelPools::xferIn( XferInfo& xf,
     {
         double& x = s[*k];
         // cout << x << "	i = " << *i << *j << "	m = " << *m << endl;
-        double dx = *(i++) - *(j++);
+        double dx = *i++ - *j++;
         double base = floor( dx );
-        if ( rng_.uniform() >= (dx - base) )
+        if ( rng_.uniform() > dx - base )
             x += base;
         else
             x += base + 1.0;
@@ -425,7 +425,7 @@ void GssaVoxelPools::xferInOnlyProxies(
         if ( *k >= stoichPtr_->getNumVarPools() && *k < proxyEndIndex )
         {
             double base = floor( *i );
-            if ( rng_.uniform() >= (*i - base) )
+            if ( rng_.uniform() > *i - base )
                 varSinit()[*k] = (varS()[*k] += base );
             else
                 varSinit()[*k] = (varS()[*k] += base + 1.0 );
diff --git a/ksolve/KinSparseMatrix.cpp b/ksolve/KinSparseMatrix.cpp
index 431fb858fd2c7ad30a7a1298e2df3c22e8fda1c6..a83e12ae75c6624ee0eb5b988b73c313350cf483 100644
--- a/ksolve/KinSparseMatrix.cpp
+++ b/ksolve/KinSparseMatrix.cpp
@@ -164,6 +164,21 @@ void makeVecUnique( vector< unsigned int >& v )
 	v.resize( pos - v.begin() );
 }
 
+vector< int > KinSparseMatrix::matrixEntry() const 
+{
+	return N_;
+}
+
+vector< unsigned int > KinSparseMatrix::colIndex() const
+{
+	return colIndex_;
+}
+
+vector< unsigned int > KinSparseMatrix::rowStart() const
+{
+	return rowStart_;
+}
+
 
 #ifdef DO_UNIT_TESTS
 #include "header.h"
diff --git a/ksolve/KinSparseMatrix.h b/ksolve/KinSparseMatrix.h
index 3d316738f63ba2e7544a65cdbde639ef78be8337..9d18c262d32f8ff147e20ab0d04fd0b79fcec787 100644
--- a/ksolve/KinSparseMatrix.h
+++ b/ksolve/KinSparseMatrix.h
@@ -61,6 +61,10 @@ class KinSparseMatrix: public SparseMatrix< int >
         */
         void truncateRow( unsigned int maxColumnIndex );
 
+		/// Here we expose the sparse matrix for MOOSE use.
+		vector< int > matrixEntry() const;
+		vector< unsigned int > colIndex() const;
+		vector< unsigned int > rowStart() const;
 	private:
  		/**
          * End colIndex for rows (molecules in the transposed matrix)
diff --git a/ksolve/ZombieBufPool.cpp b/ksolve/ZombieBufPool.cpp
index 826655299061397f79ccd60177a83c4310831960..a00a6499c7fb5a5351a48ba6270c8ed21078287c 100644
--- a/ksolve/ZombieBufPool.cpp
+++ b/ksolve/ZombieBufPool.cpp
@@ -72,7 +72,3 @@ void ZombieBufPool::vSetConcInit( const Eref& e, double conc )
 	vSetConc( e, conc );
 }
 
-bool ZombieBufPool::vGetIsBuffered( const Eref& e ) const
-{
-	return true;
-}
diff --git a/ksolve/ZombieBufPool.h b/ksolve/ZombieBufPool.h
index 6ebdf8bca32e39f69f0ea9856ce0779734239254..72d0a2006e671badde6e67bd0d0eef8e51f1c693 100644
--- a/ksolve/ZombieBufPool.h
+++ b/ksolve/ZombieBufPool.h
@@ -21,7 +21,6 @@ class ZombieBufPool: public ZombiePool
 		void vSetNinit( const Eref& e, double v );
 		void vSetConc( const Eref& e, double v );
 		void vSetConcInit( const Eref& e, double v );
-		bool vGetIsBuffered( const Eref& e ) const;
 
 		static const Cinfo* initCinfo();
 	private:
diff --git a/ksolve/ZombiePool.cpp b/ksolve/ZombiePool.cpp
index 4ab7e1f8ffc3d2ac53567f7c42dd458f964c32e8..af4a26326c4237f33e60b53d6879debc9927e98a 100644
--- a/ksolve/ZombiePool.cpp
+++ b/ksolve/ZombiePool.cpp
@@ -179,11 +179,6 @@ double ZombiePool::vGetVolume( const Eref& e ) const
 	return lookupVolumeFromMesh( e );
 }
 
-bool ZombiePool::vGetIsBuffered( const Eref& e ) const
-{
-	return false;
-}
-
 //////////////////////////////////////////////////////////////
 // Zombie conversion functions.
 //////////////////////////////////////////////////////////////
diff --git a/ksolve/ZombiePool.h b/ksolve/ZombiePool.h
index 8e9b6ddbc347b467d2790d57482098132a26870f..6771b2cebdddc8cf88f4608fe72692f69d5d4267 100644
--- a/ksolve/ZombiePool.h
+++ b/ksolve/ZombiePool.h
@@ -46,7 +46,6 @@ class ZombiePool: public PoolBase
 
 		void vSetMotorConst( const Eref& e, double v );
 		double vGetMotorConst( const Eref& e ) const;
-		bool vGetIsBuffered( const Eref& e ) const;
 		//////////////////////////////////////////////////////////////////
 		// Dest funcs
 		//////////////////////////////////////////////////////////////////
diff --git a/msg/SparseMsg.cpp b/msg/SparseMsg.cpp
index 0be80c0044c083b9c04266882ab5407b28fd9d4d..65051f64d1e6f24b8c0cf60444bf9e75c937b62f 100644
--- a/msg/SparseMsg.cpp
+++ b/msg/SparseMsg.cpp
@@ -42,40 +42,6 @@ const Cinfo* SparseMsg::initCinfo()
 		&SparseMsg::getNumEntries
 	);
 
-	static ValueFinfo< SparseMsg, vector< unsigned int > > connectionList(
-		"connectionList",
-		"Pairwise specification of connection matrix where each x,y value "
-		"represents a connection from src[x] to dest[y]. "
-		"The (x,y) entries are ordered in a single vector as \n"
-		"(x0, x1,... x_n-1, y0, y1,... y_n-1)\n",
-		&SparseMsg::setEntryPairs,
-		&SparseMsg::getEntryPairs
-	);
-
-    /// Connection matrix entries to manipulate in Python.
-    static ReadOnlyValueFinfo< SparseMsg, vector< unsigned int > >
-    matrixEntry(
-        "matrixEntry",
-        "The non-zero matrix entries in the sparse matrix. Their"
-        "column indices are in a separate vector and the row"
-        "informatino in a third",
-        &SparseMsg::getMatrixEntry
-    );
-    /// connection matrix column indices to manipulate in Python.
-    static ReadOnlyValueFinfo< SparseMsg, vector< unsigned int > >
-    columnIndex(
-        "columnIndex",
-        "Column Index of each matrix entry",
-        &SparseMsg::getColIndex
-    );
-    /// connection matrix rowStart to manipulate in Python.
-    static ReadOnlyValueFinfo< SparseMsg, vector< unsigned int > >
-    rowStart(
-        "rowStart",
-        "Row start for each block of entries and column indices",
-        &SparseMsg::getRowStart
-    );
-
 	static ValueFinfo< SparseMsg, double > probability(
 		"probability",
 		"connection probability for random connectivity.",
@@ -135,13 +101,6 @@ const Cinfo* SparseMsg::initCinfo()
 			vector< unsigned int >	>( 
 		&SparseMsg::tripletFill ) );
 
-	static DestFinfo tripletFill1( "tripletFill1",
-		"Single contiguous array to fill entire connection matrix using "
-		"triplets of (x,y, fieldindex) ordered as \n"
-		"(x0, x1,... xn-1, y0, y1,... yn-1, fi0, fi1,... fi_n-1)\n",
-		new OpFunc1< SparseMsg, vector< unsigned int > >( 
-		&SparseMsg::tripletFill1 ) );
-
 ////////////////////////////////////////////////////////////////////////
 // Assemble it all.
 ////////////////////////////////////////////////////////////////////////
@@ -150,10 +109,6 @@ const Cinfo* SparseMsg::initCinfo()
 		&numRows,			// readonly value
 		&numColumns,		// readonly value
 		&numEntries,		// readonly value
-		&connectionList,	// value
-        &matrixEntry,		// ReadOnlyValue
-        &columnIndex,		// ReadOnlyValue
-        &rowStart,			// ReadOnlyValue
 		&probability,		// value
 		&seed,				// value
 		&setRandomConnectivity,	// dest
@@ -163,7 +118,6 @@ const Cinfo* SparseMsg::initCinfo()
 		&transpose,			//dest
 		&pairFill,			//dest
 		&tripletFill,		//dest
-		&tripletFill1,		//dest
 	};
 
 	static Dinfo< short > dinfo;
@@ -222,43 +176,6 @@ unsigned int SparseMsg::getNumEntries() const
 	return matrix_.nEntries();
 }
 
-vector< unsigned int > SparseMsg::getMatrixEntry() const
-{
-    return matrix_.matrixEntry();
-}
-
-vector< unsigned int > SparseMsg::getColIndex() const
-{
-    return matrix_.colIndex();
-}
-
-vector< unsigned int > SparseMsg::getRowStart() const
-{
-    return matrix_.rowStart();
-}
-
-void SparseMsg::setEntryPairs( vector< unsigned int > v )
-{
-	vector< unsigned int > src( v.begin(), v.begin() + v.size()/2 );
-	vector< unsigned int > dest( v.begin() + v.size()/2, v.end() );
-	pairFill( src, dest );
-}
-
-vector< unsigned int > SparseMsg::getEntryPairs() const
-{
-	vector< unsigned int > cols = matrix_.colIndex();
-	vector< unsigned int > y;
-	for ( unsigned int row = 0; row < matrix_.nRows(); ++row ) {
-		unsigned int begin = matrix_.rowStart()[row];
-		unsigned int end = matrix_.rowStart()[row+1];
-		for ( unsigned int j = begin; j < end; ++j )
-			y.push_back( row );
-	}
-	assert( cols.size() == y.size() );
-	y.insert( y.end(), cols.begin(), cols.end() );
-	return y;
-}
-
 //////////////////////////////////////////////////////////////////
 //    DestFields
 //////////////////////////////////////////////////////////////////
@@ -312,42 +229,10 @@ void SparseMsg::updateAfterFill()
 	e1()->markRewired();
 	e2()->markRewired();
 }
-
 void SparseMsg::pairFill( vector< unsigned int > src,
 			vector< unsigned int> dest )
 {
-	// Sanity check
-	vector< unsigned int >::const_iterator i;
-	for ( i = src.begin(); i != src.end(); ++i ) {
-		if (*i >= e1()->numData() ) {
-			cout << "Warning: SparseMsg::pairFill: Src index " << *i <<
-				   " exceeds Src array size " << e1()->numData() << 
-				   ". Aborting\n";
-			return;
-		}
-	}
-	for ( i = dest.begin(); i != dest.end(); ++i ) {
-		if (*i >= e2()->numData() ) {
-			cout << "Warning: SparseMsg::pairFill: Dest index " << *i <<
-				   " exceeds Dest array size " << e2()->numData() << 
-				   ". Aborting\n";
-			return;
-		}
-	}
-	
-	vector< unsigned int > numAtDest( dest.size(), 0 );
-	vector< unsigned int > fieldIndex( dest.size(), 0 );
-	for ( unsigned int i = 0; i < dest.size(); ++i ) {
-		fieldIndex[i] = numAtDest[ dest[i] ]; 
-		// Could do on previous line, but clarity
-		++numAtDest[ dest[i] ];
-	}
-
-	/**
-	 * We set retainSize flag to true since the # of src/dest objects
-	 * doesn't change. We can explicitly assign it elsewhere if needed.
-	 */
-	matrix_.tripletFill( src, dest, fieldIndex, true );
+	matrix_.pairFill( src, dest, 0 );
 	updateAfterFill();
 }
 
@@ -355,20 +240,10 @@ void SparseMsg::tripletFill( vector< unsigned int > src,
 			vector< unsigned int> destDataIndex,
 			vector< unsigned int> destFieldIndex )
 {
-	// We set retainSize flag to true
-	matrix_.tripletFill( src, destDataIndex, destFieldIndex, true );
+	matrix_.tripletFill( src, destDataIndex, destFieldIndex );
 	updateAfterFill();
 }
 
-void SparseMsg::tripletFill1( vector< unsigned int > v )
-{
-	unsigned int s3 = v.size() / 3;
-	vector< unsigned int > src( v.begin(), v.begin() + s3 );
-	vector< unsigned int > dest( v.begin() + s3, v.begin() + 2 * s3 );
-	vector< unsigned int > fieldIndex( v.begin() + 2 * s3, v.end() );
-	tripletFill( src, dest, fieldIndex );
-}
-
 //////////////////////////////////////////////////////////////////
 //    Here are the actual class functions
 //////////////////////////////////////////////////////////////////
@@ -376,10 +251,7 @@ void SparseMsg::tripletFill1( vector< unsigned int > v )
 
 SparseMsg::SparseMsg( Element* e1, Element* e2, unsigned int msgIndex )
 	: Msg( ObjId( managerId_, (msgIndex != 0) ? msgIndex: msg_.size() ),
-					e1, e2 ), 
-				numThreads_( 1 ), 
-				nrows_( 0 ),
-				p_( 0.0 ), seed_( 0 )
+					e1, e2 )
 {
 	unsigned int nrows = 0;
 	unsigned int ncolumns = 0;
diff --git a/msg/SparseMsg.h b/msg/SparseMsg.h
index d6fbf80b04306c1c333a94ff96b1f3649a1fa787..2dffb9af75d8e2e756ebc6308d0c66dde84d4ec8 100644
--- a/msg/SparseMsg.h
+++ b/msg/SparseMsg.h
@@ -82,23 +82,16 @@ class SparseMsg: public Msg
 		long getSeed() const;
 		void setSeed( long value );
 
-		vector< unsigned int > getEntryPairs() const;
-		void setEntryPairs( vector< unsigned int > entries );
-
 		void setEntry( unsigned int row, unsigned int column, 
 			unsigned int value );
 
 		void unsetEntry( unsigned int row, unsigned int column );
 
+		// Still need to implement array field gets.
+
 		unsigned int getNumRows() const;
 		unsigned int getNumColumns() const;
 		unsigned int getNumEntries() const;
-		/// Return array entries in sparse matrix form
-		vector< unsigned int > getMatrixEntry() const;
-		/// Return column index for each array entry
-		vector< unsigned int > getColIndex() const;
-		/// row start number for each array entry
-		vector< unsigned int > getRowStart() const;
 		void clear();
 		void transpose();
 
@@ -116,14 +109,6 @@ class SparseMsg: public Msg
 		void tripletFill( vector< unsigned int > src, 
 					vector< unsigned int> dest,
 					vector< unsigned int > field );
-
-		/**
-		 * Fills up the entire message based on triplets of 
-		 * src,destDataIndex,destFieldIndex, but catenates them all into
-		 * a single long vector since PyMoose doesn't know how to handle
-		 * multiple vectors.
-		 */
-		void tripletFill1( vector< unsigned int > entries ); 
 		
 		/**
 		 * Utility function to update all sorts of values after we've
diff --git a/pymoose/CMakeLists.txt b/pymoose/CMakeLists.txt
index cd7de488f0d9b7630c7bf242eaefc6e036582af4..b2887ee7b3b78b8810df4e9b9e98d796ba52eda8 100644
--- a/pymoose/CMakeLists.txt
+++ b/pymoose/CMakeLists.txt
@@ -1,8 +1,6 @@
 add_definitions(-DPYMOOSE)
 include_directories(../basecode ../msg)
 
-find_package( PythonInterp REQUIRED )
-
 set(PYMOOSE_SRCS 
     moosemodule.cpp
     vec.cpp
@@ -20,18 +18,10 @@ EXEC_PROGRAM(${PYTHON_EXECUTABLE}
 except Exception: pass'"
     OUTPUT_VARIABLE PYTHON_SO_EXTENSION
     )
-
-message( STATUS "Python path ${PYTHON_EXECUTABLE}" )
 message( STATUS "Python so extension ${PYTHON_SO_EXTENSION}" )
 
 find_package(NumPy REQUIRED)
-find_package(PythonLibs REQUIRED)
-
-include_directories( ${NUMPY_INCLUDE_DIRS} )
-include_directories( ${PYTHON_INCLUDE_DIRS} )
-
-message( STATUS "Python include dir : ${PYTHON_INCLUDE_DIRS} " )
-
+include_directories(${NUMPY_INCLUDE_DIRS})
 add_definitions(-DUSE_NUMPY)
 
 add_definitions(-DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION)
@@ -44,12 +34,7 @@ execute_process( COMMAND ${PYTHON_EXECUTABLE}-config --libs
     OUTPUT_VARIABLE PYTHON_LIBRARIES
     OUTPUT_STRIP_TRAILING_WHITESPACE
     )
-
-if( NOT PYTHON_INCLUDE_FLAGS )
-    set( PYTHON_INCLUDE_FLAGS "-I ${PYTHON_INCLUDE_DIRS} " )
-endif( )
 message( STATUS "Python include flags: ${PYTHON_INCLUDE_FLAGS}" )
-
 set_target_properties(_moose PROPERTIES 
     COMPILE_DEFINITIONS "PYMOOSE"
     COMPILE_FLAGS "${PYTHON_INCLUDE_FLAGS}"
@@ -58,6 +43,11 @@ set_target_properties(_moose PROPERTIES
     SUFFIX ".so"
     )
 
+if(NOT(PYTHON_SO_EXTENSION STREQUAL ""))
+    set_target_properties(_moose PROPERTIES
+    SUFFIX ${PYTHON_SO_EXTENSION})
+endif()
+
 # see issue #80
 if(HDF5_LIBRARY_DIRS)
     set_target_properties( _moose PROPERTIES LINK_FLAGS "-L${HDF5_LIBRARY_DIRS}" )
@@ -93,6 +83,8 @@ endif(MACOSX)
 add_custom_target(copy_python_files ALL
     COMMAND ${CMAKE_COMMAND} -E copy_directory
         ${CMAKE_SOURCE_DIR}/python ${CMAKE_BINARY_DIR}/python
+    COMMAND ${CMAKE_COMMAND} -E copy 
+        ${CMAKE_SOURCE_DIR}/VERSION ${CMAKE_BINARY_DIR}/VERSION 
     COMMENT "Copying required python files and other files to build directory"
     VERBATIM
     )
diff --git a/pymoose/PyRun.cpp b/pymoose/PyRun.cpp
index 73d88c0cf8f643eb37318bf17321aa1df1fe3f94..5b3db0daec6cfb73d78516a2ee6acf404788ba6a 100644
--- a/pymoose/PyRun.cpp
+++ b/pymoose/PyRun.cpp
@@ -1,47 +1,47 @@
-// PyRun.cpp --- 
-// 
+// PyRun.cpp ---
+//
 // Filename: PyRun.cpp
-// Description: 
+// Description:
 // Author: subha
-// Maintainer: 
+// Maintainer:
 // Created: Sat Oct 11 14:47:22 2014 (+0530)
-// Version: 
+// Version:
 // Last-Updated: Fri Jun 19 18:56:06 2015 (-0400)
 //           By: Subhasis Ray
 //     Update #: 15
-// URL: 
-// Keywords: 
-// Compatibility: 
-// 
-// 
-
-// Commentary: 
-// 
-// 
-// 
-// 
+// URL:
+// Keywords:
+// Compatibility:
+//
+//
+
+// Commentary:
+//
+//
+//
+//
 
 // Change log:
-// 
-// 
-// 
-// 
+//
+//
+//
+//
 // 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 3, 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; see the file COPYING.  If not, write to
 // the Free Software Foundation, Inc., 51 Franklin Street, Fifth
 // Floor, Boston, MA 02110-1301, USA.
-// 
-// 
+//
+//
 
 // Code:
 
@@ -77,6 +77,7 @@ const Cinfo * PyRun::initCinfo()
         "String to be executed at initialization (reinit).",
         &PyRun::setInitString,
         &PyRun::getInitString);
+
     static ValueFinfo< PyRun, string > inputvar(
         "inputVar",
         "Name of local variable in which input balue is to be stored. Default"
@@ -87,13 +88,13 @@ const Cinfo * PyRun::initCinfo()
 
     static ValueFinfo< PyRun, string > outputvar(
         "outputVar",
-        "Name of local variable for storing output. Default is `output`",
+        "Name of local variable for storing output. Default is `output`.",
         &PyRun::setOutputVar,
         &PyRun::getOutputVar);
 
     static ValueFinfo< PyRun, int > mode(
         "mode",
-        "Flag to indicate whether runString should be executed for both trigger and process, or one of them",
+        "Flag to indicate whether runString should be executed for both trigger and process, or one of them.",
         &PyRun::setMode,
         &PyRun::getMode);
 
@@ -118,7 +119,7 @@ const Cinfo * PyRun::initCinfo()
         " builtin function `input`). If debug is True, it prints the input"
         " value.",
         new EpFunc1< PyRun, double >(&PyRun::trigger));
-    
+
     static DestFinfo run(
         "run",
         "Runs a specified string. Does not modify existing run or init strings.",
@@ -133,7 +134,7 @@ const Cinfo * PyRun::initCinfo()
         "reinit",
         "Handles reinit call. Runs the current initString.",
         new ProcOpFunc< PyRun >( &PyRun::reinit ));
-    
+
     static Finfo * processShared[] = { &process, &reinit };
     static SharedFinfo proc(
         "proc",
@@ -195,7 +196,7 @@ PyRun::PyRun():mode_(0), initstr_(""), runstr_(""),
     }
     if (PyDict_SetItemString(locals_, inputvar_.c_str(), value)){
         PyErr_Print();
-    }    
+    }
 }
 
 PyRun::~PyRun()
@@ -264,7 +265,7 @@ void PyRun::trigger(const Eref& e, double input)
     if (mode_ == 1){
         return;
     }
-    
+
     PyObject * value = PyDict_GetItemString(locals_, inputvar_.c_str());
     if (value){
         Py_DECREF(value);
@@ -335,12 +336,12 @@ void handleError(bool syntax)
 {
     PyObject *exc, *val, *trb;
     char * msg;
-    
-    if (syntax && PyErr_ExceptionMatches (PyExc_SyntaxError)){           
+
+    if (syntax && PyErr_ExceptionMatches (PyExc_SyntaxError)){
         PyErr_Fetch (&exc, &val, &trb);        /* clears exception! */
-        
+
         if (PyArg_ParseTuple (val, "sO", &msg, &trb) &&
-            !strcmp (msg, "unexpected EOF while parsing")){ /* E_EOF */            
+            !strcmp (msg, "unexpected EOF while parsing")){ /* E_EOF */
             Py_XDECREF (exc);
             Py_XDECREF (val);
             Py_XDECREF (trb);
@@ -350,21 +351,21 @@ void handleError(bool syntax)
         }
     } else {                                     /* some non-syntax error */
         PyErr_Print ();
-    }                
+    }
 }
 
 void PyRun::reinit(const Eref& e, ProcPtr p)
 {
     PyObject * main_module;
     if (globals_ == NULL){
-        main_module = PyImport_AddModule("__main__");        
+        main_module = PyImport_AddModule("__main__");
         globals_ = PyModule_GetDict(main_module);
         Py_XINCREF(globals_);
     }
     if (locals_ == NULL){
         locals_ = PyDict_New();
         if (!locals_){
-            cerr << "Could not initialize locals dict" << endl;            
+            cerr << "Could not initialize locals dict" << endl;
         }
     }
     initcompiled_ = (PYCODEOBJECT*)Py_CompileString(
@@ -396,5 +397,5 @@ void PyRun::reinit(const Eref& e, ProcPtr p)
 }
 
 
-// 
+//
 // PyRun.cpp ends here
diff --git a/pymoose/melement.cpp b/pymoose/melement.cpp
index 7cd4ee914d7162e3296717cc0c3b71d96d1fec7a..fdceba80eb347dfcb87ce921311da7dd88fb909a 100644
--- a/pymoose/melement.cpp
+++ b/pymoose/melement.cpp
@@ -1,48 +1,48 @@
-// melement.cpp --- 
-// 
+// melement.cpp ---
+//
 // Filename: melement.cpp
-// Description: 
-// Author: 
-// Maintainer: 
+// Description:
+// Author:
+// Maintainer:
 // Created: Mon Jul 22 16:50:41 2013 (+0530)
-// Version: 
+// Version:
 // Last-Updated: Fri Sep 25 23:02:53 2015 (-0400)
 //           By: subha
 //     Update #: 76
-// URL: 
-// Keywords: 
-// Compatibility: 
-// 
-// 
-
-// Commentary: 
-// 
+// URL:
+// Keywords:
+// Compatibility:
+//
+//
+
+// Commentary:
+//
 // Mon Jul 22 16:50:47 IST 2013 - Taking out ObjId stuff from
 // moosemodule.cpp
-// 
-// 
+//
+//
 
 // Change log:
-// 
-// 
-// 
-// 
+//
+//
+//
+//
 // 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 3, 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; see the file COPYING.  If not, write to
 // the Free Software Foundation, Inc., 51 Franklin Street, Fifth
 // Floor, Boston, MA 02110-1301, USA.
-// 
-// 
+//
+//
 
 // Code:
 
@@ -122,7 +122,7 @@ int moose_ObjId_init_from_id(_ObjId * self, PyObject * args, PyObject * kwargs)
         if (Id_Check(obj)){
             if (!Id::isValid(((_Id*)obj)->id_)){
                 RAISE_INVALID_ID(-1, "moose_ObjId_init_from_id");
-            }                    
+            }
             self->oid_ = ObjId(((_Id*)obj)->id_, data, field );
             if (self->oid_.bad()){
                 PyErr_SetString(PyExc_ValueError, "Invalid dataIndex/fieldIndex.");
@@ -132,7 +132,7 @@ int moose_ObjId_init_from_id(_ObjId * self, PyObject * args, PyObject * kwargs)
         } else if (PyObject_IsInstance(obj, (PyObject*)&ObjIdType)){
             if (!Id::isValid(((_ObjId*)obj)->oid_.id)){
                 RAISE_INVALID_ID(-1, "moose_ObjId_init_from_id");
-            }                    
+            }
             self->oid_ = ((_ObjId*)obj)->oid_;
             if (self->oid_.bad()){
                 PyErr_SetString(PyExc_ValueError, "Invalid ObjId");
@@ -156,7 +156,7 @@ int moose_ObjId_init_from_path(_ObjId * self, PyObject * args,
     self->oid_ = ObjId( 0, BADINDEX );
     PyTypeObject * mytype = Py_TYPE(self);
     string mytypename(mytype->tp_name);
-    
+
     // First try to parse the arguments as (parsedPath, n, g, dtype)
     bool parse_success = false;
     if (PyArg_ParseTupleAndKeywords(args, kwargs,
@@ -167,14 +167,14 @@ int moose_ObjId_init_from_path(_ObjId * self, PyObject * args,
     }
     // we need to clear the parse error so that the callee can try
     // other alternative: moose_ObjId_init_from_id
-    PyErr_Clear(); 
+    PyErr_Clear();
     if (!parse_success){
         return -2;
     }
 
     string path(parsedPath);
     // Remove one or more instances of '/' by a single '/' e.g. //a -> /a,
-    // /a//b -> /a/b etc. 
+    // /a//b -> /a/b etc.
     path = moose::fix(path);
 
     ostringstream err;
@@ -189,7 +189,7 @@ int moose_ObjId_init_from_path(_ObjId * self, PyObject * args,
         }
         basetype_str = string(basetype->tp_name).substr(6); // remove `moose.` prefix from type name
     } else {
-        basetype_str = string(type);            
+        basetype_str = string(type);
     }
 
 
@@ -211,7 +211,7 @@ int moose_ObjId_init_from_path(_ObjId * self, PyObject * args,
         // If the current class is a subclass of some predefined
         // moose class, do nothing.
         string className = self->oid_.element()->cinfo()->name();
-        map <string, PyTypeObject * >::iterator ii = 
+        map <string, PyTypeObject * >::iterator ii =
         	get_moose_classes().find( className );
         PyTypeObject * basetype = 0;
         if ( ii != get_moose_classes().end() ) {
@@ -227,7 +227,7 @@ int moose_ObjId_init_from_path(_ObjId * self, PyObject * args,
         // element exists at this path, but it does not inherit from any moose class.
         // throw an error
         err << "cannot convert "
-			<< className 
+			<< className
             << " to "
             << mytypename
             << ". To get the existing object use `moose.element(obj)` instead.";
@@ -245,7 +245,7 @@ int moose_ObjId_init_from_path(_ObjId * self, PyObject * args,
     self->oid_ = ObjId(new_id);
     return 0;
 }
-    
+
 int moose_ObjId_init(_ObjId * self, PyObject * args,
                      PyObject * kwargs)
 {
@@ -267,7 +267,7 @@ int moose_ObjId_init(_ObjId * self, PyObject * args,
     PyErr_SetString(PyExc_ValueError,
                     "Could not parse arguments. "
                     " Call __init__(path, n, g, dtype) or"
-                    " __init__(id, dataIndex, fieldIndex)");        
+                    " __init__(id, dataIndex, fieldIndex)");
     return -1;
 }
 
@@ -327,14 +327,20 @@ PyObject * moose_ObjId_str(_ObjId * self)
 PyDoc_STRVAR(moose_ObjId_getId_documentation,
              "getId() -> vec\n"
              "\n"
-             "Get the vec of this object\n"
+             "Returns the information of the object's classtype, Id, and path \n"
+             "in form of a vector.\n"
+             "\nExample\n"
+             "-------\n"
+             "    >>> com = moose.Compartment('/com')\n"
+             "    >>> com.getId()\n"
+             "        moose.vec: class=Compartment, id=481, path=/com>"
              "\n");
 PyObject* moose_ObjId_getId(_ObjId * self)
 {
     if (!Id::isValid(self->oid_.id)){
         RAISE_INVALID_ID(NULL, "moose_ObjId_getId");
     }
-    extern PyTypeObject IdType;        
+    extern PyTypeObject IdType;
     _Id * ret = PyObject_New(_Id, &IdType);
     ret->id_ = self->oid_.id;
     return (PyObject*)ret;
@@ -343,12 +349,15 @@ PyObject* moose_ObjId_getId(_ObjId * self)
 PyDoc_STRVAR(moose_ObjId_getFieldType_documentation,
              "getFieldType(fieldname)\n"
              "\n"
-             "Get the string representation of the type of the field `fieldname`.\n"
+             "Returns the type of the field `fieldname` (as a string).\n"
              "\n"
              "Parameters\n"
              "----------\n"
              "fieldname : string\n"
              "    Name of the field to be queried.\n"
+             "\n"
+             "      >>> comp.getFieldType('neighbors')\n"
+             "      >>> 'string,vector<Id>' \n"
              "\n");
 
 PyObject * moose_ObjId_getFieldType(_ObjId * self, PyObject * args)
@@ -379,18 +388,21 @@ PyObject * moose_ObjId_getFieldType(_ObjId * self, PyObject * args)
 PyDoc_STRVAR(moose_ObjId_getField_documentation,
              "getField(fieldname)\n"
              "\n"
-             "Get the value of the field `fieldname`.\n"
+             "Returns the value of the field `fieldname`.\n"
              "\n"
              "Parameters\n"
              "----------\n"
              "fieldname : string\n"
-             "    Name of the field.");
+             "    Name of the field.\n"
+             "\n"
+             "      >>> comp.getField('x0')\n"
+             "      >>> 0.0 \n");
 PyObject * moose_ObjId_getField(_ObjId * self, PyObject * args)
 {
     if (!Id::isValid(self->oid_.id)){
         RAISE_INVALID_ID(NULL, "moose_ObjId_getField");
     }
-    PyObject * attr;        
+    PyObject * attr;
     if (!PyArg_ParseTuple(args, "O:moose_ObjId_getField", &attr)){
         return NULL;
     }
@@ -399,7 +411,7 @@ PyObject * moose_ObjId_getField(_ObjId * self, PyObject * args)
 
 /**
    2011-03-28 13:59:41 (+0530)
-   
+
    Get a specified field. Re-done on: 2011-03-23 14:42:03 (+0530)
 
    I wonder how to cleanly do this. The Id - ObjId dichotomy is
@@ -436,7 +448,7 @@ PyObject * moose_ObjId_getattro(_ObjId * self, PyObject * attr)
             break;
         }
     }
-            
+
     string type = getFieldType(className, fieldName);
     if (type.empty() || !isValueField ){
         // Check if this field name is aliased and update fieldName and type if so.
@@ -520,12 +532,12 @@ PyObject * moose_ObjId_getattro(_ObjId * self, PyObject * attr)
             _ret = to_py(&value, ftype);
             break;
         }
-        case 'x': {                    
+        case 'x': {
             Id value = Field<Id>::get(self->oid_, fieldName);
             _ret = to_py(&value, ftype);
             break;
         }
-        case 'y': {                    
+        case 'y': {
             ObjId value = Field<ObjId>::get(self->oid_, fieldName);
             _ret = to_py(&value, ftype);
             break;
@@ -544,12 +556,12 @@ PyObject * moose_ObjId_getattro(_ObjId * self, PyObject * attr)
             vector < Id > value = Field<vector <Id> >::get(self->oid_, fieldName);
             _ret = to_py(&value, ftype);
             break;
-        } 
+        }
         case 'Y': { // vector<ObjId>
             vector < ObjId > value = Field<vector <ObjId> >::get(self->oid_, fieldName);
             _ret = to_py(&value, ftype);
             break;
-        } 
+        }
         case 'M': {
             vector< long > value = Field< vector <long> >::get(self->oid_, fieldName);
             _ret = to_py(&value, ftype);
@@ -579,12 +591,12 @@ PyObject * moose_ObjId_getattro(_ObjId * self, PyObject * attr)
             vector < vector < unsigned int > > value = Field<vector <vector < unsigned int > > >::get(self->oid_, fieldName);
             _ret = to_py(&value, ftype);
             break;
-        } 
+        }
         case 'Q': { // vector< vector < int > >
             vector <  vector < int >  > value = Field<vector < vector < int > > >::get(self->oid_, fieldName);
             _ret = to_py(&value, ftype);
             break;
-        } 
+        }
         case 'R': { // vector< vector < double > >
             vector <  vector < double >  > value = Field<vector < vector < double > > >::get(self->oid_, fieldName);
             _ret = to_py(&value, ftype);
@@ -635,12 +647,12 @@ PyObject * moose_ObjId_getattro(_ObjId * self, PyObject * attr)
 
         default:
             _ret = PyObject_GenericGetAttr((PyObject*)self, attr);
-            
+
     }
     if (new_attr){
         Py_DECREF(attr);
     }
-    return _ret;        
+    return _ret;
 }
 
 /**
@@ -657,7 +669,12 @@ PyDoc_STRVAR(moose_ObjId_setField_documentation,
              "    Field to be assigned value to.\n"
              "\n"
              "value : python datatype compatible with the type of the field\n"
-             "    The value to be assigned to the field.");
+             "    The value to be assigned to the field."
+             "\n"
+             "\n"
+             "        >>> comp.setField('x0', 45.25) \n"
+             "        >>> print comp.x0\n"
+             "            45.25\n");
 
 PyObject * moose_ObjId_setField(_ObjId * self, PyObject * args)
 {
@@ -694,7 +711,7 @@ int  moose_ObjId_setattro(_ObjId * self, PyObject * attr, PyObject * value)
         // typos). Otherwise, it must have been subclassed in
         // Python. Then we allow normal Pythonic behaviour and
         // consider such mistakes user's responsibility.
-        string className = ((PyTypeObject*)PyObject_Type((PyObject*)self))->tp_name;            
+        string className = ((PyTypeObject*)PyObject_Type((PyObject*)self))->tp_name;
         if (get_moose_classes().find(className) == get_moose_classes().end()){
             return PyObject_GenericSetAttr((PyObject*)self, PyString_FromString(field), value);
         }
@@ -727,7 +744,7 @@ int  moose_ObjId_setattro(_ObjId * self, PyObject * attr, PyObject * value)
             unsigned long _value = PyInt_AsUnsignedLongMask(value);
             ret = Field<unsigned long>::set(self->oid_, string(field), _value);
             break;
-        }                
+        }
         case 'f': {
             float _value = PyFloat_AsDouble(value);
             ret = Field<float>::set(self->oid_, string(field), _value);
@@ -899,7 +916,7 @@ int  moose_ObjId_setattro(_ObjId * self, PyObject * attr, PyObject * value)
                 ret = Field< vector < float > >::set(self->oid_, string(field), _value);
             }
             break;
-        }              
+        }
         case 'S': {
             if (!PySequence_Check(value)){
                 PyErr_SetString(PyExc_TypeError, "For setting vector<string> field, specified value must be a sequence." );
@@ -955,7 +972,7 @@ int  moose_ObjId_setattro(_ObjId * self, PyObject * attr, PyObject * value)
                 ret = Field< vector < Id > >::set(self->oid_, string(field), _value);
             }
             break;
-        }              
+        }
         case 'Y': {//SET_VECFIELD(ObjId, f)
             if (!PySequence_Check(value)){
                 PyErr_SetString(PyExc_TypeError, "For setting vector<ObjId> field, specified value must be a sequence." );
@@ -971,8 +988,8 @@ int  moose_ObjId_setattro(_ObjId * self, PyObject * attr, PyObject * value)
                 ret = Field< vector < ObjId > >::set(self->oid_, string(field), _value);
             }
             break;
-        }              
-        default:                
+        }
+        default:
             break;
     }
     // MOOSE Field::set returns 1 for success 0 for
@@ -1007,10 +1024,10 @@ PyObject * moose_ObjId_getItem(_ObjId * self, Py_ssize_t index)
     // what is s0[1]? ObjId(X
     // syn[0][1]->ObjId(X, 0, 1) =syn[0][0][0] - which is an ObjId.
     // Now, what is syn[0][1][2] ?
-    
+
     // In PyMOOSE, user is allowed to directly put in the numbers
     // for Id, dataIndex and fieldIndex directly and construct an
-    // ObjId. 
+    // ObjId.
     _ObjId * ret = PyObject_New(_ObjId, &ObjIdType);
     ret->oid_ = ObjId(self->oid_.id, self->oid_.dataIndex, index);
     return (PyObject*)ret;
@@ -1031,8 +1048,8 @@ PyObject * moose_ObjId_getSlice(_ObjId * self, Py_ssize_t start, Py_ssize_t end)
         return PyTuple_New(0);
     }
     PyObject * ret = PyTuple_New((Py_ssize_t)(end - start));
-    
-    // Py_XINCREF(ret);        
+
+    // Py_XINCREF(ret);
     for ( int ii = start; ii < end; ++ii){
         _ObjId * value = PyObject_New(_ObjId, &ObjIdType);
         value->oid_ = ObjId(self->oid_.id, self->oid_.dataIndex, ii);
@@ -1095,39 +1112,39 @@ PyObject * getLookupField(ObjId target, char * fieldName, PyObject * key)
         case 'h': {
             ret = lookup_value <short> (target, string(fieldName), value_type_code, key_type_code, key);
             break;
-        }            
+        }
         case 'H': {
             ret = lookup_value <unsigned short> (target, string(fieldName), value_type_code, key_type_code, key);
             break;
-        }            
+        }
         case 'i': {
             ret = lookup_value <int> (target, string(fieldName), value_type_code, key_type_code, key);
             break;
-        }            
+        }
         case 'I': {
             ret = lookup_value <unsigned int> (target, string(fieldName), value_type_code, key_type_code, key);
             break;
-        }            
+        }
         case 'l': {
             ret = lookup_value <long> (target, string(fieldName), value_type_code, key_type_code, key);
             break;
-        }                        
+        }
         case 'k': {
             ret = lookup_value <unsigned long> (target, string(fieldName), value_type_code, key_type_code, key);
             break;
-        }                        
+        }
         case 'L': {
             ret = lookup_value <long long> (target, string(fieldName), value_type_code, key_type_code, key);
             break;
-        }                        
+        }
         case 'K': {
             ret = lookup_value <unsigned long long> (target, string(fieldName), value_type_code, key_type_code, key);
             break;
-        }                        
+        }
         case 'd': {
             ret = lookup_value <double> (target, string(fieldName), value_type_code, key_type_code, key);
             break;
-        }                        
+        }
         case 'f': {
             ret = lookup_value <float> (target, string(fieldName), value_type_code, key_type_code, key);
             break;
@@ -1147,7 +1164,7 @@ PyObject * getLookupField(ObjId target, char * fieldName, PyObject * key)
         case 'D': {
             ret = lookup_value < vector <double> >(target, string(fieldName), value_type_code, key_type_code, key);
             break;
-        }                
+        }
         case 'S': {
             ret = lookup_value < vector <string> >(target, string(fieldName), value_type_code, key_type_code, key);
             break;
@@ -1175,11 +1192,11 @@ PyObject * getLookupField(ObjId target, char * fieldName, PyObject * key)
         case 'F': {
             ret = lookup_value < vector <float> >(target, string(fieldName), value_type_code, key_type_code, key);
             break;
-        }                
+        }
         case 'w': {
             ret = lookup_value < vector <short> >(target, string(fieldName), value_type_code, key_type_code, key);
             break;
-        }   
+        }
         case 'C': {
             ret = lookup_value < vector <char> >(target, string(fieldName), value_type_code, key_type_code, key);
             break;
@@ -1242,11 +1259,11 @@ int setLookupField(ObjId target, char * fieldName, PyObject * key, PyObject * va
         case 'I': {
             ret = set_lookup_value <unsigned int> (target, string(fieldName), value_type_code, key_type_code, key, value);
             break;
-        }            
+        }
         case 'k': {
             ret = set_lookup_value <unsigned long> (target, string(fieldName), value_type_code, key_type_code, key, value);
             break;
-        }                        
+        }
         case 's': {
             ret = set_lookup_value <string> (target, string(fieldName), value_type_code, key_type_code, key, value);
             break;
@@ -1254,19 +1271,19 @@ int setLookupField(ObjId target, char * fieldName, PyObject * key, PyObject * va
         case 'i': {
             ret = set_lookup_value <int> (target, string(fieldName), value_type_code, key_type_code, key, value);
             break;
-        }            
+        }
         case 'l': {
             ret = set_lookup_value <long> (target, string(fieldName), value_type_code, key_type_code, key, value);
             break;
-        }                        
+        }
         case 'L': {
             ret = set_lookup_value <long long> (target, string(fieldName), value_type_code, key_type_code, key, value);
             break;
-        }                        
+        }
         case 'K': {
             ret = set_lookup_value <unsigned long long> (target, string(fieldName), value_type_code, key_type_code, key, value);
             break;
-        }                        
+        }
         case 'b': {
             ret = set_lookup_value <bool> (target, string(fieldName), value_type_code, key_type_code, key, value);
             break;
@@ -1278,15 +1295,15 @@ int setLookupField(ObjId target, char * fieldName, PyObject * key, PyObject * va
         case 'h': {
             ret = set_lookup_value <short> (target, string(fieldName), value_type_code, key_type_code, key, value);
             break;
-        }            
+        }
         case 'H': {
             ret = set_lookup_value <unsigned short> (target, string(fieldName), value_type_code, key_type_code, key, value);
             break;
-        }            
+        }
         case 'd': {
             ret = set_lookup_value <double> (target, string(fieldName), value_type_code, key_type_code, key, value);
             break;
-        }                        
+        }
         case 'f': {
             ret = set_lookup_value <float> (target, string(fieldName), value_type_code, key_type_code, key, value);
             break;
@@ -1304,7 +1321,7 @@ int setLookupField(ObjId target, char * fieldName, PyObject * key, PyObject * va
             error << "setLookupField: invalid key type " << type_vec[0];
             PyErr_SetString(PyExc_TypeError, error.str().c_str());
     }
-    return ret;        
+    return ret;
 }// setLookupField
 
 PyDoc_STRVAR(moose_ObjId_setLookupField_documentation,
@@ -1373,7 +1390,7 @@ PyObject * moose_ObjId_setDestField(_ObjId * self, PyObject * args)
         PyErr_SetString(PyExc_ValueError, error.str().c_str());
         return NULL;
     }
-    
+
     // Get the destFinfo name
     char * fieldName = PyString_AsString(arglist[0]);
     if (!fieldName){ // not a string, raises TypeError
@@ -1381,7 +1398,7 @@ PyObject * moose_ObjId_setDestField(_ObjId * self, PyObject * args)
         PyErr_SetString(PyExc_TypeError, error.str().c_str());
         return NULL;
     }
-    
+
     // Try to parse the arguments.
     vector< string > argType;
     if (parseFinfoType(Field<string>::get(oid, "className"),
@@ -1419,7 +1436,7 @@ PyObject * setDestFinfo(ObjId obj, string fieldName, PyObject *arg, string argTy
     ostringstream error;
     error << "moose.setDestFinfo: ";
 
-switch (typecode){                    
+switch (typecode){
     case 'f': case 'd': {
         double param = PyFloat_AsDouble(arg);
         if (typecode == 'f'){
@@ -1464,7 +1481,7 @@ switch (typecode){
         if (id == NULL){
             error << "argument should be an vec or an melement";
             PyErr_SetString(PyExc_TypeError, error.str().c_str());
-            return NULL;                                
+            return NULL;
         }
         param = id->id_;
         ret = SetGet1<Id>::set(obj, fieldName, param);
@@ -1476,7 +1493,7 @@ switch (typecode){
         if (oid == NULL){
             error << "argument should be vec or an melement";
             PyErr_SetString(PyExc_TypeError, error.str().c_str());
-            return NULL;                                
+            return NULL;
         }
         param = oid->oid_;
         ret = SetGet1<ObjId>::set(obj, fieldName, param);
@@ -1508,7 +1525,7 @@ switch (typecode){
     }
     case 'L': {//SET_VECFIELD(long, l) {
         return _set_vector_destFinfo<long>(obj, string(fieldName), arg, typecode);
-    }            
+    }
     case 'N': { //SET_VECFIELD(unsigned int, I)
         return _set_vector_destFinfo<unsigned int>(obj, string(fieldName), arg, typecode);
     }
@@ -1520,7 +1537,7 @@ switch (typecode){
     }
     case 'D': {//SET_VECFIELD(double, d)
         return _set_vector_destFinfo<double>(obj, string(fieldName), arg, typecode);
-    }                
+    }
     case 'S': {
         return _set_vector_destFinfo<string>(obj, string(fieldName), arg, typecode);
     }
@@ -1594,7 +1611,7 @@ switch (type2){
             if (id == NULL){
                 error << "argument should be an vec or an melement";
                 PyErr_SetString(PyExc_TypeError, error.str().c_str());
-                return NULL;                                
+                return NULL;
             }
             param = id->id_;
         // } else if (ObjId_SubtypeCheck(arg)){
@@ -1602,7 +1619,7 @@ switch (type2){
         //     if (oid == NULL){
         //         error << "argument should be an vec or an melement";
         //         PyErr_SetString(PyExc_TypeError, error.str().c_str());
-        //         return NULL;                                
+        //         return NULL;
         //     }
         //     param = oid->oid_.id;
         // }
@@ -1615,7 +1632,7 @@ switch (type2){
         //     if (id == NULL){
         //         error << "argument should be an vec or an melement";
         //         PyErr_SetString(PyExc_TypeError, error.str().c_str());
-        //         return NULL;                                
+        //         return NULL;
         //     }
         //     param = ObjId(id->id_);
         // } else if (ObjId_SubtypeCheck(arg)){
@@ -1623,7 +1640,7 @@ switch (type2){
             if (oid == NULL){
                 error << "argument should be an vec or an melement";
                 PyErr_SetString(PyExc_TypeError, error.str().c_str());
-                return NULL;                                
+                return NULL;
             }
             param = oid->oid_;
         // }
@@ -1654,26 +1671,31 @@ switch (type2){
 PyDoc_STRVAR(moose_ObjId_getFieldNames_documenation,
              "getFieldNames(fieldType='') -> tuple of str\n"
              "\n"
-             "Get the names of fields on this element.\n"
+             "Returns the names of fields of this element of fieldType kind.\n"
              "\n"
              "Parameters\n"
              "----------\n"
              "fieldType : str\n"
-             "    Field type to retrieve. Can be `valueFinfo`, `srcFinfo`,\n"
-             "   `destFinfo`, `lookupFinfo`, etc. If an empty string is specified,\n"
-             "    names of all avaialable fields are returned.\n"
+             "    Type of the fields you wish to retrieve. Can be\n"
+             "     - `valueFinfo` - attributes of the object\n"
+             "     - `srcFinfo`   - fields of the object which can be used as source of information for connect\n"
+             "     - `destFinfo`  - fields of the object which can be used as destination of information for connect\n"
+             "     - `lookupFinfo`- fields which can be looked at through this object"
+             ", etc. If an empty string is specified, names of all avaialable fields are returned.\n"
              "\n"
              "Returns\n"
              "-------\n"
              "names : tuple of strings.\n"
-             "    names of the fields of the specified type.\n"   
+             "    names of the fields of the specified type.\n"
              "\n"
              "Examples\n"
              "--------\n"
              "List names of all the source fields in PulseGen class:\n"
              "\n"
-             "    >>> moose.getFieldNames('PulseGen', 'srcFinfo')\n"
-             "    ('childMsg', 'output')\n"
+             "      >>> comp.getFieldNames('lookupFinfo') \n"
+             "          ('neighbors', 'msgDests', 'msgDestFunctions', 'isA')\n"
+             "      >>> moose.getFieldNames('PulseGen', 'srcFinfo')\n"
+             "          ('childMsg', 'output')\n"
              "\n");
 // 2011-03-23 15:28:26 (+0530)
 PyObject * moose_ObjId_getFieldNames(_ObjId * self, PyObject *args)
@@ -1692,13 +1714,13 @@ PyObject * moose_ObjId_getFieldNames(_ObjId * self, PyObject *args)
         for (const char **a = getFinfoTypes(); *a; ++a){
             vector<string> fields = getFieldNames(className, string(*a));
             ret.insert(ret.end(), fields.begin(), fields.end());
-        }            
+        }
     } else {
         ret = getFieldNames(className, ftype_str);
     }
-    
+
     PyObject * pyret = PyTuple_New((Py_ssize_t)ret.size());
-            
+
     for (unsigned int ii = 0; ii < ret.size(); ++ ii ){
         PyObject * fname = Py_BuildValue("s", ret[ii].c_str());
         if (!fname){
@@ -1713,7 +1735,7 @@ PyObject * moose_ObjId_getFieldNames(_ObjId * self, PyObject *args)
             break;
         }
     }
-    return pyret;             
+    return pyret;
 }
 
 PyDoc_STRVAR(moose_ObjId_getNeighbors_documentation,
@@ -1731,7 +1753,7 @@ PyDoc_STRVAR(moose_ObjId_getNeighbors_documentation,
              "neighbors: tuple of vecs.\n"
              "    tuple containing the ids of the neighbour vecs.\n"
              "\n");
-             
+
 PyObject * moose_ObjId_getNeighbors(_ObjId * self, PyObject * args)
 {
     if (!Id::isValid(self->oid_.id)){
@@ -1744,14 +1766,14 @@ PyObject * moose_ObjId_getNeighbors(_ObjId * self, PyObject * args)
     vector< Id > val = LookupField< string, vector< Id > >::get(self->oid_, "neighbors", string(field));
 
     PyObject * ret = PyTuple_New((Py_ssize_t)val.size());
-            
-    for (unsigned int ii = 0; ii < val.size(); ++ ii ){            
+
+    for (unsigned int ii = 0; ii < val.size(); ++ ii ){
         _Id * entry = PyObject_New(_Id, &IdType);
         if (!entry || PyTuple_SetItem(ret, (Py_ssize_t)ii, (PyObject*)entry)){
             Py_DECREF(ret);
             // Py_DECREF((PyObject*)entry);
-            ret = NULL;                                 
-            break;                                      
+            ret = NULL;
+            break;
         }
         entry->id_ = val[ii];
     }
@@ -1764,21 +1786,33 @@ PyObject * moose_ObjId_getNeighbors(_ObjId * self, PyObject * args)
 
 // 2011-03-28 10:51:52 (+0530)
 PyDoc_STRVAR(moose_ObjId_connect_documentation,
-             "connect(srcfield, destobj, destfield, msgtype) -> bool\n"
+             "connect(src, srcfield, destobj, destfield[,msgtype]) -> bool\n"
              "\n"
-             "Connect another object via a message.\n"
+             "Create a message between `src_field` on `src` object to `dest_field` on `dest` object.\n"
+             "This function is used mainly, to say, connect two entities, and to denote what kind of give-and-take relationship they share."
+             "It enables the 'destfield' (of the 'destobj') to acquire the data, from 'srcfield'(of the 'src')."
              "\n"
              "Parameters\n"
              "----------\n"
+             "src : element/vec/string\n"
+             "    the source object (or its path) \n"
+             "    (the one that provides information)\n"
              "srcfield : str\n"
-             "    source field on self.\n"
+             "    source field on self.(type of the information)\n"
              "destobj : element\n"
              "    Destination object to connect to.\n"
+             "    (The one that need to get information)\n"
              "destfield : str\n"
              "    field to connect to on `destobj`.\n"
              "msgtype : str\n"
-             "    type of the message. Can be `Single`, `OneToAll`, `AllToOne`,\n"
-             "   `OneToOne`, `Reduce`, `Sparse`. Default: `Single`.\n"
+             "    type of the message. Can be \n"
+             "    `Single` - \n"
+             "    `OneToAll` - \n"
+             "    `AllToOne` - \n"
+             "    `OneToOne` - \n"
+             "    `Reduce` - \n"
+             "    `Sparse` - \n"
+             "    Default: `Single`.\n"
              "\n"
              "Returns\n"
              "-------\n"
@@ -1804,7 +1838,7 @@ PyObject * moose_ObjId_connect(_ObjId * self, PyObject * args)
     if (!Id::isValid(self->oid_.id)){
         RAISE_INVALID_ID(NULL, "moose_ObjId_connect");
     }
-    extern PyTypeObject ObjIdType;        
+    extern PyTypeObject ObjIdType;
     PyObject * destPtr = NULL;
     char * srcField = NULL, * destField = NULL, * msgType = NULL;
     static char default_msg_type[] = "Single";
@@ -1830,7 +1864,7 @@ PyObject * moose_ObjId_connect(_ObjId * self, PyObject * args)
                         "connect failed: check field names and type compatibility.");
         return NULL;
     }
-    _ObjId* msgMgrId = (_ObjId*)PyObject_New(_ObjId, &ObjIdType);        
+    _ObjId* msgMgrId = (_ObjId*)PyObject_New(_ObjId, &ObjIdType);
     msgMgrId->oid_ = mid;
     return (PyObject*)msgMgrId;
 }
@@ -1840,7 +1874,7 @@ PyDoc_STRVAR(moose_ObjId_richcompare_documentation,
              "the paths of the element instances. This function exists only to\n"
              "facilitate certain operations requiring sorting/comparison, like\n"
              "using elements for dict keys. Conceptually only equality comparison is\n"
-             "meaningful for elements.\n"); 
+             "meaningful for elements.\n");
 PyObject* moose_ObjId_richcompare(_ObjId * self, PyObject * other, int op)
 {
     if (!Id::isValid(self->oid_.id)){
@@ -1892,13 +1926,19 @@ PyObject* moose_ObjId_richcompare(_ObjId * self, PyObject * other, int op)
 PyDoc_STRVAR(moose_ObjId_getDataIndex_documentation,
              "getDataIndex() -> int\n"
              "\n"
-             "Get the dataIndex of this object.\n"
+             "Returns the dataIndex (position of the object in vector) "
+             "of this object, if it belongs to a vector, otherwise returns 0.\n"
+             "\n"
+             "        >>> comp = moose.Compartment('/comp')\n"
+             "        >>> comp.getDataIndex()\n"
+             "        >>> 0\n"
+             ""
              );
 PyObject * moose_ObjId_getDataIndex(_ObjId * self)
 {
     if (!Id::isValid(self->oid_.id)){
         RAISE_INVALID_ID(NULL, "moose_ObjId_getDataIndex");
-    }        
+    }
     PyObject * ret = Py_BuildValue("I", self->oid_.dataIndex);
     return ret;
 }
@@ -1921,7 +1961,7 @@ PyObject * moose_ObjId_getFieldIndex(_ObjId * self)
 
 static PyMethodDef ObjIdMethods[] = {
     {"getFieldType", (PyCFunction)moose_ObjId_getFieldType, METH_VARARGS,
-     moose_ObjId_getFieldType_documentation},        
+     moose_ObjId_getFieldType_documentation},
     {"getField", (PyCFunction)moose_ObjId_getField, METH_VARARGS,
      moose_ObjId_getField_documentation},
     {"setField", (PyCFunction)moose_ObjId_setField, METH_VARARGS,
@@ -1947,7 +1987,7 @@ static PyMethodDef ObjIdMethods[] = {
      "Get the index of this object as a field."},
     {"setDestField", (PyCFunction)moose_ObjId_setDestField, METH_VARARGS,
      moose_ObjId_setDestField_documentation},
-    {NULL, NULL, 0, NULL},        /* Sentinel */        
+    {NULL, NULL, 0, NULL},        /* Sentinel */
 };
 
 
@@ -2011,7 +2051,7 @@ PyDoc_STRVAR(moose_ObjId_documentation,
              ">>> c = moose.melement(b)"
              );
 
-PyTypeObject ObjIdType = { 
+PyTypeObject ObjIdType = {
     PyVarObject_HEAD_INIT(NULL, 0)            /* tp_head */
     "moose.melement",                      /* tp_name */
     sizeof(_ObjId),                     /* tp_basicsize */
@@ -2055,5 +2095,5 @@ PyTypeObject ObjIdType = {
 
 
 
-// 
+//
 // melement.cpp ends here
diff --git a/pymoose/mfield.cpp b/pymoose/mfield.cpp
index 18bd3f73c3391d375ce409058fd88c474abd8bdd..7995427f2a9e40e0171c4af41e6936ce2ca02607 100644
--- a/pymoose/mfield.cpp
+++ b/pymoose/mfield.cpp
@@ -163,7 +163,6 @@ PyObject * moose_Field_repr(_Field * self)
     return PyString_FromString(fieldPath.str().c_str());
 }
 
-
 PyDoc_STRVAR(moose_Field_documentation,
              "Base class for MOOSE fields.\n"
              "\n"
@@ -175,8 +174,6 @@ PyDoc_STRVAR(moose_Field_documentation,
              "are putting fields as dictionary keys, you should do that after names\n"
              "of all elements have been finalized.\n"
              "\n");
-
-
 static PyTypeObject moose_Field =
 {
     PyVarObject_HEAD_INIT(NULL, 0)
diff --git a/pymoose/moosemodule.cpp b/pymoose/moosemodule.cpp
index 1ac1d91f6c8737b1bca5fc6b3d99b5332a4b0668..70295a156cc325bf1a3c2d7dd3e1ff900b98b9eb 100644
--- a/pymoose/moosemodule.cpp
+++ b/pymoose/moosemodule.cpp
@@ -75,10 +75,10 @@ using namespace std;
 extern void testSync();
 extern void testAsync();
 
-extern void testSyncArray( 
+extern void testSyncArray(
         unsigned int size,
         unsigned int numThreads,
-        unsigned int method 
+        unsigned int method
         );
 
 extern void testShell();
@@ -104,14 +104,14 @@ extern void test_moosemodule();
 
 extern Id init(
         int argc, char ** argv, bool& doUnitTests
-        , bool& doRegressionTests, unsigned int& benchmark 
+        , bool& doRegressionTests, unsigned int& benchmark
         );
 
 extern void initMsgManagers();
 extern void destroyMsgManagers();
 
 extern void speedTestMultiNodeIntFireNetwork(
-        unsigned int size, unsigned int runsteps 
+        unsigned int size, unsigned int runsteps
         );
 
 extern void mooseBenchmarks( unsigned int option );
@@ -1350,8 +1350,12 @@ PyDoc_STRVAR(moose_getFieldNames_documentation,
              "className : string\n"
              "    Name of the class to look up.\n"
              "finfoType : string\n"
-             "    The kind of field (`valueFinfo`, `srcFinfo`, `destFinfo`,\n"
-             "    `lookupFinfo`, `fieldElementFinfo`.).\n"
+             "    The kind of field "
+             "        `valueFinfo` - "
+             "        `srcFinfo`   -  "
+             "        `destFinfo`  - "
+             "        `lookupFinfo`- "
+             "        `fieldElementFinfo` - \n"
              "\n"
              "Returns\n"
              "-------\n"
@@ -1383,31 +1387,32 @@ PyObject * moose_getFieldNames(PyObject * dummy, PyObject * args)
 }
 
 PyDoc_STRVAR(moose_copy_documentation,
-             "copy(src, dest, name, n, toGlobal, copyExtMsg) -> bool\n"
-             "\n"
-             "Make copies of a moose object.\n"
-             "\n"
-             "Parameters\n"
-             "----------\n"
-             "src : vec, element or str\n"
-             "    source object.\n"
-             "dest : vec, element or str\n"
-             "    Destination object to copy into.\n"
-             "name : str\n"
-             "    Name of the new object. If omitted, name of the original will be used.\n"
-             "n : int\n"
-             "    Number of copies to make.\n"
-             "toGlobal : int\n"
-             "    Relevant for parallel environments only. If false, the copies will\n"
-             "    reside on local node, otherwise all nodes get the copies.\n"
-             "copyExtMsg : int\n"
-             "    If true, messages to/from external objects are also copied.\n"
-             "\n"
-             "Returns\n"
-             "-------\n"
-             "vec\n"
-             "    newly copied vec\n"
+        "copy(src, dest, name, n, toGlobal, copyExtMsg) -> bool\n"
+        "\n"
+        "Make copies of a moose object.\n"
+        "\n"
+        "Parameters\n"
+        "----------\n"
+        "src : vec, element or str\n"
+        "    source object.\n"
+        "dest : vec, element or str\n"
+        "    Destination object to copy into.\n"
+        "name : str\n"
+        "    Name of the new object. If omitted, name of the original will be used.\n"
+        "n : int\n"
+        "    Number of copies to make.\n"
+        "toGlobal : int\n"
+        "    Relevant for parallel environments only. If false, the copies will\n"
+        "    reside on local node, otherwise all nodes get the copies.\n"
+        "copyExtMsg : int\n"
+        "    If true, messages to/from external objects are also copied.\n"
+        "\n"
+        "Returns\n"
+        "-------\n"
+        "vec\n"
+        "    newly copied vec\n"
             );
+
 PyObject * moose_copy(PyObject * dummy, PyObject * args, PyObject * kwargs)
 {
     PyObject * src = NULL, * dest = NULL;
@@ -1643,8 +1648,8 @@ PyDoc_STRVAR(moose_useClock_documentation,
              "Examples\n"
              "--------\n"
              "In multi-compartmental neuron model a compartment's membrane potential (Vm) is dependent on its neighbours' membrane potential. Thus it must get the neighbour's present Vm before computing its own Vm in next time step. This ordering is achieved by scheduling the `init` function, which communicates membrane potential, on tick 0 and `process` function on tick 1.\n\n"
-             "    >>> moose.useClock(0, '/model/compartment_1', 'init')\n"
-             "    >>> moose.useClock(1, '/model/compartment_1', 'process')\n");
+             "        >>> moose.useClock(0, '/model/compartment_1', 'init')\n"
+             "        >>> moose.useClock(1, '/model/compartment_1', 'process')\n");
 
 PyObject * moose_useClock(PyObject * dummy, PyObject * args)
 {
@@ -1952,42 +1957,52 @@ PyObject * moose_getCwe(PyObject * dummy, PyObject * args)
 }
 
 PyDoc_STRVAR(moose_connect_documentation,
-             "connect(src, src_field, dest, dest_field, message_type) -> bool\n"
-             "\n"
-             "Create a message between `src_field` on `src` object to `dest_field`\n"
-             "on `dest` object.\n"
-             "\n"
-             "Parameters\n"
-             "----------\n"
-             "src : element/vec/string\n"
-             "    the source object (or its path)\n"
-             "src_field : str\n"
-             "    the source field name. Fields listed under `srcFinfo` and\n"
-             "    `sharedFinfo` qualify for this.\n"
-             "dest : element/vec/string\n"
-             "    the destination object.\n"
-             "dest_field : str\n"
-             "    the destination field name. Fields listed under `destFinfo`\n"
-             "    and `sharedFinfo` qualify for this.\n"
-             "message_type : str (optional)\n"
-             "    Type of the message. Can be `Single`, `OneToOne`, `OneToAll`.\n"
-             "    If not specified, it defaults to `Single`.\n"
-             "\n"
-             "Returns\n"
-             "-------\n"
-             "msgmanager: melement\n"
-             "    message-manager for the newly created message.\n"
-             "\n"
-             "Examples\n"
-             "--------\n"
-             "Connect the output of a pulse generator to the input of a spike\n"
-             "generator::\n"
-             "\n"
-             ">>> pulsegen = moose.PulseGen('pulsegen')\n"
-             ">>> spikegen = moose.SpikeGen('spikegen')\n"
-             ">>> moose.connect(pulsegen, 'output', spikegen, 'Vm')\n"
-             "\n"
-            );
+          "connect(src, srcfield, destobj, destfield[,msgtype]) -> bool\n"
+          "\n"
+          "Create a message between `src_field` on `src` object to `dest_field` on `dest` object.\n"
+          "This function is used mainly, to say, connect two entities, and to denote what kind of give-and-take relationship they share."
+          "It enables the 'destfield' (of the 'destobj') to acquire the data, from 'srcfield'(of the 'src')."
+          "\n"
+          "Parameters\n"
+          "----------\n"
+          "src : element/vec/string\n"
+          "    the source object (or its path) \n"
+          "    (the one that provides information)\n"
+          "srcfield : str\n"
+          "    source field on self.(type of the information)\n"
+          "destobj : element\n"
+          "    Destination object to connect to.\n"
+          "    (The one that need to get information)\n"
+          "destfield : str\n"
+          "    field to connect to on `destobj`.\n"
+          "msgtype : str\n"
+          "    type of the message. Can be \n"
+          "    `Single` - \n"
+          "    `OneToAll` - \n"
+          "    `AllToOne` - \n"
+          "    `OneToOne` - \n"
+          "    `Reduce` - \n"
+          "    `Sparse` - \n"
+          "    Default: `Single`.\n"
+          "\n"
+          "Returns\n"
+          "-------\n"
+          "msgmanager: melement\n"
+          "    message-manager for the newly created message.\n"
+          "\n"
+          "Examples\n"
+          "--------\n"
+          "Connect the output of a pulse generator to the input of a spike\n"
+          "generator::\n"
+          "\n"
+          "    >>> pulsegen = moose.PulseGen('pulsegen')\n"
+          "    >>> spikegen = moose.SpikeGen('spikegen')\n"
+          "    >>> pulsegen.connect('output', spikegen, 'Vm')\n"
+          "\n"
+          "See also\n"
+          "--------\n"
+          "moose.connect\n"
+          );
 
 PyObject * moose_connect(PyObject * dummy, PyObject * args)
 {
@@ -2085,7 +2100,7 @@ PyDoc_STRVAR(moose_getFieldDict_documentation,
              "List all the source fields on class Neutral::\n"
              "\n"
              ">>> moose.getFieldDict('Neutral', 'srcFinfo')\n"
-             "{'childMsg': 'int'}\n"
+             "    {'childMsg': 'int'}\n"
              "\n"
              "\n");
 PyObject * moose_getFieldDict(PyObject * dummy, PyObject * args)
@@ -2499,16 +2514,114 @@ int defineAllClasses(PyObject * module_dict)
   have to recursively call this function using the base class
   string.
 */
+
 PyDoc_STRVAR(moose_Class_documentation,
              "*-----------------------------------------------------------------*\n"
              "* This is Python generated documentation.                         *\n"
              "* Use moose.doc('classname') to display builtin documentation for *\n"
              "* class `classname`.                                              *\n"
              "* Use moose.doc('classname.fieldname') to display builtin         *\n"
-             "* documentationfor `field` in class `classname`.                  *\n"
+             "* documentation for `field` in class `classname`.                 *\n"
              "*-----------------------------------------------------------------*\n"
             );
 
+int defineLookupFinfos(const Cinfo * cinfo)
+{
+    const string & className = cinfo->name();
+#ifndef NDEBUG
+    if (verbosity > 1)
+    {
+        cout << "\tDefining lookupFields for " << className << endl;
+    }
+#endif
+    unsigned int num = cinfo->getNumLookupFinfo();
+    unsigned int currIndex = get_getsetdefs()[className].size();
+    for (unsigned int ii = 0; ii < num; ++ii)
+    {
+        const string& name = const_cast<Cinfo*>(cinfo)->getLookupFinfo(ii)->name();
+        PyGetSetDef getset;
+        get_getsetdefs()[className].push_back(getset);
+        get_getsetdefs()[className][currIndex].name = (char*)calloc(name.size() + 1, sizeof(char));
+        strncpy(const_cast<char*>(get_getsetdefs()[className][currIndex].name)
+                , const_cast<char*>(name.c_str()), name.size());
+        get_getsetdefs()[className][currIndex].doc = (char*) "Lookup field";
+        get_getsetdefs()[className][currIndex].get = (getter)moose_ObjId_get_lookupField_attr;
+        PyObject * args = PyTuple_New(1);
+        PyTuple_SetItem(args, 0, PyString_FromString(name.c_str()));
+        get_getsetdefs()[className][currIndex].closure = (void*)args;
+#ifndef NDEBUG
+        if (verbosity > 1)
+        {
+            cout << "\tDefined lookupField " << get_getsetdefs()[className][currIndex].name << endl;
+        }
+#endif
+
+        ++currIndex;
+    }
+    return 1;
+}
+
+int defineDestFinfos(const Cinfo * cinfo)
+{
+    const string& className = cinfo->name();
+#ifndef NDEBUG
+    if (verbosity > 1)
+    {
+        cout << "\tCreating destField attributes for " << className << endl;
+    }
+#endif
+    vector <PyGetSetDef>& vec = get_getsetdefs()[className];
+    /*
+      We do not know the final number of user-accessible
+      destFinfos as we have to ignore the destFinfos starting
+      with get/set. So use a vector instead of C array.
+    */
+    size_t currIndex = vec.size();
+    for (unsigned int ii = 0; ii < cinfo->getNumDestFinfo(); ++ii)
+    {
+        Finfo * destFinfo = const_cast<Cinfo*>(cinfo)->getDestFinfo(ii);
+        const string& name = destFinfo->name();
+        /*
+          get_{xyz} and set_{xyz} are internal destFinfos for
+          accessing valueFinfos. Ignore them.
+
+          With the '_' removed from internal get/set for value
+          fields, we cannot separate them out. - Subha Fri Jan 31
+          16:43:51 IST 2014
+
+          The policy changed in the past and hence the following were commented out.
+          - Subha Tue May 26 00:25:28 EDT 2015
+         */
+        // if (name.find("get") == 0 || name.find("set") == 0){
+        //     continue;
+        // }
+        PyGetSetDef destFieldGetSet;
+        vec.push_back(destFieldGetSet);
+
+        vec[currIndex].name = (char*)calloc(name.size() + 1, sizeof(char));
+        strncpy(vec[currIndex].name,
+                const_cast<char*>(name.c_str()),
+                name.size());
+
+        vec[currIndex].doc = (char*) "D_field";
+        vec[currIndex].get = (getter)moose_ObjId_get_destField_attr;
+        PyObject * args = PyTuple_New(1);
+        if (args == NULL)
+        {
+            cerr << "moosemodule.cpp: defineDestFinfos: Failed to allocate tuple" << endl;
+            return 0;
+        }
+        PyTuple_SetItem(args, 0, PyString_FromString(name.c_str()));
+        vec[currIndex].closure = (void*)args;
+
+        //LOG( debug, "\tCreated destField " << vec[currIndex].name );
+
+        ++currIndex;
+    } // ! for
+
+    return 1;
+}
+
 int defineClass(PyObject * module_dict, const Cinfo * cinfo)
 {
     const string& className = cinfo->name();
@@ -2577,7 +2690,7 @@ int defineClass(PyObject * module_dict, const Cinfo * cinfo)
     new_class->tp_name = strdup(str.c_str());
     new_class->tp_doc = moose_Class_documentation;
 
-    // strncpy(new_class->tp_doc, moose_Class_documentation, strlen(moose_Class_documentation));
+    //strncpy(new_class->tp_doc, moose_Class_documentation, strlen(moose_Class_documentation));
     map<string, PyTypeObject *>::iterator base_iter =
         get_moose_classes().find(cinfo->getBaseClass());
     if (base_iter == get_moose_classes().end())
@@ -2682,68 +2795,6 @@ PyObject * moose_ObjId_get_destField_attr(PyObject * self, void * closure)
     return (PyObject*)ret;
 }
 
-
-int defineDestFinfos(const Cinfo * cinfo)
-{
-    const string& className = cinfo->name();
-#ifndef NDEBUG
-    if (verbosity > 1)
-    {
-        cout << "\tCreating destField attributes for " << className << endl;
-    }
-#endif
-    vector <PyGetSetDef>& vec = get_getsetdefs()[className];
-    /*
-      We do not know the final number of user-accessible
-      destFinfos as we have to ignore the destFinfos starting
-      with get/set. So use a vector instead of C array.
-    */
-    size_t currIndex = vec.size();
-    for (unsigned int ii = 0; ii < cinfo->getNumDestFinfo(); ++ii)
-    {
-        Finfo * destFinfo = const_cast<Cinfo*>(cinfo)->getDestFinfo(ii);
-        const string& name = destFinfo->name();
-        /*
-          get_{xyz} and set_{xyz} are internal destFinfos for
-          accessing valueFinfos. Ignore them.
-
-          With the '_' removed from internal get/set for value
-          fields, we cannot separate them out. - Subha Fri Jan 31
-          16:43:51 IST 2014
-
-          The policy changed in the past and hence the following were commented out.
-          - Subha Tue May 26 00:25:28 EDT 2015
-         */
-        // if (name.find("get") == 0 || name.find("set") == 0){
-        //     continue;
-        // }
-        PyGetSetDef destFieldGetSet;
-        vec.push_back(destFieldGetSet);
-
-        vec[currIndex].name = (char*)calloc(name.size() + 1, sizeof(char));
-        strncpy(vec[currIndex].name,
-                const_cast<char*>(name.c_str()),
-                name.size());
-
-        vec[currIndex].doc = (char*) "Destination field";
-        vec[currIndex].get = (getter)moose_ObjId_get_destField_attr;
-        PyObject * args = PyTuple_New(1);
-        if (args == NULL)
-        {
-            cerr << "moosemodule.cpp: defineDestFinfos: Failed to allocate tuple" << endl;
-            return 0;
-        }
-        PyTuple_SetItem(args, 0, PyString_FromString(name.c_str()));
-        vec[currIndex].closure = (void*)args;
-
-        //LOG( debug, "\tCreated destField " << vec[currIndex].name );
-
-        ++currIndex;
-    } // ! for
-
-    return 1;
-}
-
 /**
    Try to obtain a LookupField object for a specified
    lookupFinfo. The first item in `closure` must be the name of
@@ -2796,42 +2847,6 @@ PyObject * moose_ObjId_get_lookupField_attr(PyObject * self,
     return (PyObject*)ret;
 }
 
-int defineLookupFinfos(const Cinfo * cinfo)
-{
-    const string & className = cinfo->name();
-#ifndef NDEBUG
-    if (verbosity > 1)
-    {
-        cout << "\tDefining lookupFields for " << className << endl;
-    }
-#endif
-    unsigned int num = cinfo->getNumLookupFinfo();
-    unsigned int currIndex = get_getsetdefs()[className].size();
-    for (unsigned int ii = 0; ii < num; ++ii)
-    {
-        const string& name = const_cast<Cinfo*>(cinfo)->getLookupFinfo(ii)->name();
-        PyGetSetDef getset;
-        get_getsetdefs()[className].push_back(getset);
-        get_getsetdefs()[className][currIndex].name = (char*)calloc(name.size() + 1, sizeof(char));
-        strncpy(const_cast<char*>(get_getsetdefs()[className][currIndex].name)
-                , const_cast<char*>(name.c_str()), name.size());
-        get_getsetdefs()[className][currIndex].doc = (char*) "Lookup field";
-        get_getsetdefs()[className][currIndex].get = (getter)moose_ObjId_get_lookupField_attr;
-        PyObject * args = PyTuple_New(1);
-        PyTuple_SetItem(args, 0, PyString_FromString(name.c_str()));
-        get_getsetdefs()[className][currIndex].closure = (void*)args;
-#ifndef NDEBUG
-        if (verbosity > 1)
-        {
-            cout << "\tDefined lookupField " << get_getsetdefs()[className][currIndex].name << endl;
-        }
-#endif
-
-        ++currIndex;
-    }
-    return 1;
-}
-
 PyObject * moose_ObjId_get_elementField_attr(PyObject * self,
         void * closure)
 {
@@ -3230,15 +3245,15 @@ PyMODINIT_FUNC MODINIT(_moose)
 
     clock_t defclasses_end = clock();
 
-    LOG( moose::info, "`Time to define moose classes:" 
+    LOG( moose::info, "`Time to define moose classes:"
             << (defclasses_end - defclasses_start) * 1.0 /CLOCKS_PER_SEC
        );
 
     PyGILState_Release(gstate);
     clock_t modinit_end = clock();
 
-    LOG( moose::info, "`Time to initialize module:" 
-            << (modinit_end - modinit_start) * 1.0 /CLOCKS_PER_SEC 
+    LOG( moose::info, "`Time to initialize module:"
+            << (modinit_end - modinit_start) * 1.0 /CLOCKS_PER_SEC
        );
 
     if (doUnitTests)
diff --git a/pymoose/pymooseinit.cpp b/pymoose/pymooseinit.cpp
index d089447cb62bcfbde7db0a85794a226309f89e56..e5719af645d9544a99985a6478bf8374e0a077a0 100644
--- a/pymoose/pymooseinit.cpp
+++ b/pymoose/pymooseinit.cpp
@@ -65,7 +65,7 @@ extern unsigned int initMsgManagers();
 extern void destroyMsgManagers();
 // void regressionTests();
 #endif
-extern void speedTestMultiNodeIntFireNetwork( 
+extern void speedTestMultiNodeIntFireNetwork(
 	unsigned int size, unsigned int runsteps );
 
 #ifdef USE_SMOLDYN
@@ -95,7 +95,7 @@ unsigned int getNumCores()
 
 #ifdef MACOSX
 	int mib[4];
-	size_t len = sizeof(numCPU); 
+	size_t len = sizeof(numCPU);
 
 	/* set the mib for hw.ncpu */
 	mib[0] = CTL_HW;
@@ -104,7 +104,7 @@ unsigned int getNumCores()
 	/* get the number of CPUs from the system */
 	sysctl(mib, 2, &numCPU, &len, NULL, 0);
 
-	if( numCPU < 1 ) 
+	if( numCPU < 1 )
 	{
 		mib[1] = HW_NCPU;
 		sysctl( mib, 2, &numCPU, &len, NULL, 0 );
@@ -112,7 +112,7 @@ unsigned int getNumCores()
 #endif
 	if ( numCPU < 1 )
 	{
-#ifndef QUIET_MODE 
+#ifndef QUIET_MODE
 		cout << "No CPU information available. Assuming single core." << endl;
 #else
 #endif
@@ -129,7 +129,7 @@ void checkChildren( Id parent, const string& info )
 {
 	vector< Id > ret;
 	Neutral::children( parent.eref(), ret );
-	cout << info << " checkChildren of " << 
+	cout << info << " checkChildren of " <<
 			parent.element()->getName() << ": " <<
 		ret.size() << " children\n";
 	for ( vector< Id >::iterator i = ret.begin(); i != ret.end(); ++i )
@@ -199,16 +199,16 @@ Id init( int argc, char** argv, bool& doUnitTests, bool& doRegressionTests,
 				exit( 1 );
 		}
 	}
-	if ( myNode == 0 ) 
+	if ( myNode == 0 )
         {
 #ifndef QUIET_MODE
-		cout << "on node " << myNode << ", numNodes = " 
+		cout << "on node " << myNode << ", numNodes = "
                     << numNodes << ", numCores = " << numCores << endl;
 #endif
         }
 
 	Id shellId;
-	Element* shelle = 
+	Element* shelle =
 		new GlobalDataElement( shellId, Shell::initCinfo(), "root", 1 );
 
 	Id clockId = Id::nextId();
@@ -254,7 +254,7 @@ Id init( int argc, char** argv, bool& doUnitTests, bool& doRegressionTests,
 	// SetGet::setShell();
 	// Msg* m = new OneToOneMsg( shelle, shelle );
 	// assert ( m != 0 );
-	
+
 	while ( isInfinite ) // busy loop for debugging under gdb and MPI.
 		;
 
diff --git a/pymoose/test_moosemodule.cpp b/pymoose/test_moosemodule.cpp
index 922ca59dbc59136c6f2cd185bf94a7731c1ecdd4..5eedaec268b3b4893acc559a491ecd69e5606be0 100644
--- a/pymoose/test_moosemodule.cpp
+++ b/pymoose/test_moosemodule.cpp
@@ -1,47 +1,47 @@
 // test_moosemodule.cpp --- 
-// 
+//
 // Filename: test_moosemodule.cpp
-// Description: 
-// Author: 
-// Maintainer: 
+// Description:
+// Author:
+// Maintainer:
 // Created: Tue Jul 23 11:37:57 2013 (+0530)
-// Version: 
+// Version:
 // Last-Updated: Thu Jul 25 21:54:10 2013 (+0530)
 //           By: subha
 //     Update #: 85
-// URL: 
-// Keywords: 
-// Compatibility: 
-// 
-// 
-
-// Commentary: 
-// 
-// 
-// 
-// 
+// URL:
+// Keywords:
+// Compatibility:
+//
+//
+
+// Commentary:
+//
+//
+//
+//
 
 // Change log:
-// 
-// 
-// 
-// 
+//
+//
+//
+//
 // 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 3, 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; see the file COPYING.  If not, write to
 // the Free Software Foundation, Inc., 51 Franklin Street, Fifth
 // Floor, Boston, MA 02110-1301, USA.
-// 
-// 
+//
+//
 
 // Code:
 
@@ -62,7 +62,7 @@ extern "C" {
     void test_to_py()
     {
 #ifdef DO_UNIT_TESTS
-        // conversion of double 
+        // conversion of double
         PyObject * pv;
         double dv = 10.0;
         pv = to_py((void*)&dv, 'd');
@@ -70,7 +70,7 @@ extern "C" {
         assert(PyFloat_AsDouble(pv) == dv);
         Py_XDECREF(pv);
         cout << "." << flush;
-        
+
         // conversion of long
         long lv = 1000000000;
         pv = to_py((void*)&lv, 'l');
@@ -78,7 +78,7 @@ extern "C" {
         assert(PyLong_AsLong(pv) == lv);
         Py_XDECREF(pv);
         cout << "." << flush;
-        
+
         // conversion of int
         int iv = 10;
         pv = to_py((void*)&iv, 'i');
@@ -86,7 +86,7 @@ extern "C" {
         assert(PyInt_AsLong(pv) == iv);
         Py_XDECREF(pv);
         cout << "." << flush;
-        
+
         // conversion of float
         float fv = 7e-3;
         pv = to_py((void*)&fv, 'f');
@@ -94,7 +94,7 @@ extern "C" {
         assert(PyFloat_AsDouble(pv) == fv);
         Py_XDECREF(pv);
         cout << "." << flush;
-        
+
         // string char-array
         string sv = "hello world";
         // C++ string
@@ -103,7 +103,7 @@ extern "C" {
         assert(strcmp(PyString_AsString(pv), sv.c_str()) == 0);
         Py_XDECREF(pv);
         cout << "." << flush;
-        
+
         // Id
         Shell * shell = reinterpret_cast< Shell * >(ObjId( Id(), 0).data());
         Id id = shell->doCreate("Neutral", Id(), "n", 1);
@@ -112,7 +112,7 @@ extern "C" {
         assert(((_Id*)pv)->id_ == id);
         Py_XDECREF(pv);
         cout << "." << flush;
-        
+
         // ObjId
         ObjId oid(id, 0);
         pv = to_py((void*)&oid, 'y');
@@ -132,7 +132,7 @@ extern "C" {
 
 #endif
     }
-    
+
 } // extern "C"
 
 void test_moosemodule()
@@ -140,5 +140,5 @@ void test_moosemodule()
     test_to_py();
 }
 
-// 
+//
 // test_moosemodule.cpp ends here
diff --git a/pymoose/vec.cpp b/pymoose/vec.cpp
index c178b4bf86086c8dec1635a823b7ea97d250851a..733d28965e96d042c5936c7ef6b6b3f8ef6a4103 100644
--- a/pymoose/vec.cpp
+++ b/pymoose/vec.cpp
@@ -26,7 +26,7 @@
 // Mon Jul 22 16:47:10 IST 2013 - Splitting contents of
 // moosemodule.cpp into speparate files.
 //
-//
+//c
 // 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 3, or
@@ -85,6 +85,11 @@ PyDoc_STRVAR(moose_Id_delete_doc,
              "\nDelete the underlying moose object. This will invalidate all"
              "\nreferences to this object and any attempt to access it will raise a"
              "\nValueError."
+             "\n Example"
+             "\n--------"
+             "\n        >>>iaf.delete()"
+             "\n        >>>print iaf.path"
+             "\n          \\            "
              "\n");
 
 PyDoc_STRVAR(moose_Id_setField_doc,
@@ -97,13 +102,20 @@ PyDoc_STRVAR(moose_Id_setField_doc,
              "fieldname: str\n"
              "    field to be set.\n"
              "value: sequence of values\n"
-             "    sequence of values corresponding to individual elements under this\n"
-             "    vec.\n"
-             "\n"
+             "    sequence of values corresponding to individual elements"
+			    	 "    under this vec.\n"
+             "\n Example"
+             "\n--------"
+             "\n        >>> iaf.setField('Vm', 20)"
+             "\n        >>> print iaf.Vm"
+             "\n            [ 20.  20.  20.  20.  20.  20.  20.  20.  20.  20.]"
+             "\n        >>> iaf.setField('Vm', (1, 2, 3, 4, 5, 6, 7, 8, 9, 10))"
+             "\n        >>> print iaf.Vm"
+             "\n            [  1.   2.   3.   4.   5.   6.   7.   8.   9.  10.]"
              "Notes\n"
              "-----\n"
-             "    This is an interface to SetGet::setVec\n"
-            );
+             "    This is an interface to SetGet::setVec"
+             "\n");
 
 static PyMethodDef IdMethods[] =
 {
@@ -115,15 +127,15 @@ static PyMethodDef IdMethods[] =
     },
     {
         "getValue", (PyCFunction)moose_Id_getValue, METH_NOARGS,
-        "Return integer representation of the id of the element."
+        "Returns integer representation of the id of the element."
     },
     {
         "getPath", (PyCFunction)moose_Id_getPath, METH_NOARGS,
-        "Return the path of this vec object."
+        "Returns the path of this vec object."
     },
     {
         "getShape", (PyCFunction)moose_Id_getShape, METH_NOARGS,
-        "Get the shape of the vec object as a tuple."
+        "Returns the shape of the vec object as a tuple."
     },
     {
         "setField", (PyCFunction)moose_Id_setField, METH_VARARGS,
@@ -166,46 +178,24 @@ PyDoc_STRVAR(moose_Id_doc,
              "\n"
              "array-elements are array-like objects which can have one or more"
              " single-elements within them."
-             " vec can be traversed like a Python sequence and is item is an"
+             " vec can be traversed like a Python sequence and its each item is an"
              " element identifying single-objects contained in the array element.\n"
              "\n"
-             "you can create multiple references to the same MOOSE object in Python,"
-             " but as long as they have the same path/id value, they all point to"
+             "you can create multiple references to the same MOOSE object in Python."
+             " As long as they have the same path/id value, they all point to"
              " the same entity in MOOSE.\n"
              "\n"
              "Field access are vectorized. For example, if `comp` is a vec of"
-             " Compartments, which has a field called `Vm` for membrane voltage, then"
+             " Compartments (of size 10), which has a field called `Vm` as membrane voltage, then"
              " `comp.Vm` returns a"
-             " tuple containing the `Vm` value of all the single-elements in this"
+             " tuple containing the `Vm` value of all 10 single-elements in this"
              " vec. There are a few special fields that are unique for vec and are not"
              " vectorized. These are `path`, `name`, `value`, `shape` and `className`."
-             " There are two ways an vec can be initialized, (1) create a new array"
-             " element or (2) create a reference to an existing object.\n"
-             "\n    Fields:"
-             "\n    -------"
-             "\n    path : str"
-             "\n       Path of the vec. In moose vecs are organized in a tree structure"
-             " like unix file system and the paths follow the same convention."
-             "\n"
-             "\n    name : str"
-             "\n        Name of the vec."
-             "\n"
-             "\n    value : int/long"
-             "\n        Numeric identifier of the vec. This is unique within a single"
-             " execution. vec comparison is based on this value and its hash is also"
-             " this. So you can compare and sort vecs and use them as dict keys."
-             "\n"
-             "\n    shape : tuple of ints"
-             "\n        Dimensions of the vec (as shape in numpy.ndarray). Currently only"
-             " one-dimensional vecs are implemented."
-             "\n"
-             "\n    className: str"
-             "\n         The class of the moose object this vec contains. MOOSE core"
-             " implements its own class system independent of Python. pymoose creates"
-             " thin wrappers around them. This field provides you the moose class"
-             " name as defined in C++"
+             " There are two ways an vec can be initialized, \n"
+             "(1) create a new array element or \n"
+             "(2) create a reference to an existing object.\n"
              "\n"
-             "\n Constructor:"
+             "\n      Constructor:"
              "\n"
              "\n    vec(self, path=path, n=size, g=isGlobal, dtype=className)"
              "\n    "
@@ -214,20 +204,18 @@ PyDoc_STRVAR(moose_Id_doc,
              "\n    ----------"
              "\n    path : str/vec/int "
              "\n        Path of an existing array element or for creating a new one. This has"
-             "\n        the same format as unix file path: /{element1}/{element2} ... If there"
-             "\n        is no object with the specified path, moose attempts to create a new"
-             "\n        array element. For that to succeed everything until the last `/`"
+             "\n        the same format as unix file path: /{element1}/{element2} ... "
+             "\n        If there is no object with the specified path, moose attempts to create "
+             "\n        a new array element. For that to succeed everything until the last `/`"
              "\n        character must exist or an error is raised"
              "\n"
-             "\n        Alternatively, path can be vec or integer value of the id of an"
+             "\n        Alternatively, path can be vec or integer value of the Id of an"
              "\n        existing vec object. The new object will be another reference to"
              "\n        the existing object."
              "\n    "
              "\n    n : positive int"
              "\n        This is a positive integers specifying the size of the array element"
-             "\n        to be created. Thus n=2 will create an"
-             "\n        vec with 2 elements."
-             "\n    "
+             "\n        to be created. Thus n=2 will create an vec with 2 elements."
              "\n    "
              "\n    g : int"
              "\n        Specify if this is a global or local element. Global elements are"
@@ -236,15 +224,39 @@ PyDoc_STRVAR(moose_Id_doc,
              "\n    dtype: string"
              "\n        The vector will be of this moose-class."
              "\n    "
+             "\n    Attributes:"
+             "\n    -----------"
+             "\n    path : str"
+             "\n       Path of the vec. In moose vecs are organized in a tree structure"
+             " like unix file system and the paths follow the same convention."
+             "\n"
+             "\n    name : str"
+             "\n        Name of the vec."
+             "\n"
+             "\n    value : int/long"
+             "\n        Numeric identifier of the vec. This is unique within a single"
+             " execution. vec comparison is based on this value and its hash is also"
+             " this. So you can compare and sort vecs and use them as dict keys."
+             "\n"
+             "\n    shape : tuple of ints"
+             "\n        Dimensions of the vec (as shape in numpy.ndarray). Currently only"
+             " one-dimensional vecs are implemented."
+             "\n"
+             "\n    className: str"
+             "\n         The class of the moose object this vec contains. MOOSE core"
+             " implements its own class system independent of Python. pymoose creates"
+             " thin wrappers around them. This field provides you the moose class"
+             " name as defined in C++"
+             "\n"
              "\n    "
              "\n    Examples"
              "\n    ---------"
              "\n        >>> iaf = moose.vec('/iaf', n=10, dtype='IntFire')"
              "\n        >>> iaf.Vm = range(10)"
              "\n        >>> print iaf[5].Vm"
-             "\n        5.0"
+             "\n            5.0"
              "\n        >>> print iaf.Vm"
-             "\n        array([ 0.,  1.,  2.,  3.,  4.,  5.,  6.,  7.,  8.,  9.])"
+             "\n            array([ 0.,  1.,  2.,  3.,  4.,  5.,  6.,  7.,  8.,  9.])"
             );
 
 PyTypeObject IdType =
diff --git a/python/moose/SBML/readSBML.py b/python/moose/SBML/readSBML.py
index 4dcc89cc2a1d657aa522f091841a2ee941b7bad4..7f3d8535843986d1d0620b02a63fa8e1487d95fb 100644
--- a/python/moose/SBML/readSBML.py
+++ b/python/moose/SBML/readSBML.py
@@ -13,8 +13,7 @@
 **           copyright (C) 2003-2017 Upinder S. Bhalla. and NCBS
 Created : Thu May 12 10:19:00 2016(+0530)
 Version
-Last-Updated: Mon Apr 3 15:50:00 2017(+0530)
-
+Last-Updated: Wed Jan 11 2017
           By:
 **********************************************************************/
 
@@ -24,15 +23,15 @@ import sys
 import os.path
 import collections
 import moose
+from .validation import validateModel
 
-from moose.SBML.validation import validateModel
-
-import re
 '''
    TODO in
     -Compartment
+      --Need to add group
       --Need to deal with compartment outside
     -Molecule
+      -- Need to add group
       -- mathML only AssisgmentRule is taken partly I have checked addition and multiplication,
        --, need to do for other calculation.
        -- In Assisgment rule one of the variable is a function, in moose since assignment is done using function,
@@ -63,15 +62,13 @@ def mooseReadSBML(filepath, loadpath, solver="ee"):
     if not foundLibSBML_:
         print('No python-libsbml found.' 
             '\nThis module can be installed by following command in terminal:'
-            '\n\t easy_install python-libsbml'
-            '\n\t apt-get install python-libsbml'
+            '\n\t easy_install python-libsbl'
             )
-        return moose.element('/')
+        return None
 
     if not os.path.isfile(filepath):
         print('%s is not found ' % filepath)
-        return moose.element('/')
-
+        return None
 
     with open(filepath, "r") as filep:
         filep = open(filepath, "r")
@@ -119,10 +116,10 @@ def mooseReadSBML(filepath, loadpath, solver="ee"):
                     return moose.element('/')
                 else:
                     baseId = moose.Neutral(loadpath)
-                    basePath = baseId
                     # All the model will be created under model as
                     # a thumbrule
-                    basePath = moose.Neutral(baseId.path + '/model')
+                    basePath = moose.Neutral(
+                        baseId.path + '/model')
                     # Map Compartment's SBML id as key and value is
                     # list of[ Moose ID and SpatialDimensions ]
                     global comptSbmlidMooseIdMap
@@ -130,31 +127,26 @@ def mooseReadSBML(filepath, loadpath, solver="ee"):
                     warning = " "
                     global msg
                     msg = " "
-                    groupInfo  = {}
-                    modelAnnotaInfo = {}
                     comptSbmlidMooseIdMap = {}
+                    #print(("modelPath:" + basePath.path))
                     globparameterIdValue = {}
-
+                    modelAnnotaInfo = {}
                     mapParameter(model, globparameterIdValue)
                     errorFlag = createCompartment(
                         basePath, model, comptSbmlidMooseIdMap)
-
-                    groupInfo = checkGroup(basePath,model)                        
                     if errorFlag:
                         specInfoMap = {}
                         errorFlag,warning = createSpecies(
-                            basePath, model, comptSbmlidMooseIdMap, specInfoMap, modelAnnotaInfo,groupInfo)
+                            basePath, model, comptSbmlidMooseIdMap, specInfoMap, modelAnnotaInfo)
                         #print(errorFlag,warning)
-                        
                         if errorFlag:
                             errorFlag = createRules(
                                 model, specInfoMap, globparameterIdValue)
                             if errorFlag:
                                 errorFlag, msg = createReaction(
-                                    model, specInfoMap, modelAnnotaInfo, globparameterIdValue,groupInfo)
+                                    model, specInfoMap, modelAnnotaInfo, globparameterIdValue)
                         getModelAnnotation(
                             model, baseId, basePath)
-                        
                     if not errorFlag:
                         print(msg)
                         # Any time in the middle if SBML does not read then I
@@ -169,37 +161,7 @@ def mooseReadSBML(filepath, loadpath, solver="ee"):
             print("Validation failed while reading the model.")
             return moose.element('/')
 
-def checkGroup(basePath,model):
-    groupInfo = {}
-    modelAnnotaInfo = {}
-    if model.getPlugin("groups") != None:
-        mplugin = model.getPlugin("groups")
-        modelgn = mplugin.getNumGroups()
-        for gindex in range(0, mplugin.getNumGroups()):
-            p = mplugin.getGroup(gindex)
-            groupAnnoInfo = {}
-            groupAnnoInfo = getObjAnnotation(p, modelAnnotaInfo)
-            if moose.exists(basePath.path+'/'+groupAnnoInfo["Compartment"]):
-                if not moose.exists(basePath.path+'/'+groupAnnoInfo["Compartment"]+'/'+p.getId()):
-                    moosegrp = moose.Neutral(basePath.path+'/'+groupAnnoInfo["Compartment"]+'/'+p.getId())
-                else:
-                    moosegrp = moose.element(basePath.path+'/'+groupAnnoInfo["Compartment"]+'/'+p.getId())
-                moosegrpinfo = moose.Annotator(moosegrp.path+'/info')
-                moosegrpinfo.color = groupAnnoInfo["bgColor"]
-            else:
-                print ("Compartment not found")
 
-            if p.getKind() == 2:
-                if p.getId() not in groupInfo:
-                    #groupInfo[p.getId()]
-                    for gmemIndex in range(0,p.getNumMembers()):
-                        mem = p.getMember(gmemIndex)
-
-                        if p.getId() in groupInfo:
-                            groupInfo[p.getId()].append(mem.getIdRef())
-                        else:
-                            groupInfo[p.getId()] =[mem.getIdRef()]
-    return groupInfo
 def setupEnzymaticReaction(enz, groupName, enzName,
                            specInfoMap, modelAnnotaInfo):
     enzPool = (modelAnnotaInfo[groupName]["enzyme"])
@@ -208,6 +170,7 @@ def setupEnzymaticReaction(enz, groupName, enzName,
     cplx = (modelAnnotaInfo[groupName]["complex"])
     cplx = str(idBeginWith(cplx))
     complx = moose.element(specInfoMap[cplx]["Mpath"].path)
+
     enzyme_ = moose.Enz(enzParent.path + '/' + enzName)
     moose.move(complx, enzyme_)
     moose.connect(enzyme_, "cplx", complx, "reac")
@@ -323,7 +286,7 @@ def getModelAnnotation(obj, baseId, basepath):
                                 for plots in plotlist:
                                     plots = plots.replace(" ", "")
                                     plotorg = plots
-                                    if( moose.exists(basepath.path + plotorg) and isinstance(moose.element(basepath.path+plotorg),moose.PoolBase)) :
+                                    if moose.exists(basepath.path + plotorg):
                                         plotSId = moose.element(
                                             basepath.path + plotorg)
                                         # plotorg = convertSpecialChar(plotorg)
@@ -338,7 +301,8 @@ def getModelAnnotation(obj, baseId, basepath):
                                         if not fullPath in tablelistname:
                                             tab = moose.Table2(fullPath)
                                             tablelistname.append(fullPath)
-                                            moose.connect(tab, "requestOut", plotSId, "getConc")
+                                            moose.connect(
+                                                tab, "requestOut", plotSId, "getConc")
 
 
 def getObjAnnotation(obj, modelAnnotationInfo):
@@ -347,11 +311,11 @@ def getObjAnnotation(obj, modelAnnotationInfo):
     # modelAnnotaInfo= {}
     annotateMap = {}
     if (obj.getAnnotation() is not None):
-
         annoNode = obj.getAnnotation()
         for ch in range(0, annoNode.getNumChildren()):
             childNode = annoNode.getChild(ch)
-            if (childNode.getPrefix() == "moose" and (childNode.getName() in["ModelAnnotation","EnzymaticReaction","GroupAnnotation"])):
+            if (childNode.getPrefix() == "moose" and (childNode.getName() ==
+                                                      "ModelAnnotation" or childNode.getName() == "EnzymaticReaction")):
                 sublist = []
                 for gch in range(0, childNode.getNumChildren()):
                     grandChildNode = childNode.getChild(gch)
@@ -371,10 +335,6 @@ def getObjAnnotation(obj, modelAnnotationInfo):
                         annotateMap[nodeName] = nodeValue
                     if nodeName == "textColor":
                         annotateMap[nodeName] = nodeValue
-                    if nodeName == "Group":
-                        annotateMap[nodeName] = nodeValue
-                    if nodeName == "Compartment":
-                        annotateMap[nodeName] = nodeValue
     return annotateMap
 
 
@@ -480,7 +440,7 @@ def getEnzAnnotation(obj, modelAnnotaInfo, rev,
     return(groupName)
 
 
-def createReaction(model, specInfoMap, modelAnnotaInfo, globparameterIdValue,groupInfo):
+def createReaction(model, specInfoMap, modelAnnotaInfo, globparameterIdValue):
     # print " reaction "
     # Things done for reaction
     # --Reaction is not created, if substrate and product is missing
@@ -502,17 +462,8 @@ def createReaction(model, specInfoMap, modelAnnotaInfo, globparameterIdValue,gro
         rName = ""
         rId = ""
         reac = model.getReaction(ritem)
-        group = ""
-        reacAnnoInfo = {}
-        reacAnnoInfo = getObjAnnotation(reac, modelAnnotaInfo)
-        # if "Group" in reacAnnoInfo:
-        #     group = reacAnnoInfo["Group"]
-        
         if (reac.isSetId()):
             rId = reac.getId()
-            groups = [k for k, v in groupInfo.iteritems() if rId in v]
-            if groups:
-                group = groups[0] 
         if (reac.isSetName()):
             rName = reac.getName()
             rName = rName.replace(" ", "_space_")
@@ -580,11 +531,6 @@ def createReaction(model, specInfoMap, modelAnnotaInfo, globparameterIdValue,gro
                     sp = react.getSpecies()
                     sp = str(idBeginWith(sp))
                     speCompt = specInfoMap[sp]["comptId"].path
-                    if group:
-                        if moose.exists(speCompt+'/'+group):
-                            speCompt = speCompt+'/'+group
-                        else:
-                            speCompt = (moose.Neutral(speCompt+'/'+group)).path
                     reaction_ = moose.Reac(speCompt + '/' + rName)
                     reactionCreated = True
                     reactSBMLIdMooseId[rName] = {
@@ -814,12 +760,10 @@ def createRules(model, specInfoMap, globparameterIdValue):
             exp = rule.getFormula()
             for mem in ruleMemlist:
                 if (mem in specInfoMap):
-                    #exp1 = exp.replace(mem, str(speFunXterm[mem]))
-                    exp1 = re.sub(r'\b%s\b'% (mem), speFunXterm[mem], exp)
+                    exp1 = exp.replace(mem, str(speFunXterm[mem]))
                     exp = exp1
                 elif(mem in globparameterIdValue):
-                    #exp1 = exp.replace(mem, str(globparameterIdValue[mem]))
-                    exp1 = re.sub(r'\b%s\b'% (mem), globparameterIdValue[mem], exp)
+                    exp1 = exp.replace(mem, str(globparameterIdValue[mem]))
                     exp = exp1
                 else:
                     print("Math expression need to be checked")
@@ -858,7 +802,7 @@ def pullnotes(sbmlId, mooseId):
 
 
 def createSpecies(basePath, model, comptSbmlidMooseIdMap,
-                  specInfoMap, modelAnnotaInfo,groupInfo):
+                  specInfoMap, modelAnnotaInfo):
     # ToDo:
     # - Need to add group name if exist in pool
     # - Notes
@@ -868,19 +812,8 @@ def createSpecies(basePath, model, comptSbmlidMooseIdMap,
     else:
         for sindex in range(0, model.getNumSpecies()):
             spe = model.getSpecies(sindex)
-            group = ""
-            specAnnoInfo = {}
-            specAnnoInfo = getObjAnnotation(spe, modelAnnotaInfo)
-
-            # if "Group" in specAnnoInfo:
-            #     group = specAnnoInfo["Group"]
-            
             sName = None
             sId = spe.getId()
-
-            groups = [k for k, v in groupInfo.iteritems() if sId in v]
-            if groups:
-                group = groups[0] 
             if spe.isSetName():
                 sName = spe.getName()
                 sName = sName.replace(" ", "_space_")
@@ -897,11 +830,7 @@ def createSpecies(basePath, model, comptSbmlidMooseIdMap,
             hasonlySubUnit = spe.getHasOnlySubstanceUnits()
             # "false": is {unit of amount}/{unit of size} (i.e., concentration or density).
             # "true": then the value is interpreted as having a unit of amount only.
-            if group:
-                if moose.exists(comptEl+'/'+group):
-                    comptEl = comptEl+'/'+group
-                else:
-                    comptEl = (moose.Neutral(comptEl+'/'+group)).path
+
             if (boundaryCondition):
                 poolId = moose.BufPool(comptEl + '/' + sName)
             else:
@@ -909,13 +838,13 @@ def createSpecies(basePath, model, comptSbmlidMooseIdMap,
 
             if (spe.isSetNotes):
                 pullnotes(spe, poolId)
-            
+            specAnnoInfo = {}
+            specAnnoInfo = getObjAnnotation(spe, modelAnnotaInfo)
             if specAnnoInfo:
                 if not moose.exists(poolId.path + '/info'):
                     poolInfo = moose.Annotator(poolId.path + '/info')
                 else:
                     poolInfo = moose.element(poolId.path + '/info')
-
                 for k, v in list(specAnnoInfo.items()):
                     if k == 'xCord':
                         poolInfo.x = float(v)
@@ -977,7 +906,6 @@ def createSpecies(basePath, model, comptSbmlidMooseIdMap,
                         if (rule_variable == sId):
                             found = True
                             break
-                
                 if not (found):
                     print(
                         "Invalid SBML: Either initialConcentration or initialAmount must be set or it should be found in assignmentRule but non happening for ",
diff --git a/python/moose/SBML/writeSBML.py b/python/moose/SBML/writeSBML.py
index 5cdb25bc8e0ce9af4d016bb47d0d0364cd15aa58..3f39cc3bffa8d1e6941c05dcbf5c6aa814e1053c 100644
--- a/python/moose/SBML/writeSBML.py
+++ b/python/moose/SBML/writeSBML.py
@@ -12,7 +12,7 @@
 **           copyright (C) 2003-2017 Upinder S. Bhalla. and NCBS
 Created : Friday May 27 12:19:00 2016(+0530)
 Version
-Last-Updated: Tue Apr 4 14:20:00 2017(+0530)
+Last-Updated: Wed Jan 11 15:20:00 2017(+0530)
           By:
 **********************************************************************/
 /****************************
@@ -22,13 +22,14 @@ import sys
 import re
 #from collections import Counter
 import moose
-from moose.SBML.validation import validateModel
+from .validation import validateModel
 from moose.chemUtil.chemConnectUtil import *
 from moose.chemUtil.graphUtils import *
 
 
 # ToDo:
 #   Table should be written
+#   Group's should be added
 # boundary condition for buffer pool having assignment statment constant
 # shd be false
 
@@ -45,12 +46,11 @@ def mooseWriteSBML(modelpath, filename, sceneitems={}):
     if not foundLibSBML_:
         print('No python-libsbml found.' 
             '\nThis module can be installed by following command in terminal:'
-            '\n\t easy_install python-libsbml or'
-            '\n\t apt-get install python-libsbml'
+            '\n\t easy_install python-libsbml'
             )
-        return -2, "Could not save the model in to SBML file. \nThis module can be installed by following command in terminal: \n\t easy_install python-libsbml or \n\t apt-get install python-libsbml",''
+        return -1, msg
 
-    #sbmlDoc = SBMLDocument(3, 1)
+    sbmlDoc = SBMLDocument(3, 1)
     filepath, filenameExt = os.path.split(filename)
     if filenameExt.find('.') != -1:
         filename = filenameExt[:filenameExt.find('.')]
@@ -64,22 +64,16 @@ def mooseWriteSBML(modelpath, filename, sceneitems={}):
     global nameList_
     nameList_ = []
     positionInfoexist = False
-    
-    xmlns = SBMLNamespaces(3, 1)
-    xmlns.addNamespace("http://www.w3.org/1999/xhtml", "xhtml")
-    xmlns.addNamespace("http://www.moose.ncbs.res.in", "moose")
-    xmlns.addNamespace("http://www.sbml.org/sbml/level3/version1/groups/version1", "groups")
-    sbmlDoc = SBMLDocument(xmlns)
-    sbmlDoc.setPackageRequired("groups",bool(0))
-    
+    xmlns = XMLNamespaces()
+    xmlns.add("http://www.sbml.org/sbml/level3/version1")
+    xmlns.add("http://www.moose.ncbs.res.in", "moose")
+    xmlns.add("http://www.w3.org/1999/xhtml", "xhtml")
+    sbmlDoc.setNamespaces(xmlns)
     cremodel_ = sbmlDoc.createModel()
     cremodel_.setId(filename)
-    cremodel_.setTimeUnits("time")
+    cremodel_.setTimeUnits("second")
     cremodel_.setExtentUnits("substance")
     cremodel_.setSubstanceUnits("substance")
-    cremodel_.setVolumeUnits("volume")
-    cremodel_.setAreaUnits("area")
-    cremodel_.setLengthUnits("length")
     neutralNotes = ""
 
     specieslist = moose.wildcardFind(modelpath + '/##[ISA=PoolBase]')
@@ -106,36 +100,14 @@ def mooseWriteSBML(modelpath, filename, sceneitems={}):
     modelAnno = writeSimulationAnnotation(modelpath)
     if modelAnno:
         cremodel_.setAnnotation(modelAnno)
-    groupInfo = {}
-    compartexist, groupInfo = writeCompt(modelpath, cremodel_)
-    
+
+    compartexist = writeCompt(modelpath, cremodel_)
     if compartexist == True:
-        species = writeSpecies( modelpath,cremodel_,sbmlDoc,sceneitems,groupInfo)
+        species = writeSpecies( modelpath,cremodel_,sbmlDoc,sceneitems)
         if species:
             writeFunc(modelpath, cremodel_)
-        reacGroup = {}
-        writeReac(modelpath, cremodel_, sceneitems,groupInfo)
-        writeEnz(modelpath, cremodel_, sceneitems,groupInfo)
-        if groupInfo:
-            for key,value in groupInfo.items():
-                mplugin = cremodel_.getPlugin("groups")
-                group = mplugin.createGroup()
-                name = moose.element(key).name
-                group.setId(name)
-                group.setKind("collection")
-                ginfo = moose.element(key.path+'/info')
-                groupCompartment = findCompartment(key)
-                if ginfo.color != '':
-                    grpAnno = "<moose:GroupAnnotation>"
-                    grpAnno = grpAnno + "<moose:Compartment>" + groupCompartment.name + "</moose:Compartment>\n"
-                    if ginfo.color:
-                        grpAnno = grpAnno + "<moose:bgColor>" + ginfo.color + "</moose:bgColor>\n"
-                    grpAnno = grpAnno + "</moose:GroupAnnotation>"
-                    group.setAnnotation(grpAnno)
-
-                for values in value:
-                    member = group.createMember()
-                    member.setIdRef(values)
+        writeReac(modelpath, cremodel_, sceneitems)
+        writeEnz(modelpath, cremodel_, sceneitems)
         consistencyMessages = ""
         SBMLok = validateModel(sbmlDoc)
         if (SBMLok):
@@ -153,7 +125,7 @@ def calPrime(x):
     prime = int((20 * (float(x - cmin) / float(cmax - cmin))) - 10)
     return prime
 
-def writeEnz(modelpath, cremodel_, sceneitems,groupInfo):
+def writeEnz(modelpath, cremodel_, sceneitems):
     for enz in moose.wildcardFind(modelpath + '/##[ISA=EnzBase]'):
         enzannoexist = False
         enzGpnCorCol = " "
@@ -161,25 +133,17 @@ def writeEnz(modelpath, cremodel_, sceneitems,groupInfo):
         enzSubt = ()
         compt = ""
         notesE = ""
-        
         if moose.exists(enz.path + '/info'):
-            groupName = moose.element("/")
             Anno = moose.Annotator(enz.path + '/info')
             notesE = Anno.notes
             element = moose.element(enz)
             ele = getGroupinfo(element)
-            ele = findGroup_compt(element)
-            if ele.className == "Neutral" or sceneitems or Anno.x or Anno.y:
+            if element.className == "Neutral" or sceneitems or Anno.x or Anno.y:
                     enzannoexist = True
             if enzannoexist:
                 enzAnno = "<moose:ModelAnnotation>\n"
                 if ele.className == "Neutral":
-                    groupName = ele
-                    #enzGpnCorCol =  "<moose:Group>" + ele.name + "</moose:Group>\n"
-                    # if ele.name not in groupInfo:
-                    #         groupInfo[ele.name]=[setId]
-                    #     else:
-                    #         groupInfo[ele.name].append(setId)
+                    enzGpnCorCol =  "<moose:Group>" + ele.name + "</moose:Group>\n"
                 if sceneitems:
                     #Saved from GUI, then scene co-ordinates are passed
                     enzGpnCorCol = enzGpnCorCol + "<moose:xCord>" + \
@@ -199,6 +163,7 @@ def writeEnz(modelpath, cremodel_, sceneitems,groupInfo):
                 if Anno.textColor:
                     enzGpnCorCol = enzGpnCorCol + "<moose:textColor>" + \
                         Anno.textColor + "</moose:textColor>\n"
+
         if (enz.className == "Enz" or enz.className == "ZombieEnz"):
             enzyme = cremodel_.createReaction()
             if notesE != "":
@@ -213,20 +178,14 @@ def writeEnz(modelpath, cremodel_, sceneitems,groupInfo):
                 compt = comptVec.name + "_" + \
                     str(comptVec.getId().value) + "_" + \
                     str(comptVec.getDataIndex()) + "_"
-            enzsetId = str(idBeginWith(cleanEnzname +
+
+            enzyme.setId(str(idBeginWith(cleanEnzname +
                                          "_" +
                                          str(enz.getId().value) +
                                          "_" +
                                          str(enz.getDataIndex()) +
                                          "_" +
-                                         "Complex_formation_"))
-            enzyme.setId(enzsetId)
-            
-            if groupName != moose.element('/'):
-                if groupName not in groupInfo:
-                    groupInfo[groupName]=[enzsetId]
-                else:
-                    groupInfo[groupName].append(enzsetId)
+                                         "Complex_formation_")))
             enzyme.setName(cleanEnzname)
             enzyme.setFast(False)
             enzyme.setReversible(True)
@@ -267,7 +226,7 @@ def writeEnz(modelpath, cremodel_, sceneitems,groupInfo):
                 noofSub, sRateLaw = getSubprd(cremodel_, True, "sub", enzSubt)
                 #rec_order = rec_order + noofSub
                 rec_order = noofSub
-                rate_law = compt + " * ( " + rate_law + " * " + sRateLaw
+                rate_law = compt + " * " + rate_law + "*" + sRateLaw
 
             enzPrd = enz.neighbors["cplxDest"]
             if not enzPrd:
@@ -277,7 +236,7 @@ def writeEnz(modelpath, cremodel_, sceneitems,groupInfo):
                 for i in range(0, len(nameList_)):
                     enzAnno = enzAnno + "<moose:product>" + \
                         nameList_[i] + "</moose:product>\n"
-                rate_law = rate_law + " - " + " k2 " + ' * ' + sRateLaw +" )"
+                rate_law = rate_law + " - " + compt + "* k2" + '*' + sRateLaw
 
             prd_order = noofPrd
             enzAnno = enzAnno + "<moose:groupName>" + cleanEnzname + "_" + \
@@ -300,21 +259,14 @@ def writeEnz(modelpath, cremodel_, sceneitems,groupInfo):
             unit = parmUnit(rec_order - 1, cremodel_)
             printParameters(kl, "k1", k1, unit)
             enzyme = cremodel_.createReaction()
-            enzsetIdP = str(idBeginWith(cleanEnzname +
+            enzyme.setId(str(idBeginWith(cleanEnzname +
                                          "_" +
                                          str(enz.getId().value) +
                                          "_" +
                                          str(enz.getDataIndex()) +
                                          "_" +
-                                         "Product_formation_"))
-            enzyme.setId(enzsetIdP)
+                                         "Product_formation_")))
             enzyme.setName(cleanEnzname)
-            if groupName != moose.element('/'):
-                if groupName not in groupInfo:
-                    groupInfo[groupName]=[enzsetIdP]
-                else:
-                    groupInfo[groupName].append(enzsetIdP)
-
             enzyme.setFast(False)
             enzyme.setReversible(False)
             enzAnno2 = "<moose:EnzymaticReaction>"
@@ -364,7 +316,6 @@ def writeEnz(modelpath, cremodel_, sceneitems,groupInfo):
             printParameters(kl, "k3", k3, unit)
 
         elif(enz.className == "MMenz" or enz.className == "ZombieMMenz"):
-
             enzSub = enz.neighbors["sub"]
             enzPrd = enz.neighbors["prd"]
             if (len(enzSub) != 0 and len(enzPrd) != 0):
@@ -382,18 +333,12 @@ def writeEnz(modelpath, cremodel_, sceneitems,groupInfo):
                     notesStringE = "<body xmlns=\"http://www.w3.org/1999/xhtml\">\n \t \t" + \
                         cleanNotesE + "\n\t </body>"
                     enzyme.setNotes(notesStringE)
-                mmenzsetId = str(idBeginWith(cleanEnzname +
+                enzyme.setId(str(idBeginWith(cleanEnzname +
                                              "_" +
                                              str(enz.getId().value) +
                                              "_" +
                                              str(enz.getDataIndex()) +
-                                             "_"))
-                enzyme.setId(mmenzsetId)
-                if groupName != moose.element('/'):
-                    if groupName not in groupInfo:
-                        groupInfo[groupName]=[mmenzsetId]
-                    else:
-                        groupInfo[groupName].append(mmenzsetId)
+                                             "_")))
                 enzyme.setName(cleanEnzname)
                 enzyme.setFast(False)
                 enzyme.setReversible(True)
@@ -413,15 +358,14 @@ def writeEnz(modelpath, cremodel_, sceneitems,groupInfo):
                 enzPrd = enz.neighbors["prd"]
                 noofPrd, sRateLawP = getSubprd(cremodel_, False, "prd", enzPrd)
                 kl = enzyme.createKineticLaw()
-                fRate_law = compt + " * ( kcat * " + sRateLawS + " * " + sRateLawM + \
-                    " / ( Km" + " + " + sRateLawS + "))"
+                fRate_law = "kcat *" + sRateLawS + "*" + sRateLawM + \
+                    "/(" + compt + " * (" + "Km" + "+" + sRateLawS + "))"
                 kl.setFormula(fRate_law)
                 kl.setNotes(
                     "<body xmlns=\"http://www.w3.org/1999/xhtml\">\n\t\t" +
                     fRate_law +
                     "\n \t </body>")
-                KmUnit(cremodel_)
-                printParameters(kl, "Km", Km, "mmole_per_litre")
+                printParameters(kl, "Km", Km, "substance")
                 kcatUnit = parmUnit(0, cremodel_)
                 printParameters(kl, "kcat", kcat, kcatUnit)
 
@@ -432,29 +376,6 @@ def printParameters(kl, k, kvalue, unit):
     para.setValue(kvalue)
     para.setUnits(unit)
 
-def KmUnit(cremodel_):
-    unit_stream = "mmole_per_litre"
-    lud = cremodel_.getListOfUnitDefinitions()
-    flag = False
-    for i in range(0, len(lud)):
-        ud = lud.get(i)
-        if (ud.getId() == unit_stream):
-            flag = True
-            break
-    if (not flag):
-        unitdef = cremodel_.createUnitDefinition()
-        unitdef.setId(unit_stream)
-        unit = unitdef.createUnit()
-        unit.setKind(UNIT_KIND_LITRE)
-        unit.setExponent(-1)
-        unit.setMultiplier(1)
-        unit.setScale(0)
-        unit = unitdef.createUnit()
-        unit.setKind(UNIT_KIND_MOLE)
-        unit.setExponent(1)
-        unit.setMultiplier(1)
-        unit.setScale(-3)
-    return unit_stream
 
 def parmUnit(rct_order, cremodel_):
     order = rct_order
@@ -463,7 +384,7 @@ def parmUnit(rct_order, cremodel_):
     elif order == 1:
         unit_stream = "litre_per_mmole_per_second"
     elif order == 2:
-        unit_stream = "sq_litre_per_mmole_sq_per_second"
+        unit_stream = "litre_per_mmole_sq_per_second"
     else:
         unit_stream = "litre_per_mmole_" + str(rct_order) + "_per_second"
 
@@ -482,7 +403,7 @@ def parmUnit(rct_order, cremodel_):
         if order != 0:
             unit = unitdef.createUnit()
             unit.setKind(UNIT_KIND_LITRE)
-            unit.setExponent(order)
+            unit.setExponent(1)
             unit.setMultiplier(1)
             unit.setScale(0)
             unit = unitdef.createUnit()
@@ -586,7 +507,7 @@ def listofname(reacSub, mobjEnz):
             nameList_.append(clean_name)
 
 
-def writeReac(modelpath, cremodel_, sceneitems,reacGroup):
+def writeReac(modelpath, cremodel_, sceneitems):
     for reac in moose.wildcardFind(modelpath + '/##[ISA=ReacBase]'):
         reacSub = reac.neighbors["sub"]
         reacPrd = reac.neighbors["prd"]
@@ -596,13 +517,12 @@ def writeReac(modelpath, cremodel_, sceneitems,reacGroup):
             reacannoexist = False
             reacGpname = " "
             cleanReacname = convertSpecialChar(reac.name)
-            setId = str(idBeginWith(cleanReacname +
+            reaction.setId(str(idBeginWith(cleanReacname +
                                            "_" +
                                            str(reac.getId().value) +
                                            "_" +
                                            str(reac.getDataIndex()) +
-                                           "_"))
-            reaction.setId(setId)
+                                           "_")))
             reaction.setName(cleanReacname)
             #Kf = reac.numKf
             #Kb = reac.numKb
@@ -628,11 +548,7 @@ def writeReac(modelpath, cremodel_, sceneitems,reacGroup):
                 if reacannoexist:
                     reacAnno = "<moose:ModelAnnotation>\n"
                     if ele.className == "Neutral":
-                        #reacAnno = reacAnno + "<moose:Group>" + ele.name + "</moose:Group>\n"
-                        if ele not in reacGroup:
-                            reacGroup[ele]=[setId]
-                        else:
-                            reacGroup[ele].append(setId)
+                        reacAnno = reacAnno + "<moose:Group>" + ele.name + "</moose:Group>\n"
                     if sceneitems:
                         #Saved from GUI, then scene co-ordinates are passed
                         reacAnno = reacAnno + "<moose:xCord>" + \
@@ -713,7 +629,6 @@ def writeReac(modelpath, cremodel_, sceneitems,reacGroup):
                 kl_s +
                 "\n \t </body>")
             kfl.setFormula(kl_s)
-
         else:
             print(" Reaction ", reac.name, "missing substrate and product")
 
@@ -752,6 +667,7 @@ def writeFunc(modelpath, cremodel_):
             rule.setVariable(fName)
             rule.setFormula(expr)
 
+
 def convertNotesSpecialChar(str1):
     d = {"&": "_and", "<": "_lessthan_", ">": "_greaterthan_", "BEL": "&#176"}
     for i, j in d.items():
@@ -760,6 +676,7 @@ def convertNotesSpecialChar(str1):
     str1 = str1.strip(' \t\n\r')
     return str1
 
+
 def getGroupinfo(element):
     #   Note: At this time I am assuming that if group exist (incase of Genesis)
     #   1. for 'pool' its between compartment and pool, /modelpath/Compartment/Group/pool
@@ -768,7 +685,8 @@ def getGroupinfo(element):
     #   if /modelpath/Compartment/Group/Group1/Pool, then I check and get Group1
     #   And /modelpath is also a NeutralObject,I stop till I find Compartment
 
-    while not mooseIsInstance(element, ["Neutral", "CubeMesh", "CyclMesh"]):
+    while not mooseIsInstance(element, ["Neutral"]) and not mooseIsInstance(
+            element, ["CubeMesh", "CyclMesh"]):
         element = element.parent
     return element
 
@@ -789,10 +707,6 @@ def idBeginWith(name):
         changedName = "_" + name
     return changedName
 
-def findGroup_compt(melement):
-    while not (mooseIsInstance(melement, ["Neutral","CubeMesh", "CyclMesh"])):
-        melement = melement.parent
-    return melement
 
 def convertSpecialChar(str1):
     d = {"&": "_and", "<": "_lessthan_", ">": "_greaterthan_", "BEL": "&#176", "-": "_minus_", "'": "_prime_",
@@ -804,7 +718,7 @@ def convertSpecialChar(str1):
     return str1
 
 
-def writeSpecies(modelpath, cremodel_, sbmlDoc, sceneitems,speGroup):
+def writeSpecies(modelpath, cremodel_, sbmlDoc, sceneitems):
     # getting all the species
     for spe in moose.wildcardFind(modelpath + '/##[ISA=PoolBase]'):
         sName = convertSpecialChar(spe.name)
@@ -884,13 +798,7 @@ def writeSpecies(modelpath, cremodel_, sbmlDoc, sceneitems,speGroup):
                 if speciannoexist:
                     speciAnno = "<moose:ModelAnnotation>\n"
                     if ele.className == "Neutral":
-                        #speciAnno = speciAnno + "<moose:Group>" + ele.name + "</moose:Group>\n"
-                        if ele not in speGroup:
-                            speGroup[ele]=[spename]
-                        else:
-                            speGroup[ele].append(spename)
-                        
-                        
+                        speciAnno = speciAnno + "<moose:Group>" + ele.name + "</moose:Group>\n"
                     if sceneitems:
                         #Saved from GUI, then scene co-ordinates are passed
                         speciAnno = speciAnno + "<moose:xCord>" + \
@@ -918,7 +826,6 @@ def writeSpecies(modelpath, cremodel_, sbmlDoc, sceneitems,speGroup):
 def writeCompt(modelpath, cremodel_):
     # getting all the compartments
     compts = moose.wildcardFind(modelpath + '/##[ISA=ChemCompt]')
-    groupInfo = {}
     for compt in compts:
         comptName = convertSpecialChar(compt.name)
         # converting m3 to litre
@@ -936,20 +843,10 @@ def writeCompt(modelpath, cremodel_):
         c1.setSize(size)
         c1.setSpatialDimensions(ndim)
         c1.setUnits('volume')
-        #For each compartment get groups information along
-        for grp in moose.wildcardFind(compt.path+'/##[TYPE=Neutral]'): 
-            grp_cmpt = findGroup_compt(grp.parent)        
-            try:
-                value = groupInfo[moose.element(grp)]
-            except KeyError:
-                # Grp is not present
-                groupInfo[moose.element(grp)] = []
-            
-
     if compts:
-        return True,groupInfo
+        return True
     else:
-        return False,groupInfo
+        return False
 # write Simulation runtime,simdt,plotdt
 def writeSimulationAnnotation(modelpath):
     modelAnno = ""
@@ -980,12 +877,12 @@ def writeSimulationAnnotation(modelpath):
                     graphSpefound = True
                 if graphSpefound:
                     if not plots:
-                        plots = ori[ori.find(q.name)-1:len(ori)]
-                        #plots = '/' + q.name + '/' + name
+                        #plots = ori[ori.find(q.name)-1:len(ori)]
+                        plots = '/' + q.name + '/' + name
 
                     else:
-                        plots = plots + "; "+ori[ori.find(q.name)-1:len(ori)]
-                        #plots = plots + "; /" + q.name + '/' + name
+                        #plots = plots + "; "+ori[ori.find(q.name)-1:len(ori)]
+                        plots = plots + "; /" + q.name + '/' + name
         if plots != " ":
             modelAnno = modelAnno + "<moose:plots> " + plots + "</moose:plots>\n"
         modelAnno = modelAnno + "</moose:ModelAnnotation>"
@@ -1008,30 +905,6 @@ def writeUnits(cremodel_):
     unit.setExponent(1.0)
     unit.setScale(-3)
 
-    unitLen = cremodel_.createUnitDefinition()
-    unitLen.setId("length")
-    unit = unitLen.createUnit()
-    unit.setKind(UNIT_KIND_METRE)
-    unit.setMultiplier(1.0)
-    unit.setExponent(1.0)
-    unit.setScale(0)
-
-    unitArea = cremodel_.createUnitDefinition()
-    unitArea.setId("area")
-    unit = unitArea.createUnit()
-    unit.setKind(UNIT_KIND_METRE)
-    unit.setMultiplier(1.0)
-    unit.setExponent(2.0)
-    unit.setScale(0)
-    
-    unitTime = cremodel_.createUnitDefinition()
-    unitTime.setId("time")
-    unit = unitTime.createUnit()
-    unit.setKind(UNIT_KIND_SECOND)
-    unit.setExponent(1)
-    unit.setMultiplier(1)
-    unit.setScale(0)
-
 if __name__ == "__main__":
     try:
         sys.argv[1]
diff --git a/python/moose/__init__.py b/python/moose/__init__.py
index b5447c6cea7f6509c37bcd5a2f80ed0ba1b65ebf..2e2f6772607e82d4ad79b68e78782f4c109e5d30 100644
--- a/python/moose/__init__.py
+++ b/python/moose/__init__.py
@@ -1,616 +1,32 @@
-"""__init__.py: 
-
 """
+How to use the documentation
+----------------------------
 
-from __future__ import print_function
-from __future__ import absolute_import 
-    
-
-from contextlib import closing
-import warnings
-import platform
-import pydoc
-import os
-from io import StringIO
-from collections import defaultdict
-import textwrap
-
-import moose
-from moose._moose import *
-import moose.SBML
-
-# Wrapper to get moose version information.
-__version__ = moose._moose.__version__
-VERSION = moose._moose.VERSION
-
-sequence_types = ['vector<double>',
-                  'vector<int>',
-                  'vector<long>',
-                  'vector<unsigned int>',
-                  'vector<float>',
-                  'vector<unsigned long>',
-                  'vector<short>',
-                  'vector<Id>',
-                  'vector<ObjId>']
-
-known_types = ['void',
-               'char',
-               'short',
-               'int',
-               'unsigned int',
-               'double',
-               'float',
-               'long',
-               'unsigned long',
-               'string',
-               'vec',
-               'melement'] + sequence_types
-
-# SBML related functions.
-
-def mooseReadSBML(filepath, loadpath, solver='ee'):
-    """Load SBML model.
-
-    keyword arguments: \n
-
-    filepath -- filepath to be loaded \n
-    loadpath -- Root path for this model e.g. /model/mymodel \n
-    solver   -- Solver to use (default 'ee' ) \n
-
-    """
-    return moose.SBML.readSBML.mooseReadSBML( filepath, loadpath, solver )
-
-
-def mooseWriteSBML(modelpath, filepath, sceneitems={}):
-    """Writes loaded model under modelpath to a file in SBML format.
-
-    keyword arguments:\n
-
-    modelpath -- model path in moose e.g /model/mymodel \n
-    filepath -- Path of output file. \n
-    sceneitems -- dictlist (UserWarning: user need not worry about this) \n
-                    layout position is saved in Annotation field of all the moose Object (pool,Reaction,enzyme)\n
-                    If this function is called from \n
-                        -- GUI, the layout position of moose object is passed \n
-                        -- command line, \n
-                            ---if genesis/kkit model is loaded then layout position is taken from the file \n
-                            --- else, auto-coordinates is used for layout position and passed
-
-    """
-    return moose.SBML.writeSBML.mooseWriteSBML(modelpath, filepath, sceneitems)
-
-
-def mooseWriteKkit(modelpath, filepath,sceneitems={}):
-    """Writes  loded model under modelpath to a file in Kkit format.
-
-    keyword arguments:\n
-
-    modelpath -- model path in moose \n
-    filepath -- Path of output file.
-    """
-    return moose.genesis.writeKkit.mooseWriteKkit(modelpath, filepath,sceneitems)
-
-
-def moosedeleteChemSolver(modelpath):
-    """ deletes solver on all the compartment and its children.
-        This is neccesary while created a new moose object on a pre-existing modelpath,\n
-        this should be followed by mooseaddChemSolver for add solvers on to compartment to simulate else
-        default is Exponential Euler (ee)
-    """
-    return chemUtil.add_Delete_ChemicalSolver.moosedeleteChemSolver(modelpath)
-
-
-def mooseaddChemSolver(modelpath, solver):
-    """ Add solver on chemical compartment and its children for calculation
-
-    keyword arguments:\n
-
-    modelpath -- model path that is loaded into moose \n
-    solver -- "Exponential Euler" (ee) (default), \n
-              "Gillespie"         ("gssa"), \n
-              "Runge Kutta"       ("gsl")
-
-    """
-    return chemUtil.add_Delete_ChemicalSolver.mooseaddChemSolver(modelpath, solver)
-
-################################################################
-# Wrappers for global functions
-################################################################
-
-
-def pwe():
-    """Print present working element. Convenience function for GENESIS
-    users. If you want to retrieve the element in stead of printing
-    the path, use moose.getCwe()
-
-    """
-    pwe_ = _moose.getCwe()
-    print(pwe_.getPath())
-    return pwe_
-
-
-def le(el=None):
-    """List elements under `el` or current element if no argument
-    specified.
-
-    Parameters
-    ----------
-    el : str/melement/vec/None
-        The element or the path under which to look. If `None`, children
-         of current working element are displayed.
-
-    Returns
-    -------
-    List of path of child elements
-
-    """
-    if el is None:
-        el = getCwe()
-    elif isinstance(el, str):
-        if not exists(el):
-            raise ValueError('no such element')
-        el = element(el)
-    elif isinstance(el, vec):
-        el = el[0]
-    print('Elements under', el.path)
-    for ch in el.children:
-        print(ch.path)
-    return [child.path for child in el.children]
-
-ce = setCwe  # ce is a GENESIS shorthand for change element.
-
-
-def syncDataHandler(target):
-    """Synchronize data handlers for target.
-
-    Parameters
-    ----------
-    target : melement/vec/str
-        Target element or vec or path string.
-
-    Raises
-    ------
-    NotImplementedError
-        The call to the underlying C++ function does not work.
-
-    Notes
-    -----
-    This function is defined for completeness, but currently it does not work.
-
-    """
-    raise NotImplementedError('The implementation is not working for IntFire - goes to invalid objects. \
-First fix that issue with SynBase or something in that line.')
-    if isinstance(target, str):
-        if not _moose.exists(target):
-            raise ValueError('%s: element does not exist.' % (target))
-        target = vec(target)
-        _moose.syncDataHandler(target)
+MOOSE documentation is split into Python documentation and builtin
+documentation. The functions and classes that are only part of the
+Python interface can be viewed via Python's builtin ``help``
+function::
 
+>>> help(moose.connect)
 
-def showfield(el, field='*', showtype=False):
-    """Show the fields of the element `el`, their data types and
-    values in human readable format. Convenience function for GENESIS
-    users.
+The documentation built into main C++ code of MOOSE can be accessed
+via the module function ``doc``::
 
-    Parameters
-    ----------
-    el : melement/str
-        Element or path of an existing element.
+>>> moose.doc('Neutral')
 
-    field : str
-        Field to be displayed. If '*' (default), all fields are displayed.
+To get documentation about a particular field::
 
-    showtype : bool
-        If True show the data type of each field. False by default.
+>>> moose.doc('Neutral.childMsg')
 
-    Returns
-    -------
-    None
+Builtin functions and classes in moose module (Python only)
+-----------------------------------------------------------
 
-    """
-    if isinstance(el, str):
-        if not exists(el):
-            raise ValueError('no such element')
-        el = element(el)
-    if field == '*':
-        value_field_dict = getFieldDict(el.className, 'valueFinfo')
-        max_type_len = max(len(dtype) for dtype in value_field_dict.values())
-        max_field_len = max(len(dtype) for dtype in value_field_dict.keys())
-        print('\n[', el.path, ']')
-        for key, dtype in sorted(value_field_dict.items()):
-            if dtype == 'bad' or key == 'this' or key == 'dummy' or key == 'me' or dtype.startswith(
-                    'vector') or 'ObjId' in dtype:
-                continue
-            value = el.getField(key)
-            if showtype:
-                typestr = dtype.ljust(max_type_len + 4)
-                # The following hack is for handling both Python 2 and
-                # 3. Directly putting the print command in the if/else
-                # clause causes syntax error in both systems.
-                print(typestr, end=' ')
-            print(key.ljust(max_field_len + 4), '=', value)
-    else:
-        try:
-            print(field, '=', el.getField(field))
-        except AttributeError:
-            pass  # Genesis silently ignores non existent fields
-
-
-def showfields(el, showtype=False):
-    """Convenience function. Should be deprecated if nobody uses it.
-
-    """
-    warnings.warn(
-        'Deprecated. Use showfield(element, field="*", showtype=True) instead.',
-        DeprecationWarning)
-    showfield(el, field='*', showtype=showtype)
-
-# Predefined field types and their human readable names
-finfotypes = [('valueFinfo', 'value field'),
-              ('srcFinfo', 'source message field'),
-              ('destFinfo', 'destination message field'),
-              ('sharedFinfo', 'shared message field'),
-              ('lookupFinfo', 'lookup field')]
-
-
-def listmsg(el):
-    """Return a list containing the incoming and outgoing messages of
-    `el`.
-
-    Parameters
-    ----------
-    el : melement/vec/str
-        MOOSE object or path of the object to look into.
-
-    Returns
-    -------
-    msg : list
-        List of Msg objects corresponding to incoming and outgoing
-        connections of `el`.
-
-    """
-    obj = element(el)
-    ret = []
-    for msg in obj.inMsg:
-        ret.append(msg)
-    for msg in obj.outMsg:
-        ret.append(msg)
-    return ret
-
-
-def showmsg(el):
-    """Print the incoming and outgoing messages of `el`.
-
-    Parameters
-    ----------
-    el : melement/vec/str
-        Object whose messages are to be displayed.
-
-    Returns
-    -------
-    None
-
-    """
-    obj = element(el)
-    print('INCOMING:')
-    for msg in obj.msgIn:
-        print(
-            msg.e2.path,
-            msg.destFieldsOnE2,
-            '<---',
-            msg.e1.path,
-            msg.srcFieldsOnE1)
-    print('OUTGOING:')
-    for msg in obj.msgOut:
-        print(
-            msg.e1.path,
-            msg.srcFieldsOnE1,
-            '--->',
-            msg.e2.path,
-            msg.destFieldsOnE2)
-
-def getfielddoc_(tokens, infoType=''):
-    indent=''
-    classname = tokens[0]
-    # print( classname )
-    while True:
-        try:
-            classelement = _moose.element('/classes/' + classname)
-            # print( classelement )
-            x = ''
-            for finfo in classelement.children:
-                # print (str(finfo)[33:-1])
-                # trial = 'path=/classes[0]/' + classname + '[0]/' + infoType
-                # print (trial)
-                # print (str(finfo)[33:-1] == trial)
-                for fieldelement in finfo:
-                    fieldname = fieldelement.fieldName
-                    if (str(fieldname).startswith('get')) or (str(fieldname).startswith('set')):
-                        continue
-                    baseinfo = ''
-                    finfotype = fieldelement.name
-                    if(infoType == 'destFinfo'):
-                        say = 'Destination Message Field'
-                    elif(infoType == 'valueFinfo'):
-                        say = 'Value Field'
-                    elif(infoType == 'srcFinfo'):
-                        say = 'Source Message Field'
-                    elif(infoType == 'lookupFinfo'):
-                        say = 'Lookup Field'
-                    elif(infoType == 'sharedFinfo'):
-                        say = 'Shared Message Field'
-
-                    # finfotype={finfotype}{baseinfo}
-                    if (str(finfotype) == infoType):
-                        x = x + '{indent}{classname}.{fieldname}:   type= {type}   finfotype= {say}{baseinfo}\n\t{docs}\n\n'.format(indent=indent, classname=tokens[0], fieldname = fieldname, type=fieldelement.type, say=say, baseinfo=baseinfo, docs=fieldelement.docs)
-
-            return x
-            # classname = classelement.baseClass
-        except ValueError:
-            raise NameError('`%s` has no field called `%s`'% (tokens[0], tokens[1]))
-
-def getfielddoc(tokens, indent=''):
-    """Return the documentation for field specified by `tokens`.
-
-    Parameters
-    ----------
-    tokens : (className, fieldName) str
-        A sequence whose first element is a MOOSE class name and second
-        is the field name.
-
-    indent : str
-        indentation (default: empty string) prepended to builtin
-        documentation string.
-
-    Returns
-    -------
-    docstring : str
-        string of the form
-        `{indent}{className}.{fieldName}: {datatype} - {finfoType}\n{Description}\n`
-
-    Raises
-    ------
-    NameError
-        If the specified fieldName is not present in the specified class.
-    """
-    assert(len(tokens) > 1)
-    classname = tokens[0]
-    fieldname = tokens[1]
-    while True:
-        try:
-            classelement = _moose.element('/classes/' + classname)
-            for finfo in classelement.children:
-                x = ''
-                for fieldelement in finfo:
-                    baseinfo = ''
-                    if classname != tokens[0]:
-                        baseinfo = ' (inherited from {})'.format(classname)
-                    if fieldelement.fieldName == fieldname:
-                        # The field elements are
-                        # /classes/{ParentClass}[0]/{fieldElementType}[N].
-                        finfotype = fieldelement.name
-                        x = x + '{indent}{classname}.{fieldname}: type={type}, finfotype={finfotype}{baseinfo}\n\t{docs}\n'.format(indent=indent, classname=tokens[0], fieldname=fieldname, type=fieldelement.type, finfotype=finfotype, baseinfo=baseinfo, docs=fieldelement.docs)
-                        return x
-            classname = classelement.baseClass
-        except ValueError:
-            raise NameError('`%s` has no field called `%s`'% (tokens[0], tokens[1]))
-
-def toUnicode(v, encoding='utf8'):
-    # if isinstance(v, str):
-        # return v
-    try:
-        return v.decode(encoding)
-    except (AttributeError, UnicodeEncodeError):
-        return str(v)
-
-
-def getmoosedoc(tokens, inherited=False):
-    """Return MOOSE builtin documentation.
-
-    Parameters
-    ----------
-    tokens : (className, [fieldName])
-        tuple containing one or two strings specifying class name
-        and field name (optional) to get documentation for.
-
-    inherited: bool (default: False)
-        include inherited fields.
-
-    Returns
-    -------
-    docstring : str
-        Documentation string for class `className`.`fieldName` if both
-        are specified, for the class `className` if fieldName is not
-        specified. In the latter case, the fields and their data types
-        and finfo types are listed.
-
-    Raises
-    ------
-    NameError
-        If class or field does not exist.
-
-    """
-    indent = '    '
-    with closing(StringIO()) as docstring:
-        if not tokens:
-            return ""
-        try:
-            class_element = _moose.element('/classes/%s' % (tokens[0]))
-        except ValueError:
-            raise NameError('name \'%s\' not defined.' % (tokens[0]))
-        if len(tokens) > 1:
-            docstring.write(toUnicode(getfielddoc(tokens)))
-        else:
-            doc_text = class_element.docs
-            textArray = textwrap.wrap(doc_text, width = 70, replace_whitespace = False, drop_whitespace = False)
-            text = "\n".join(textArray)
-            # print(text)
-            docstring.write(toUnicode('%s\n' % (text)))
-
-            info = '\t Functions and message destinations \n\t------------------------------------\n\t All \'destFinfo\' can be used as destination Field for moose.connect function.\n'
-            docstring.write(toUnicode('%s\n') % (info))
-            docstring.write(toUnicode(getfielddoc_(tokens, 'destFinfo')))
-            # append_finfodocs(tokens[0], docstring, indent)
-            if inherited:
-                mro = eval('_moose.%s' % (tokens[0])).mro()
-                for class_ in mro[1:]:
-                    if class_ == _moose.melement:
-                        break
-                    docstring.write(toUnicode('\n#Inherited from %s#\n' % (class_.__name__)))
-                    temp = []
-                    temp.append(str(class_.__name__))
-                    docstring.write(toUnicode(getfielddoc_(temp, 'destFinfo')))
-                    # append_finfodocs(class_.__name__, docstring, indent)
-                    if class_ == _moose.Neutral:    # Neutral is the toplevel moose class
-                        break
-
-            info = '\t Class attributes \n\t -------------------- \n\t All \'valueFinfo\' are attributes of the class, and can be read and written using \n\t standard get and set Functions (unless explicitely mentioned otherwise). \n\t for example, getVm() and setVm() for access to Vm.\n\t All \'sharedFinfo\'...'
-            docstring.write(toUnicode('%s\n') % (info))
-            docstring.write(toUnicode(getfielddoc_(tokens, 'valueFinfo')))
-            # append_finfodocs(tokens[0], docstring, indent)
-            if inherited:
-                mro = eval('_moose.%s' % (tokens[0])).mro()
-                for class_ in mro[1:]:
-                    if class_ == _moose.melement:
-                        break
-                    docstring.write(toUnicode('\n#Inherited from %s#\n' % (class_.__name__)))
-                    temp = []
-                    temp.append(str(class_.__name__))
-                    docstring.write(toUnicode(getfielddoc_(temp, 'valueFinfo')))
-                    # append_finfodocs(class_.__name__, docstring, indent)
-                    if class_ == _moose.Neutral:    # Neutral is the toplevel moose class
-                        break
-
-            info = '\t Source Messages \n\t ----------------------- \n\t All \'srcFinfo\' can be used as sourceField for moose.connect function.'
-            docstring.write(toUnicode('%s\n') % (info))
-            docstring.write(toUnicode(getfielddoc_(tokens, 'srcFinfo')))
-            # append_finfodocs(tokens[0], docstring, indent)
-            if inherited:
-                mro = eval('_moose.%s' % (tokens[0])).mro()
-                for class_ in mro[1:]:
-                    if class_ == _moose.melement:
-                        break
-                    docstring.write(toUnicode('\n#Inherited from %s#\n' % (class_.__name__)))
-                    temp = []
-                    temp.append(str(class_.__name__))
-                    docstring.write(toUnicode(getfielddoc_(temp, 'srcFinfo')))
-                    # append_finfodocs(class_.__name__, docstring, indent)
-                    if class_ == _moose.Neutral:    # Neutral is the toplevel moose class
-                        break
-
-            info = '\t LookUp Fields \n\t ---------------- \n\t All \'lookupFinfo\' are ..................................\n'
-            docstring.write(toUnicode('%s\n') % (info))
-            docstring.write(toUnicode(getfielddoc_(tokens, 'lookupFinfo')))
-            # append_finfodocs(tokens[0], docstring, indent)
-            if inherited:
-                mro = eval('_moose.%s' % (tokens[0])).mro()
-                for class_ in mro[1:]:
-                    if class_ == _moose.melement:
-                        break
-                    docstring.write(toUnicode('\n#Inherited from %s#\n' % (class_.__name__)))
-                    temp = []
-                    temp.append(str(class_.__name__))
-                    docstring.write(toUnicode(getfielddoc_(temp, 'lookupFinfo')))
-                    # append_finfodocs(class_.__name__, docstring, indent)
-                    if class_ == _moose.Neutral:    # Neutral is the toplevel moose class
-                        break
-
-            info = '\t shared fields \n\t ---------------- \n\t All \'sharedFinfo\' are ..................................\n'
-            docstring.write(toUnicode('%s\n') % (info))
-            docstring.write(toUnicode(getfielddoc_(tokens, 'sharedFinfo')))
-            # append_finfodocs(tokens[0], docstring, indent)
-            if inherited:
-                mro = eval('_moose.%s' % (tokens[0])).mro()
-                for class_ in mro[1:]:
-                    if class_ == _moose.melement:
-                        break
-                    docstring.write(toUnicode('\n#Inherited from %s#\n' % (class_.__name__)))
-                    temp = []
-                    temp.append(str(class_.__name__))
-                    docstring.write(toUnicode(getfielddoc_(temp, 'sharedFinfo')))
-                    # append_finfodocs(class_.__name__, docstring, indent)
-                    if class_ == _moose.Neutral:    # Neutral is the toplevel moose class
-                        break
-
-        return docstring.getvalue()
-
-def append_finfodocs(classname, docstring, indent):
-    """Append list of finfos in class name to docstring"""
-    try:
-        class_element = _moose.element('/classes/%s' % (classname))
-    except ValueError:
-        raise NameError('class \'%s\' not defined.' % (classname))
-    for ftype, rname in finfotypes:
-        docstring.write(toUnicode('\n*%s*\n' % (rname.capitalize())))
-        try:
-            finfo = _moose.element('%s/%s' % (class_element.path, ftype))
-            for field in finfo.vec:
-                docstring.write(toUnicode(
-                    '%s%s: %s\n' % (indent, field.fieldName, field.type)))
-        except ValueError:
-            docstring.write(toUnicode('%sNone\n' % (indent)))
-
-# the global pager is set from pydoc even if the user asks for paged
-# help once. this is to strike a balance between GENESIS user's
-# expectation of control returning to command line after printing the
-# help and python user's expectation of seeing the help via more/less.
-pager = None
-
-
-def doc(arg, inherited=True, paged=True):
-    """Display the documentation for class or field in a class.
-
-    Parameters
-    ----------
-    arg : str/class/melement/vec
-        A string specifying a moose class name and a field name
-        separated by a dot. e.g., 'Neutral.name'. Prepending `moose.`
-        is allowed. Thus moose.doc('moose.Neutral.name') is equivalent
-        to the above.
-        It can also be string specifying just a moose class name or a
-        moose class or a moose object (instance of melement or vec
-        or there subclasses). In that case, the builtin documentation
-        for the corresponding moose class is displayed.
-
-    paged: bool
-        Whether to display the docs via builtin pager or print and
-        exit. If not specified, it defaults to False and
-        moose.doc(xyz) will print help on xyz and return control to
-        command line.
+"""
+from .moose import *
 
-    Returns
-    -------
-    None
+# Wrapper to get moose version information.
+__version__ = moose._moose.__version__
 
-    Raises
-    ------
-    NameError
-        If class or field does not exist.
+VERSION = moose._moose.VERSION
 
-    """
-    # There is no way to dynamically access the MOOSE docs using
-    # pydoc. (using properties requires copying all the docs strings
-    # from MOOSE increasing the loading time by ~3x). Hence we provide a
-    # separate function.
-    global pager
-    if paged and pager is None:
-        pager = pydoc.pager
-    tokens = []
-    text = ''
-    if isinstance(arg, str):
-        tokens = arg.split('.')
-        if tokens[0] == 'moose':
-            tokens = tokens[1:]
-    elif isinstance(arg, type):
-        tokens = [arg.__name__]
-    elif isinstance(arg, melement) or isinstance(arg, vec):
-        text = '%s: %s\n\n' % (arg.path, arg.className)
-        tokens = [arg.className]
-    if tokens:
-        text += getmoosedoc(tokens, inherited=inherited)
-    else:
-        text += pydoc.getdoc(arg)
-    if pager:
-        pager(text)
-    else:
-        print(text, width=80)
+# NOTE: No module should be imported here. Use moose.py to write imports.
diff --git a/python/moose/genesis/writeKkit.py b/python/moose/genesis/writeKkit.py
index 1e5496010c34da8beea25b19f3d3aaeb09bc59d8..11b14c951280e4ddf4e700ae14b07f961bca34fd 100644
--- a/python/moose/genesis/writeKkit.py
+++ b/python/moose/genesis/writeKkit.py
@@ -8,21 +8,15 @@ __version__          = "1.0.0"
 __maintainer__       = "Harsha Rani"
 __email__            = "hrani@ncbs.res.in"
 __status__           = "Development"
-__updated__          = "Feb 13 2017"
+
 import sys
 import random
 import re
+import matplotlib
 import moose
 from moose.chemUtil.chemConnectUtil import *
 from moose.chemUtil.graphUtils import *
 
-foundmatplotlib_ = False
-try:
-    import matplotlib
-    foundmatplotlib_ = True
-except Exception as e:
-    pass
-
 GENESIS_COLOR_SEQUENCE = ((248, 0, 255), (240, 0, 255), (232, 0, 255), (224, 0, 255), (216, 0, 255), (208, 0, 255),
  (200, 0, 255), (192, 0, 255), (184, 0, 255), (176, 0, 255), (168, 0, 255), (160, 0, 255), (152, 0, 255), (144, 0, 255),
  (136, 0, 255), (128, 0, 255), (120, 0, 255), (112, 0, 255), (104, 0, 255), (96, 0, 255), (88, 0, 255), (80, 0, 255),
@@ -44,12 +38,8 @@ GENESIS_COLOR_SEQUENCE = ((248, 0, 255), (240, 0, 255), (232, 0, 255), (224, 0,
 #               --StimulusTable
 
 def mooseWriteKkit( modelpath, filename, sceneitems={}):
-    global foundmatplotlib_ 
-    if not foundmatplotlib_:
-        print('No maplotlib found.' 
-            '\nThis module can be installed by following command in terminal:'
-            '\n\t sudo apt install python-maplotlib', "")
-        return False
+    if filename.rfind('.') != -1:
+        filename = filename[:filename.rfind('.')]
     else:
         error = " "
         ignoreColor= ["mistyrose","antiquewhite","aliceblue","azure","bisque","black","blanchedalmond","blue","cornsilk","darkolivegreen","darkslategray","dimgray","floralwhite","gainsboro","ghostwhite","honeydew","ivory","lavender","lavenderblush","lemonchiffon","lightcyan","lightgoldenrodyellow","lightgray","lightyellow","linen","mediumblue","mintcream","navy","oldlace","papayawhip","saddlebrown","seashell","snow","wheat","white","whitesmoke","aquamarine","lightsalmon","moccasin","limegreen","snow","sienna","beige","dimgrey","lightsage"]
@@ -535,6 +525,11 @@ def getColorCheck(color,GENESIS_COLOR_SEQUENCE):
     else:
         raise Exception("Invalid Color Value!")
 
+ignoreColor= ["mistyrose","antiquewhite","aliceblue","azure","bisque","black","blanchedalmond","blue","cornsilk","darkolivegreen","darkslategray","dimgray","floralwhite","gainsboro","ghostwhite","honeydew","ivory","lavender","lavenderblush","lemonchiffon","lightcyan","lightgoldenrodyellow","lightgray","lightyellow","linen","mediumblue","mintcream","navy","oldlace","papayawhip","saddlebrown","seashell","snow","wheat","white","whitesmoke","aquamarine","lightsalmon","moccasin","limegreen","snow","sienna","beige","dimgrey","lightsage"]
+matplotcolor = {}
+for name,hexno in matplotlib.colors.cnames.items():
+    matplotcolor[name]=hexno
+
 def getRandColor():
     k = random.choice(list(matplotcolor.keys()))
     if k in ignoreColor:
@@ -663,19 +658,13 @@ def writeFooter2(f):
 
 if __name__ == "__main__":
     import sys
-    import os
-    filename = sys.argv[1]
-    filepath, filenameWithext = os.path.split(filename)
-    if filenameWithext.find('.') != -1:
-        modelpath = filenameWithext[:filenameWithext.find('.')]
-    else:
-        modelpath = filenameWithext
 
+    filename = sys.argv[1]
+    modelpath = filename[0:filename.find('.')]
     moose.loadModel(filename,'/'+modelpath,"gsl")
     output = modelpath+"_.g"
-    written = mooseWriteKkit('/'+modelpath,output)
-    
+    written = write('/'+modelpath,output)
     if written:
             print((" file written to ",output))
     else:
-            print(" could be written to kkit format")
\ No newline at end of file
+            print(" could be written to kkit format")
diff --git a/python/moose/merge/merge.py b/python/moose/merge/merge.py
index a8507808f29489d294e2966b7dcc24fb9fa86833..224431d431935a0592064b731ecdc685aa648dff 100644
--- a/python/moose/merge/merge.py
+++ b/python/moose/merge/merge.py
@@ -11,31 +11,15 @@
 #**           copyright (C) 2003-2017 Upinder S. Bhalla. and NCBS
 #Created : Friday Dec 16 23:19:00 2016(+0530)
 #Version 
-#Last-Updated: Tuesday Feb 28 15:05:33 2017(+0530)
+#Last-Updated: Thursday Jan 12 17:30:33 2017(+0530)
 #         By: Harsha
 #**********************************************************************/
 
-# This program is used to merge models from src to destination 
-#Rules are :
-#   -- If Compartment from the src model doesn't exist in destination model, 
-#       then entire compartment and its children are copied over including groups
-#   -- Models are mergered at group level (if exists) 
-#       (Group is Neutral object in moose, which may represent pathway in network model)
-#   -- Pool's are copied from source to destination if it doesn't exist, if exist nothing is done
-#   -- Reaction (Reac), Enzyme (Enz) are copied 
-#       --- if any danglling Reac or Enz exist then that is not copied
-#    
-#       --- if Reac Name's is different for a given path (group level) 
-#            then copy the entire Reac along with substrate/product
-#       --- if same Reac Name and same sub and prd then nothing is copied
-#       --- if same Reac Name but sub or prd is different then duplicated and copied
-#
-#       --- if Enz Name's is different for a given parent pool path 
-#            then copy the entire Enz along with substrate/product
-#       --- if same Enz Name and same sub and prd then nothing is copied
-#       --- if same Enz Name but sub or prd is different then duplicated and copied       
-#   -- Function are copied only if destination pool to which its suppose to connect doesn't exist with function of its own
-#      
+# This program is used to merge models
+# -- Model B is merged to modelA
+#Rules are
+#--In this models are mergered at group level (if exists)
+
 
 
 import sys
@@ -48,8 +32,7 @@ from moose.chemUtil.chemConnectUtil import *
 from moose.chemUtil.graphUtils import *
 from moose.genesis import mooseWriteKkit
 
-def mergeChemModel(src,des):
-
+def mergeChemModel(A,B):
     """ Merges two model or the path """
     A = src
     B = des
@@ -82,29 +65,39 @@ def mergeChemModel(src,des):
         deleteSolver(modelA) 
         deleteSolver(modelB)
 
-        global poolListina
+    modelA,loadedA = loadModels(A)
+    modelB,loadedB = loadModels(B)
+    if not loadedA or not loadedB:
+        if not loadedA:
+            modelB = moose.Shell('/')
+        if not loadedB:
+            modelA = moose.Shell('/')    
+    else:
+        directory, bfname = os.path.split(B)
+        global grpNotcopiedyet,poolListina
         poolListina = {}
         grpNotcopiedyet = []
         dictComptA = dict( [ (i.name,i) for i in moose.wildcardFind(modelA+'/##[ISA=ChemCompt]') ] )
         dictComptB = dict( [ (i.name,i) for i in moose.wildcardFind(modelB+'/##[ISA=ChemCompt]') ] )
+
         poolNotcopiedyet = []
 
-        for key in list(dictComptA.keys()):
-            if key not in dictComptB:
+        for key in list(dictComptB.keys()):
+            if key not in dictComptA:
                 # if compartmentname from modelB does not exist in modelA, then copy
-                copy = moose.copy(dictComptA[key],moose.element(modelB))
+                copy = moose.copy(dictComptB[key],moose.element(modelA))
             else:       
                 #if compartmentname from modelB exist in modelA,
                 #volume is not same, then change volume of ModelB same as ModelA
-                if abs(dictComptB[key].volume - dictComptA[key].volume):
+                if abs(dictComptA[key].volume - dictComptB[key].volume):
                     #hack for now
-                    while (abs(dictComptB[key].volume - dictComptA[key].volume) != 0.0):
-                        dictComptA[key].volume = float(dictComptB[key].volume)
-                dictComptB = dict( [ (i.name,i) for i in moose.wildcardFind(modelB+'/##[ISA=ChemCompt]') ] )
+                    while (abs(dictComptA[key].volume - dictComptB[key].volume) != 0.0):
+                        dictComptB[key].volume = float(dictComptA[key].volume)
+                dictComptA = dict( [ (i.name,i) for i in moose.wildcardFind(modelA+'/##[ISA=ChemCompt]') ] )
 
                 #Mergering pool
-                poolMerge(dictComptB[key],dictComptA[key],poolNotcopiedyet)
-        
+                poolMerge(dictComptA[key],dictComptB[key],poolNotcopiedyet)
+
         if grpNotcopiedyet:
             # objA = moose.element(comptA).parent.name
             # if not moose.exists(objA+'/'+comptB.name+'/'+bpath.name):
@@ -112,14 +105,15 @@ def mergeChemModel(src,des):
             #   moose.copy(bpath,moose.element(objA+'/'+comptB.name))
             pass
 
-        comptBdict =  comptList(modelB)
-        poolListinb = {}
-        poolListinb = updatePoolList(comptBdict)
+        comptAdict =  comptList(modelA)
+        poolListina = {}
+        poolListina = updatePoolList(comptAdict)
+        funcNotallowed = []
         R_Duplicated, R_Notcopiedyet,R_Daggling = [], [], []
         E_Duplicated, E_Notcopiedyet,E_Daggling = [], [], []
-        for key in list(dictComptA.keys()):
-            funcExist, funcNotallowed = [], []
-            funcExist,funcNotallowed = functionMerge(dictComptB,dictComptA,key)
+        for key in list(dictComptB.keys()):
+            funcNotallowed = []
+            funcNotallowed = functionMerge(dictComptA,dictComptB,key)
             
             poolListinb = updatePoolList(dictComptB)
             R_Duplicated,R_Notcopiedyet,R_Daggling = reacMerge(dictComptB,dictComptA,key,poolListinb)
@@ -135,14 +129,15 @@ def mergeChemModel(src,des):
             for fl in list(funcExist):
                 print("\t [Pool]:  %s [Function]:  %s \n" %(str(fl.parent.name), str(fl.path)))
         if funcNotallowed:
-            print( "\nThese functions is not to copied, since pool connected to function input are from different compartment:")
+            print( "\nPool already connected to a function, this function is not to connect to same pool, since no two function are allowed to connect to same pool:")
             for fl in list(funcNotallowed):
                 print("\t [Pool]:  %s [Function]:  %s \n" %(str(fl.parent.name), str(fl.path)))
+
         if R_Duplicated or E_Duplicated:
-            print ("These Reaction / Enzyme are \"Duplicated\" into destination file \"%s\", due to "
-                    "\n 1. If substrate / product name's are different for a give reaction/Enzyme name "
-                    "\n 2. If product belongs to different compartment "
-                    "\n Models have to decide to keep or delete these reaction/enzyme in %s" %(dfile, dfile))
+            print ("Reaction / Enzyme are Duplicate"
+                    "\n 1. The once whoes substrate / product names are different for a give reaction name "
+                    "\n 2. its compartment to which it belongs to may be is different"
+                    "\n Models have to decide to keep or delete these reaction/enzyme")
             if E_Duplicated:
                 print("Reaction: ")
             for rd in list(R_Duplicated):
@@ -166,7 +161,7 @@ def mergeChemModel(src,des):
                     print ("%s " %str(ed.name))
                 
         if R_Daggling or E_Daggling:
-            print ("\n Daggling reaction/enzyme are not allowed in moose, these are not merged to %s from %s" %(dfile, sfile))
+            print ("\n Daggling reaction/enzyme are not not allowed in moose, these are not merged")
             if R_Daggling:
                 print("Reaction: ")
                 for rd in list(R_Daggling):
@@ -203,48 +198,60 @@ def mergeChemModel(src,des):
             print ('  If you are in python terminal you could save \n   >moose.mooseWriteKkit(\'%s\',\'filename.g\')' %(modelB))
         
 def functionMerge(comptA,comptB,key):
-    funcNotallowed, funcExist = [], []
+    funcNotallowed = []
     comptApath = moose.element(comptA[key]).path
     comptBpath = moose.element(comptB[key]).path
+    funcListina = moose.wildcardFind(comptApath+'/##[ISA=PoolBase]') 
+    funcListinb = moose.wildcardFind(comptBpath+'/##[ISA=Function]')
     objA = moose.element(comptApath).parent.name
     objB = moose.element(comptBpath).parent.name
-    
-    #This will give us all the function which exist in modelB
-    funcListinb = moose.wildcardFind(comptBpath+'/##[ISA=Function]')
+    #For function mergering pool name is taken as reference
+    funcNotcopiedyet = []
     for fb in funcListinb:
-        #This will give us all the pools that its connected to, for this function
-        fvalueOut = moose.element(fb).neighbors['valueOut']
-        for poolinB in fvalueOut:
-            poolinBpath = poolinB.path
-            poolinA = poolinBpath.replace(objB,objA)
-            connectionexist = []
-            if moose.exists(poolinA):
-                #This is give us if pool which is to be connected already exist any connection
-                connectionexist = moose.element(poolinA).neighbors['setN']+moose.element(poolinA).neighbors['setConc']+ moose.element(poolinA).neighbors['increment']
-                if len(connectionexist) == 0:
-                    #This pool in model A doesnot exist with any function
-                    inputs = moose.element(fb.path+'/x').neighbors['input']
-                    volumes = []
-                    for ins in inputs:
-                        volumes.append((findCompartment(moose.element(ins))).volume)
-                    if len(set(volumes)) == 1:
-                        # If all the input connected belongs to one compartment then copy
-                        createFunction(fb,poolinA,objB,objA)
-                    else:
-                        # moose doesn't allow function's input to come from different compartment
-                        funcNotallowed.append(fb)
-                else:
-                    #Pool in model 'A' already exist function "
-                    funcExist.append(fb)
-            else:
-                print(" Path in model A doesn't exists %s" %(poolinA))
-        
-    return funcExist,funcNotallowed
 
-def createFunction(fb,setpool,objB,objA):
+        if fb.parent.className in ['ZombiePool','Pool','ZombieBufPool','BufPool']:
+            objA = moose.element(comptApath).parent.name
+            fbpath = fb.path
+            #funcpath = fbpath[fbpath.find(findCompartment(fb).name)-1:len(fbpath)]
+            funcparentB = fb.parent.path
+            funcpath = fbpath.replace(objB,objA)
+            funcparentA = funcparentB.replace(objB,objA)
+            tt = moose.element(funcparentA).neighbors['setN']
+            if tt:
+                funcNotallowed.append(fb)
+            else:
+                if len(moose.element(fb.path+'/x').neighbors["input"]):
+                    #inputB = moose.element(fb.path+'/x').neighbors["input"]
+                    inputB = subprdList(moose.element(fb.path+'/x'),"input")
+                    inputB_expr = fb.expr
+                    if moose.exists(funcpath):
+                        #inputA = moose.element(objA+funcpath+'/x').neighbors["input"]
+                        inputA = subprdList(moose.element(funcpath+'/x'),"input")
+                        inputA_expr = moose.element(funcpath).expr
+                        hassameExpr = False
+                        if inputA_expr == inputB_expr:
+                            hassameExpr = True
+                        hassameLen,hassameS,hassameVols = same_len_name_vol(inputA,inputB)
+                        if not all((hassameLen,hassameS,hassameVols,hassameExpr)):
+                            fb.name = fb.name+'_duplicatedF'
+                            createFunction(fb,inputB,objB,objA)
+                    else:
+                        #function doesnot exist then copy
+                        if len(inputB):
+                            volinput = []
+                            for inb in inputB:
+                                volinput.append(findCompartment(moose.element(inb)).volume)
+                                if len(set(volinput)) == 1:
+                                    # If all the input connected belongs to one compartment then copy
+                                    createFunction(fb,inputB,objB,objA)
+                                else:
+                                    # moose doesn't allow function input to come from different compartment
+                                    funcNotallowed.append(fb)
+    return funcNotallowed
+
+def createFunction(fb,inputB,objB,objA):
     fapath1 = fb.path.replace(objB,objA)
     fapath = fapath1.replace('[0]','')
-
     if not moose.exists(fapath):
         # if fb.parent.className in ['CubeMesh','CyclMesh']:
         #   des = moose.Function('/'+objA+'/'+fb.parent.name+'/'+fb.name)
@@ -253,13 +260,7 @@ def createFunction(fb,setpool,objB,objA):
         #       if fb.parent.name == akey.name:
         #           des = moose.Function(akey.path+'/'+fb.name)
         des = moose.Function(fapath)
-    else:
-        des = moose.element(fapath)
-    inputB = moose.element(fb.path+'/x').neighbors["input"]
-    moose.connect(des, 'valueOut', moose.element(setpool),'setN' )
-    inputA = []
-    inputA = moose.element(fapath+'/x').neighbors["input"]
-    if not inputA:
+        moose.connect(des, 'valueOut', moose.element(fapath).parent,'setN' )
         for src in inputB:
             pool = ((src.path).replace(objB,objA)).replace('[0]','')
             numVariables = des.numVars
@@ -270,30 +271,29 @@ def createFunction(fb,setpool,objB,objA):
             des.expr = expr
             moose.connect( pool, 'nOut', des.x[numVariables], 'input' )
 
+        #if fb.expr != des.expr:
+        #    print "Function ",des, " which is duplicated from modelB, expression is different, this is tricky in moose to know what those constants are connected to "
+        #    print "ModelB ", fb, fb.expr, "\nModelA ",des, des.expr
+
 def comptList(modelpath):
     comptdict = {}
     for ca in moose.wildcardFind(modelpath+'/##[ISA=ChemCompt]'):
         comptdict[ca.name] = ca
     return comptdict
 
-def loadModels(filepath):
+def loadModels(filename):
     """ load models into moose if file, if moosepath itself it passes back the path and 
     delete solver if exist """
 
     modelpath = '/'
     loaded = False
 
-    if os.path.isfile(filepath) :
-        fpath, filename = os.path.split(filepath)
-        # print " head and tail ",head,  " ",tail
-        # modelpath = filename[filename.rfind('/'): filename.rfind('.')]
-        # print "modelpath ",modelpath
-        # ext = os.path.splitext(filename)[1]
-        # filename = filename.strip()
-        modelpath = '/'+filename[:filename.rfind('.')]
-        modeltype = mtypes.getType(filepath)
-        subtype = mtypes.getSubtype(filepath, modeltype)
-
+    if os.path.isfile(filename) :
+        modelpath = filename[filename.rfind('/'): filename.rfind('.')]
+        ext = os.path.splitext(filename)[1]
+        filename = filename.strip()
+        modeltype = mtypes.getType(filename)
+        subtype = mtypes.getSubtype(filename, modeltype)
         if subtype == 'kkit' or modeltype == "cspace":
             if moose.exists(modelpath):
                 moose.delete(modelpath)
@@ -301,16 +301,18 @@ def loadModels(filepath):
             loaded = True    
     
         elif subtype == 'sbml':
-            #moose.mooseReadSBML(filename,modelpath)
-            #loaded = True
+            #moose.ReadSBML()
             pass
         else:
             print("This file is not supported for mergering")
             modelpath = moose.Shell('/')
-
-    elif moose.exists(filepath):
-        modelpath = filepath
+    elif moose.exists(filename):
+        modelpath = filename
         loaded = True
+    ## default is 'ee' solver while loading the model using moose.loadModel,
+    ## yet deleteSolver is called just to be assured 
+    if loaded:
+        deleteSolver(modelpath) 
 
     return modelpath,loaded
 
@@ -362,15 +364,15 @@ def copy_deleteUnlyingPoolObj(pool,path):
     # which will automatically copie's the pool
     copied = False
 
-    if pool.parent.className not in ["Enz","ZombieEnz","MMenz","ZombieMMenz"]:
+    if pool.parent.className not in ["Enz","ZombieEnz"]:
         poolcopied = moose.copy(pool,path)
         copied = True
         # deleting function and enzyme which gets copied if exist under pool
         # This is done to ensure daggling function / enzyme not copied.
         funclist = []
         for types in ['setConc','setN','increment']:
-            funclist.extend(moose.element(poolcopied).neighbors[types])
 
+            funclist.extend(moose.element(poolcopied).neighbors[types])
         for fl in funclist:
             moose.delete(fl)
         enzlist = moose.element(poolcopied).neighbors['reac']
@@ -426,15 +428,20 @@ def enzymeMerge(comptA,comptB,key,poolListina):
                             allclean = True
                         else:
                             # didn't find sub or prd for this Enzyme
+                            #print ("didn't find sub or prd for this reaction" )
                             RE_Notcopiedyet.append(eb)
                     else:
                         #   -- it is dagging reaction
                         RE_Daggling.append(eb)
+                        #print ("This reaction \""+eb.path+"\" has no substrate/product daggling reaction are not copied")
+                        #war_msg = war_msg+"\nThis reaction \""+eb.path+"\" has no substrate/product daggling reaction are not copied"
                 else:
                     #Same Enzyme name 
                     #   -- Same substrate and product including same volume then don't copy
                     #   -- different substrate/product or if sub/prd's volume is different then DUPLICATE the Enzyme
                     allclean = False
+                    #ea = moose.element('/'+obj+'/'+enzcompartment.name+'/'+enzparent.name+'/'+eb.name)
+                    #ea = moose.element(pA.path+'/'+eb.name)
                     ea = moose.element(eb.path.replace(objB,objA))
                     eAsubname = subprdList(ea,"sub")
                     eBsubname = subprdList(eb,"sub")
@@ -464,6 +471,7 @@ def enzymeMerge(comptA,comptB,key,poolListina):
                                     moose.connect(moose.element(enz).parent,"nOut",moose.element(enz),"enzDest")
                                     #moose.connect(moose.element(enz),"enz",moose.element(enz).parent,"reac")
 
+                                #moose.connect( cplxItem, 'reac', enz, 'cplx' )
                                 connectObj(enz,eBsubname,"sub",comptA,war_msg)
                                 connectObj(enz,eBprdname,"prd",comptA,war_msg)
                                 RE_Duplicated.append(enz)
@@ -478,9 +486,12 @@ def enzymeMerge(comptA,comptB,key,poolListina):
                         #   --  it may be connected Enzyme cplx
                         if eBsubname and eBprdname:
                             RE_Notcopiedyet.append(eb)
+                            #print ("This Enzyme \""+eb.path+"\" has no substrate/product must be connect to cplx")
+                            #war_msg = war_msg+ "\nThis Enzyme \""+rb.path+"\" has no substrate/product must be connect to cplx"
                         else:
                             RE_Daggling.append(eb)
-
+                            #print ("This enzyme \""+eb.path+"\" has no substrate/product daggling reaction are not copied")
+                            #war_msg = war_msg+"\nThis reaction \""+eb.path+"\" has no substrate/product daggling reaction are not copied"
     return RE_Duplicated,RE_Notcopiedyet,RE_Daggling
 
 def reacMerge(comptA,comptB,key,poolListina):
@@ -564,12 +575,17 @@ def reacMerge(comptA,comptB,key,poolListina):
                         #   --  it may be connected Enzyme cplx
                         if rBsubname and rBprdname:
                             RE_Notcopiedyet.append(rb)
+                            #print ("This reaction \""+rb.path+"\" has no substrate/product must be connect to cplx")
+                            #war_msg = war_msg+ "\nThis reaction \""+rb.path+"\" has no substrate/product must be connect to cplx"
                         else:
                             RE_Daggling.append(rb)
+                            #print ("This reaction \""+rb.path+"\" has no substrate/product daggling reaction are not copied")
+                            #war_msg = war_msg+"\nThis reaction \""+rb.path+"\" has no substrate/product daggling reaction are not copied"      
             
     return RE_Duplicated,RE_Notcopiedyet,RE_Daggling
 
 def subprdList(reac,subprd):
+    #print  "Reac ",reac
     rtype = moose.element(reac).neighbors[subprd]
     rname = []
     for rs in rtype:
@@ -620,6 +636,8 @@ def connectObj(reac,spList,spType,comptA,war_msg):
                     allclean = True
                 else:
                     #It should not come here unless the sub/prd is connected to enzyme cplx pool
+                    #print ("This pool \""+rsp.name+"\" doesnot exists in this "+comptName+" compartment to connect to this reaction \""+reac.name+"\"")
+                    #war_msg = war_msg+ "This pool \""+rsp.name+"\" doesnot exists in this "+comptName+" compartment to connect to this reaction \""+reac.name+"\""
                     allclean = False
     return allclean
 
@@ -685,4 +703,4 @@ if __name__ == "__main__":
                         mergeto = mergeto+'merge'
                     
                     mergered = mergeChemModel(src,des,mergeto)
-                '''
\ No newline at end of file
+                '''
diff --git a/python/moose/moose.py b/python/moose/moose.py
new file mode 100644
index 0000000000000000000000000000000000000000..0957638de1ae7915966a5a6f877d831d021a519b
--- /dev/null
+++ b/python/moose/moose.py
@@ -0,0 +1,507 @@
+# moose.py ---
+# This is the primary moose module. It wraps _moose.so and adds some
+# utility functions.
+
+# Filename: moose.py
+# Author: Subhasis Ray
+# Maintainer: Dilawar Singh, Harsha Rani, Upi Bhalla
+
+from __future__ import print_function
+from contextlib import closing
+import warnings
+import platform
+import pydoc
+import os
+from io import StringIO
+from collections import defaultdict
+from . import _moose
+from ._moose import *
+import __main__ as main
+from .genesis import writeKkit
+from . import SBML
+sequence_types = ['vector<double>',
+                  'vector<int>',
+                  'vector<long>',
+                  'vector<unsigned int>',
+                  'vector<float>',
+                  'vector<unsigned long>',
+                  'vector<short>',
+                  'vector<Id>',
+                  'vector<ObjId>']
+
+known_types = ['void',
+               'char',
+               'short',
+               'int',
+               'unsigned int',
+               'double',
+               'float',
+               'long',
+               'unsigned long',
+               'string',
+               'vec',
+               'melement'] + sequence_types
+
+# SBML related functions.
+
+
+def mooseReadSBML(filepath, loadpath, solver='ee'):
+    """Load SBML model.
+
+    keyword arguments: \n
+
+    filepath -- filepath to be loaded \n
+    loadpath -- Root path for this model e.g. /model/mymodel \n
+    solver   -- Solver to use (default 'ee' ) \n
+
+    """
+    return SBML.readSBML.mooseReadSBML( filepath, loadpath, solver )
+
+
+def mooseWriteSBML(modelpath, filepath, sceneitems={}):
+    """Writes loaded model under modelpath to a file in SBML format.
+
+    keyword arguments:\n
+
+    modelpath -- model path in moose e.g /model/mymodel \n
+    filepath -- Path of output file. \n
+    sceneitems -- dictlist (UserWarning: user need not worry about this) \n
+                    layout position is saved in Annotation field of all the moose Object (pool,Reaction,enzyme)\n
+                    If this function is called from \n
+                        -- GUI, the layout position of moose object is passed \n
+                        -- command line, \n
+                            ---if genesis/kkit model is loaded then layout position is taken from the file \n
+                            --- else, auto-coordinates is used for layout position and passed
+
+    """
+    return SBML.writeSBML.mooseWriteSBML(modelpath, filepath, sceneitems)
+
+
+def mooseWriteKkit(modelpath, filepath,sceneitems={}):
+    """Writes  loded model under modelpath to a file in Kkit format.
+
+    keyword arguments:\n
+
+    modelpath -- model path in moose \n
+    filepath -- Path of output file.
+    """
+    return writeKkit.mooseWriteKkit(modelpath, filepath,sceneitems)
+
+
+def moosedeleteChemSolver(modelpath):
+    """ deletes solver on all the compartment and its children.
+        This is neccesary while created a new moose object on a pre-existing modelpath,\n
+        this should be followed by mooseaddChemSolver for add solvers on to compartment to simulate else
+        default is Exponential Euler (ee)
+    """
+    return chemUtil.add_Delete_ChemicalSolver.moosedeleteChemSolver(modelpath)
+
+
+def mooseaddChemSolver(modelpath, solver):
+    """ Add solver on chemical compartment and its children for calculation
+
+    keyword arguments:\n
+
+    modelpath -- model path that is loaded into moose \n
+    solver -- "Exponential Euler" (ee) (default), \n
+              "Gillespie"         ("gssa"), \n
+              "Runge Kutta"       ("gsl")
+
+    """
+    return chemUtil.add_Delete_ChemicalSolver.mooseaddChemSolver(modelpath, solver)
+
+################################################################
+# Wrappers for global functions
+################################################################
+
+
+def pwe():
+    """Print present working element. Convenience function for GENESIS
+    users. If you want to retrieve the element in stead of printing
+    the path, use moose.getCwe()
+
+    """
+    pwe_ = _moose.getCwe()
+    print(pwe_.getPath())
+    return pwe_
+
+
+def le(el=None):
+    """List elements under `el` or current element if no argument
+    specified.
+
+    Parameters
+    ----------
+    el : str/melement/vec/None
+        The element or the path under which to look. If `None`, children
+         of current working element are displayed.
+
+    Returns
+    -------
+    List of path of child elements
+
+    """
+    if el is None:
+        el = getCwe()
+    elif isinstance(el, str):
+        if not exists(el):
+            raise ValueError('no such element')
+        el = element(el)
+    elif isinstance(el, vec):
+        el = el[0]
+    print('Elements under', el.path)
+    for ch in el.children:
+        print(ch.path)
+    return [child.path for child in el.children]
+
+ce = setCwe  # ce is a GENESIS shorthand for change element.
+
+
+def syncDataHandler(target):
+    """Synchronize data handlers for target.
+
+    Parameters
+    ----------
+    target : melement/vec/str
+        Target element or vec or path string.
+
+    Raises
+    ------
+    NotImplementedError
+        The call to the underlying C++ function does not work.
+
+    Notes
+    -----
+    This function is defined for completeness, but currently it does not work.
+
+    """
+    raise NotImplementedError('The implementation is not working for IntFire - goes to invalid objects. \
+First fix that issue with SynBase or something in that line.')
+    if isinstance(target, str):
+        if not _moose.exists(target):
+            raise ValueError('%s: element does not exist.' % (target))
+        target = vec(target)
+        _moose.syncDataHandler(target)
+
+
+def showfield(el, field='*', showtype=False):
+    """Show the fields of the element `el`, their data types and
+    values in human readable format. Convenience function for GENESIS
+    users.
+
+    Parameters
+    ----------
+    el : melement/str
+        Element or path of an existing element.
+
+    field : str
+        Field to be displayed. If '*' (default), all fields are displayed.
+
+    showtype : bool
+        If True show the data type of each field. False by default.
+
+    Returns
+    -------
+    None
+
+    """
+    if isinstance(el, str):
+        if not exists(el):
+            raise ValueError('no such element')
+        el = element(el)
+    if field == '*':
+        value_field_dict = getFieldDict(el.className, 'valueFinfo')
+        max_type_len = max(len(dtype) for dtype in value_field_dict.values())
+        max_field_len = max(len(dtype) for dtype in value_field_dict.keys())
+        print('\n[', el.path, ']')
+        for key, dtype in sorted(value_field_dict.items()):
+            if dtype == 'bad' or key == 'this' or key == 'dummy' or key == 'me' or dtype.startswith(
+                    'vector') or 'ObjId' in dtype:
+                continue
+            value = el.getField(key)
+            if showtype:
+                typestr = dtype.ljust(max_type_len + 4)
+                # The following hack is for handling both Python 2 and
+                # 3. Directly putting the print command in the if/else
+                # clause causes syntax error in both systems.
+                print(typestr, end=' ')
+            print(key.ljust(max_field_len + 4), '=', value)
+    else:
+        try:
+            print(field, '=', el.getField(field))
+        except AttributeError:
+            pass  # Genesis silently ignores non existent fields
+
+
+def showfields(el, showtype=False):
+    """Convenience function. Should be deprecated if nobody uses it.
+
+    """
+    warnings.warn(
+        'Deprecated. Use showfield(element, field="*", showtype=True) instead.',
+        DeprecationWarning)
+    showfield(el, field='*', showtype=showtype)
+
+# Predefined field types and their human readable names
+finfotypes = [('valueFinfo', 'value field'),
+              ('srcFinfo', 'source message field'),
+              ('destFinfo', 'destination message field'),
+              ('sharedFinfo', 'shared message field'),
+              ('lookupFinfo', 'lookup field')]
+
+
+def listmsg(el):
+    """Return a list containing the incoming and outgoing messages of
+    `el`.
+
+    Parameters
+    ----------
+    el : melement/vec/str
+        MOOSE object or path of the object to look into.
+
+    Returns
+    -------
+    msg : list
+        List of Msg objects corresponding to incoming and outgoing
+        connections of `el`.
+
+    """
+    obj = element(el)
+    ret = []
+    for msg in obj.inMsg:
+        ret.append(msg)
+    for msg in obj.outMsg:
+        ret.append(msg)
+    return ret
+
+
+def showmsg(el):
+    """Print the incoming and outgoing messages of `el`.
+
+    Parameters
+    ----------
+    el : melement/vec/str
+        Object whose messages are to be displayed.
+
+    Returns
+    -------
+    None
+
+    """
+    obj = element(el)
+    print('INCOMING:')
+    for msg in obj.msgIn:
+        print(
+            msg.e2.path,
+            msg.destFieldsOnE2,
+            '<---',
+            msg.e1.path,
+            msg.srcFieldsOnE1)
+    print('OUTGOING:')
+    for msg in obj.msgOut:
+        print(
+            msg.e1.path,
+            msg.srcFieldsOnE1,
+            '--->',
+            msg.e2.path,
+            msg.destFieldsOnE2)
+
+
+def getfielddoc(tokens, indent=''):
+    """Return the documentation for field specified by `tokens`.
+
+    Parameters
+    ----------
+    tokens : (className, fieldName) str
+        A sequence whose first element is a MOOSE class name and second
+        is the field name.
+
+    indent : str
+        indentation (default: empty string) prepended to builtin
+        documentation string.
+
+    Returns
+    -------
+    docstring : str
+        string of the form
+        `{indent}{className}.{fieldName}: {datatype} - {finfoType}\n{Description}\n`
+
+    Raises
+    ------
+    NameError
+        If the specified fieldName is not present in the specified class.
+    """
+    assert(len(tokens) > 1)
+    classname = tokens[0]
+    fieldname = tokens[1]
+    while True:
+        try:
+            classelement = _moose.element('/classes/' + classname)
+            for finfo in classelement.children:
+                for fieldelement in finfo:
+                    baseinfo = ''
+                    if classname != tokens[0]:
+                        baseinfo = ' (inherited from {})'.format(classname)
+                    if fieldelement.fieldName == fieldname:
+                        # The field elements are
+                        # /classes/{ParentClass}[0]/{fieldElementType}[N].
+                        finfotype = fieldelement.name
+                        return '{indent}{classname}.{fieldname}: type={type}, finfotype={finfotype}{baseinfo}\n\t{docs}\n'.format(
+                            indent=indent, classname=tokens[0],
+                            fieldname=fieldname,
+                            type=fieldelement.type,
+                            finfotype=finfotype,
+                            baseinfo=baseinfo,
+                            docs=fieldelement.docs)
+            classname = classelement.baseClass
+        except ValueError:
+            raise NameError('`%s` has no field called `%s`'
+                            % (tokens[0], tokens[1]))
+
+
+def toUnicode(v, encoding='utf8'):
+    # if isinstance(v, str):
+        # return v
+    try:
+        return v.decode(encoding)
+    except (AttributeError, UnicodeEncodeError):
+        return str(v)
+
+
+def getmoosedoc(tokens, inherited=False):
+    """Return MOOSE builtin documentation.
+
+    Parameters
+    ----------
+    tokens : (className, [fieldName])
+        tuple containing one or two strings specifying class name
+        and field name (optional) to get documentation for.
+
+    inherited: bool (default: False)
+        include inherited fields.
+
+    Returns
+    -------
+    docstring : str
+        Documentation string for class `className`.`fieldName` if both
+        are specified, for the class `className` if fieldName is not
+        specified. In the latter case, the fields and their data types
+        and finfo types are listed.
+
+    Raises
+    ------
+    NameError
+        If class or field does not exist.
+
+    """
+    indent = '    '
+    with closing(StringIO()) as docstring:
+        if not tokens:
+            return ""
+        try:
+            class_element = _moose.element('/classes/%s' % (tokens[0]))
+        except ValueError:
+            raise NameError('name \'%s\' not defined.' % (tokens[0]))
+        if len(tokens) > 1:
+            docstring.write(toUnicode(getfielddoc(tokens)))
+        else:
+            docstring.write(toUnicode('%s\n' % (class_element.docs)))
+            append_finfodocs(tokens[0], docstring, indent)
+            if inherited:
+                mro = eval('_moose.%s' % (tokens[0])).mro()
+                for class_ in mro[1:]:
+                    if class_ == _moose.melement:
+                        break
+                    docstring.write(toUnicode(
+                        '\n\n#Inherited from %s#\n' % (class_.__name__)))
+                    append_finfodocs(class_.__name__, docstring, indent)
+                    if class_ == _moose.Neutral:    # Neutral is the toplevel moose class
+                        break
+        return docstring.getvalue()
+
+
+def append_finfodocs(classname, docstring, indent):
+    """Append list of finfos in class name to docstring"""
+    try:
+        class_element = _moose.element('/classes/%s' % (classname))
+    except ValueError:
+        raise NameError('class \'%s\' not defined.' % (classname))
+    for ftype, rname in finfotypes:
+        docstring.write(toUnicode('\n*%s*\n' % (rname.capitalize())))
+        try:
+            finfo = _moose.element('%s/%s' % (class_element.path, ftype))
+            for field in finfo.vec:
+                docstring.write(toUnicode(
+                    '%s%s: %s\n' % (indent, field.fieldName, field.type)))
+        except ValueError:
+            docstring.write(toUnicode('%sNone\n' % (indent)))
+
+
+# the global pager is set from pydoc even if the user asks for paged
+# help once. this is to strike a balance between GENESIS user's
+# expectation of control returning to command line after printing the
+# help and python user's expectation of seeing the help via more/less.
+pager = None
+
+
+def doc(arg, inherited=True, paged=True):
+    """Display the documentation for class or field in a class.
+
+    Parameters
+    ----------
+    arg : str/class/melement/vec
+        A string specifying a moose class name and a field name
+        separated by a dot. e.g., 'Neutral.name'. Prepending `moose.`
+        is allowed. Thus moose.doc('moose.Neutral.name') is equivalent
+        to the above.
+        It can also be string specifying just a moose class name or a
+        moose class or a moose object (instance of melement or vec
+        or there subclasses). In that case, the builtin documentation
+        for the corresponding moose class is displayed.
+
+    paged: bool
+        Whether to display the docs via builtin pager or print and
+        exit. If not specified, it defaults to False and
+        moose.doc(xyz) will print help on xyz and return control to
+        command line.
+
+    Returns
+    -------
+    None
+
+    Raises
+    ------
+    NameError
+        If class or field does not exist.
+
+    """
+    # There is no way to dynamically access the MOOSE docs using
+    # pydoc. (using properties requires copying all the docs strings
+    # from MOOSE increasing the loading time by ~3x). Hence we provide a
+    # separate function.
+    global pager
+    if paged and pager is None:
+        pager = pydoc.pager
+    tokens = []
+    text = ''
+    if isinstance(arg, str):
+        tokens = arg.split('.')
+        if tokens[0] == 'moose':
+            tokens = tokens[1:]
+    elif isinstance(arg, type):
+        tokens = [arg.__name__]
+    elif isinstance(arg, melement) or isinstance(arg, vec):
+        text = '%s: %s\n\n' % (arg.path, arg.className)
+        tokens = [arg.className]
+    if tokens:
+        text += getmoosedoc(tokens, inherited=inherited)
+    else:
+        text += pydoc.getdoc(arg)
+    if pager:
+        pager(text)
+    else:
+        print(text)
+
+
+#
+# moose.py ends here
diff --git a/python/moose/plot_utils.py b/python/moose/plot_utils.py
index 25346524a0d190594ae23a435070e0e973439292..c7c7a977acb07952362c14430e6857e1b2487802 100644
--- a/python/moose/plot_utils.py
+++ b/python/moose/plot_utils.py
@@ -135,7 +135,7 @@ def plotTables(tables, outfile=None, **kwargs):
     subplot = kwargs.get('subplot', True)
     for i, tname in enumerate(tables):
         if subplot:
-            plt.subplot(len(tables), 1, i+1)
+            plt.subplot(len(tables), 1, i)
         yvec = tables[tname].vector 
         xvec = np.linspace(0, moose.Clock('/clock').currentTime, len(yvec))
         plt.plot(xvec, yvec, label=tname)
@@ -165,7 +165,7 @@ def plotVector(vec, xvec = None, **options):
     :param vec: Given vector.
     :param **kwargs: Optional to pass to maplotlib.
     """
-    ax = options[ 'ax' ]
+
     assert type(vec) == np.ndarray, "Expected type %s" % type(vec)
     legend = options.get('legend', True)
 
@@ -176,29 +176,28 @@ def plotVector(vec, xvec = None, **options):
         xx = xvec[:]
 
     assert len(xx) == len(vec), "Expecting %s got %s" % (len(vec), len(xvec))
-    ax.plot(xx, vec, label=options.get('label', ''))
 
+    plt.plot(xx, vec, label=options.get('label', ''))
     if legend:
         # This may not be available on older version of matplotlib.
         try:
-            ax.legend(loc='best', framealpha=0.4)
+            plt.legend(loc='best', framealpha=0.4)
         except:
-            ax.legend(loc='best')
+            plt.legend(loc='best')
 
     if xvec is None:
-        ax.set_xlabel('Time (sec)')
+        plt.xlabel('Time (sec)')
     else:
-        ax.set_xlabel(options.get('xlabel', ''))
+        plt.xlabel(options.get('xlabel', ''))
     
-    ax.set_ylabel = options.get('ylabel', '')
-    ax.set_title(options.get('title', ''))
+    plt.ylabel = options.get('ylabel', '')
+    plt.title(options.get('title', ''))
 
     if(options.get('legend', True)):
         try:
-            ax.legend(loc='best', framealpha=0.4, prop={'size' : 9})
+            plt.legend(loc='best', framealpha=0.4, prop={'size' : 9})
         except:
-            ax.legend(loc='best', prop={'size' : 9})
-    return ax
+            plt.legend(loc='best', prop={'size' : 9})
 
 
 def saveRecords(records, xvec = None, **kwargs):
@@ -268,7 +267,7 @@ def plotRecords(records, xvec = None, **kwargs):
                 yvec = dataDict[k].vector
                 plotVector(yvec, xvec, label=k, **kwargs)
             else:
-                kwargs[ 'ax' ] = plt.subplot(len(dataDict), 1, i)
+                plt.subplot(len(dataDict), 1, i)
                 yvec = dataDict[k].vector
                 plotVector(yvec, xvec, label=k, **kwargs)
 
@@ -287,13 +286,9 @@ def plotRecords(records, xvec = None, **kwargs):
     else:
         plt.show()
 
-def plot_records( data_dict, xvec = None, **kwargs ):
-    """Renamed (deprecated)
-    """
-    return plot_tables( data_dict, xvec, **kwargs )
 
-def plot_tables(data_dict, xvec = None, **kwargs):
-    """plot_tables plots moose.Table stored in a dictionary.
+def plot_records(data_dict, xvec = None, **kwargs):
+    """plot_records Plot given dictionary.
 
     :param data_dict:
     :param xvec: If None, use moose.Clock to generate xvec.
@@ -323,7 +318,7 @@ def plot_tables(data_dict, xvec = None, **kwargs):
                 
         if plotThis:
             if not subplot: 
-                yvec = data_dict[k].vector
+                yvec = data_dict[k]
                 plotVector(yvec, xvec, label=k, **kwargs)
             else:
                 ax = plt.subplot(len(data_dict), 1, i+1)
diff --git a/python/rdesigneur/rdesigneur.py b/python/rdesigneur/rdesigneur.py
index 632e7ead2a16364e4f6e4154d82a1f75ea6b5a14..e267921c404d9c2954ab5503601778ea4818fae0 100644
--- a/python/rdesigneur/rdesigneur.py
+++ b/python/rdesigneur/rdesigneur.py
@@ -80,7 +80,6 @@ class rdesigneur:
             useGssa = True,
             combineSegments = True,
             stealCellFromLibrary = False,
-            verbose = True,
             diffusionLength= 2e-6,
             meshLambda = -1.0,    #This is a backward compatibility hack
             temperature = 32,
@@ -112,7 +111,6 @@ class rdesigneur:
         self.useGssa = useGssa
         self.combineSegments = combineSegments
         self.stealCellFromLibrary = stealCellFromLibrary
-        self.verbose = verbose
         self.diffusionLength= diffusionLength
         if meshLambda > 0.0:
             print("Warning: meshLambda argument is deprecated. Please use 'diffusionLength' instead.\nFor now rdesigneur will accept this argument.")
@@ -203,8 +201,7 @@ class rdesigneur:
             self._buildMoogli()
             self._buildStims()
             self._configureClocks()
-            if self.verbose:
-                self._printModelStats()
+            self._printModelStats()
             self._savePlots()
 
         except BuildError as msg:
@@ -318,8 +315,7 @@ class rdesigneur:
                 return True
             if moose.exists( '/library/' + protoVec[0] ):
                 #moose.copy('/library/' + protoVec[0], '/library/', protoVec[1])
-                if self.verbose:
-                    print('renaming /library/' + protoVec[0] + ' to ' + protoVec[1])
+                print('renaming /library/' + protoVec[0] + ' to ' + protoVec[1])
                 moose.element( '/library/' + protoVec[0]).name = protoVec[1]
                 #moose.le( '/library' )
                 return True
@@ -458,7 +454,6 @@ class rdesigneur:
                     "buildChemDistrib: No elec compartments found in path: '" \
                         + pair + "'" )
             self.spineComptElist = self.elecid.spinesFromExpression[ pair ]
-            #print( 'LEN SPINECOMPTELIST =' + str( pair ) + ", " str( len( self.spineComptElist ) ) )
             '''
             if len( self.spineComptElist ) == 0:
                 raise BuildError( \
@@ -600,7 +595,6 @@ class rdesigneur:
     def _buildMoogli( self ):
         knownFields = {
             'Vm':('CompartmentBase', 'getVm', 1000, 'Memb. Potential (mV)', -80.0, 40.0 ),
-            'initVm':('CompartmentBase', 'getInitVm', 1000, 'Init. Memb. Potl (mV)', -80.0, 40.0 ),
             'Im':('CompartmentBase', 'getIm', 1e9, 'Memb. current (nA)', -10.0, 10.0 ),
             'inject':('CompartmentBase', 'getInject', 1e9, 'inject current (nA)', -10.0, 10.0 ),
             'Gbar':('ChanBase', 'getGbar', 1e9, 'chan max conductance (nS)', 0.0, 1.0 ),
@@ -1282,8 +1276,8 @@ class rdesigneur:
             else:
                 ePath = i[0].path + '/' + elecRelPath
                 if not( moose.exists( ePath ) ):
-                    continue
-                    #raise BuildError( "Error: buildAdaptor: no elec obj in " + ePath )
+                    raise BuildError( \
+                        "Error: buildAdaptor: no elec obj in " + ePath )
                 elObj = moose.element( i[0].path + '/' + elecRelPath )
             if ( isElecToChem ):
                 elecFieldSrc = 'get' + capField
diff --git a/python/rdesigneur/rmoogli.py b/python/rdesigneur/rmoogli.py
index e1e34a7883770f76a7b6364bfc687ac8b139320e..8a475a09a85544dcb3f82890747da8e64ab916b0 100644
--- a/python/rdesigneur/rmoogli.py
+++ b/python/rdesigneur/rmoogli.py
@@ -17,7 +17,6 @@ import os
 # Check if DISPLAY environment variable is properly set. If not, warn the user
 # and continue.
 hasDisplay = True
-hasMoogli = False
 display = os.environ.get('DISPLAY',  '' )
 if not display:
     hasDisplay = False
@@ -26,6 +25,7 @@ if not display:
             "Anyway, MOOSE will continue without graphics.\n"
             )
 
+hasMoogli = True
 
 if hasDisplay:
     try: 
@@ -33,11 +33,11 @@ if hasDisplay:
         import moogli
         import moogli.extensions.moose
         app = QtGui.QApplication(sys.argv)
-        hasMoogli = True
     except Exception as e:
         print( 'Warning: Moogli not found. All moogli calls will use dummy functions' )
         hasMoogli = False
 
+
 runtime = 0.0
 moogliDt = 1.0
 rotation = math.pi / 500.0
diff --git a/python/setup.py b/python/setup.py
index 475826a54e32a25fdbf6e64181d8fbe08ec3eb6f..a6c3852c787d09e3d59d8b03ba82c359759e8f11 100644
--- a/python/setup.py
+++ b/python/setup.py
@@ -33,7 +33,7 @@ from distutils.core import setup
 
 script_dir = os.path.dirname( os.path.abspath( __file__ ) )
 
-version = '3.2.git'
+version = '3.1'
 try:
     with open( os.path.join( script_dir, '..', 'VERSION'), 'r' ) as f:
         version = f.read( )
diff --git a/scheduling/Clock.cpp b/scheduling/Clock.cpp
index 434d2f62e94e54674310b3d363d1ef9a3733a6d3..b5bac41b1219c87702b57fe37736fa7605966c8c 100644
--- a/scheduling/Clock.cpp
+++ b/scheduling/Clock.cpp
@@ -327,7 +327,7 @@ const Cinfo* Clock::initCinfo()
         "The clock also starts up with some default timesteps for each "
         "of these ticks, and this can be overridden using the shell "
         "command setClock, or by directly assigning tickStep values on the "
-        "clock object. \n"
+        "clock object."
         "Which objects use which tick? As a rule of thumb, try this: \n"
         "Electrical/compartmental model calculations: Ticks 0-7 \n"
         "Tables and output objects for electrical output: Tick 8 \n"
@@ -342,57 +342,57 @@ const Cinfo* Clock::initCinfo()
         "clock ticks for the tables/fileIO objects handling output at "
         "different time-resolutions. Typically one uses tick 8 and 18.\n"
         "Here are the detailed mappings of class to tick.\n"
-        "	Class				Tick		dt \n"
-        "	DiffAmp				0		50e-6\n"
-        "	Interpol			0		50e-6\n"
-        "	PIDController			0		50e-6\n"
-        "	PulseGen			0		50e-6\n"
-        "	StimulusTable			0		50e-6\n"
-        "	testSched			0		50e-6\n"
-        "	VClamp				0		50e-6\n"
-        "	SynHandlerBase			1		50e-6\n"
-        "	SimpleSynHandler		1		50e-6\n"
-        "   STDPSynHandler		1		50e-6\n"
-        "   GraupnerBrunel2012CaPlasticitySynHandler    1		50e-6\n"
-        "   SeqSynHandler		1		50e-6\n"
+        "   Class              Tick       dt \n"
+        "   DiffAmp             0       50e-6\n"
+        "   Interpol            0       50e-6\n"
+        "   PIDController       0       50e-6\n"
+        "   PulseGen            0       50e-6\n"
+        "   StimulusTable       0       50e-6\n"
+        "   testSched           0       50e-6\n"
+        "   VClamp              0       50e-6\n"
+        "   SynHandlerBase      1       50e-6\n"
+        "   SimpleSynHandler    1       50e-6\n"
+        "   STDPSynHandler      1       50e-6\n"
+        "   GraupnerBrunel2012CaPlasticitySynHandler    1        50e-6\n"
+        "   SeqSynHandler       1       50e-6\n"
         "	CaConc				1		50e-6\n"
         "	CaConcBase			1		50e-6\n"
         "	DifShell			1		50e-6\n"
-	"	DifShellBase			1		50e-6\n"
-	"       MMPump                          1               50e-6\n"
-	"	DifBuffer			1		50e-6\n"
-	"	DifBufferBase			1		50e-6\n"
+	    "	DifShellBase		1		50e-6\n"
+	    "   MMPump              1       50e-6\n"
+	    "	DifBuffer			1		50e-6\n"
+	    "	DifBufferBase		1		50e-6\n"
         "	MgBlock				1		50e-6\n"
         "	Nernst				1		50e-6\n"
         "	RandSpike			1		50e-6\n"
         "	ChanBase			2		50e-6\n"
         "	IntFire				2		50e-6\n"
         "	IntFireBase			2		50e-6\n"
-        "	LIF				2		50e-6\n"
-        "	QIF				2		50e-6\n"
+        "	LIF					2		50e-6\n"
+        "	QIF					2		50e-6\n"
         "	ExIF				2		50e-6\n"
         "	AdExIF				2		50e-6\n"
-        "	AdThreshIF				2		50e-6\n"
+        "	AdThreshIF			2		50e-6\n"
         "	IzhIF				2		50e-6\n"
-        "	IzhikevichNrn			2		50e-6\n"
+        "	IzhikevichNrn		2		50e-6\n"
         "	SynChan				2		50e-6\n"
-        "	NMDAChan				2		50e-6\n"
+        "	NMDAChan			2		50e-6\n"
         "	GapJunction			2		50e-6\n"
         "	HHChannel			2		50e-6\n"
         "	HHChannel2D			2		50e-6\n"
         "	Leakage				2		50e-6\n"
-        "	MarkovChannel			2		50e-6\n"
-        "	MarkovGslSolver			2		50e-6\n"
-        "	MarkovRateTable			2		50e-6\n"
-        "	MarkovSolver			2		50e-6\n"
-        "	MarkovSolverBase		2		50e-6\n"
-        "	RC				2		50e-6\n"
-        "	Compartment (init)		3		50e-6\n"
+        "	MarkovChannel		2		50e-6\n"
+        "	MarkovGslSolver		2		50e-6\n"
+        "	MarkovRateTable		2		50e-6\n"
+        "	MarkovSolver		2		50e-6\n"
+        "	MarkovSolverBase	2		50e-6\n"
+        "	RC					2		50e-6\n"
+        "	Compartment (init)	3		50e-6\n"
         "	CompartmentBase (init )		3		50e-6\n"
         "	SymCompartment	(init)		3		50e-6\n"
-        "	Compartment 			4		50e-6\n"
-        "	CompartmentBase			4		50e-6\n"
-        "	SymCompartment			4		50e-6\n"
+        "	Compartment 		4		50e-6\n"
+        "	CompartmentBase		4		50e-6\n"
+        "	SymCompartment		4		50e-6\n"
         "	SpikeGen			5		50e-6\n"
         "	HSolve				6		50e-6\n"
         "	SpikeStats			7		50e-6\n"
@@ -408,23 +408,23 @@ const Cinfo* Clock::initCinfo()
         "	Pool				13		0.1\n"
         "	PoolBase			13		0.1\n"
         "	CplxEnzBase			14		0.1\n"
-        "	Enz				14		0.1\n"
+        "	Enz					14		0.1\n"
         "	EnzBase				14		0.1\n"
         "	MMenz				14		0.1\n"
         "	Reac				14		0.1\n"
         "	ReacBase			14		0.1\n"
-        "	Gsolve	(init)			15		0.1\n"
-        "	Ksolve	(init)			15		0.1\n"
+        "	Gsolve	(init)		15		0.1\n"
+        "	Ksolve	(init)		15		0.1\n"
         "	Gsolve				16		0.1\n"
         "	Ksolve				16		0.1\n"
         "	Stats				17		0.1\n"
         "	Table2				18		1\n"
         "	Streamer			19		10\n"
 
-        "	HDF5DataWriter			30		1\n"
-        "	HDF5WriterBase			30		1\n"
+        "	HDF5DataWriter		30		1\n"
+        "	HDF5WriterBase		30		1\n"
         "	NSDFWriter			30		1\n"
-        "       PyRun                           30              1\n"
+        "   PyRun           	30      1\n"
         "	PostMaster			31		0.01\n"
         "	\n"
         "	Note that the other classes are not scheduled at all.",
@@ -746,7 +746,7 @@ void Clock::handleStep( const Eref& e, unsigned long numSteps )
                 time( &rawtime );
                 timeinfo = localtime( &rawtime );
                 strftime(now, 80, "%c", timeinfo);
-                cout << "@ " << now << ": " << 100 * currentTime_ / runTime_ 
+                cout << "@ " << now << ": " << 100 * currentTime_ / runTime_
                     << "% of total " << runTime_ << " seconds is over." << endl;
             }
         }
@@ -999,5 +999,3 @@ unsigned int Clock::lookupDefaultTick( const string& className )
     }
     return i->second;
 }
-
-
diff --git a/synapse/CMakeLists.txt b/synapse/CMakeLists.txt
index 2b7d36221cd5c50d3afa67766da3f403a1cd75c2..bb47b9779b8f3d9c7393cd01f44c27f803ee4248 100644
--- a/synapse/CMakeLists.txt
+++ b/synapse/CMakeLists.txt
@@ -1,18 +1,5 @@
 cmake_minimum_required(VERSION 2.8)
-
 include_directories( ../basecode ../utility ../kinetics)
 include_directories( ../external/muparser/include/ )
-
-set( SYNAPSE_SRCS 
-    GraupnerBrunel2012CaPlasticitySynHandler.cpp
-    RollingMatrix.cpp
-    SeqSynHandler.cpp
-    SimpleSynHandler.cpp
-    STDPSynapse.cpp
-    STDPSynHandler.cpp
-    Synapse.cpp
-    SynHandlerBase.cpp
-    testSynapse.cpp
-    )
-
+file(GLOB SYNAPSE_SRCS *.cpp)
 add_library(synapse ${SYNAPSE_SRCS} )
diff --git a/synapse/RollingMatrix.cpp b/synapse/RollingMatrix.cpp
index 01818a83f98d356536ca787c696a3f67cac6e03d..5fd84a9bfe83c4ab42a239731bc2d96a827759de 100644
--- a/synapse/RollingMatrix.cpp
+++ b/synapse/RollingMatrix.cpp
@@ -11,7 +11,6 @@
 using namespace std;
 #include "RollingMatrix.h"
 #include <cassert>
-// #include <iostream>
 
 RollingMatrix::RollingMatrix()
 		: nrows_(0), ncolumns_(0), currentStartRow_(0)
@@ -68,21 +67,9 @@ void RollingMatrix::sumIntoRow( const vector< double >& input, unsigned int row
 double RollingMatrix::dotProduct( const vector< double >& input, 
 				unsigned int row, unsigned int startColumn ) const
 {
-	/// startColumn is the middle of the kernel.
 	unsigned int index = (row + currentStartRow_) % nrows_;
 	const SparseVector& sv = rows_[index];
-	unsigned int i2 = input.size()/2;
-	unsigned int istart = (startColumn >= i2) ? 0 : i2-startColumn;
-	unsigned int colstart = (startColumn <= i2) ? 0 : startColumn - i2;
-	unsigned int iend = (sv.size()-startColumn > i2 ) ? input.size() :
-			i2 - startColumn + sv.size();
 
-	// if ( iend >= istart ) cout << startColumn << i2 << istart << iend << colstart << "\n";
-	double ret = 0;
-	for (unsigned int i = istart, j = 0; i < iend; ++i, ++j )
-		ret += sv[j + colstart] * input[i];
-
-	/*
 	double ret = 0;
 	if ( input.size() + startColumn <= sv.size() ) {
 		for (unsigned int i = 0; i < input.size(); ++i )
@@ -92,7 +79,6 @@ double RollingMatrix::dotProduct( const vector< double >& input,
 		for (unsigned int i = 0; i < end; ++i )
 			ret += sv[i + startColumn] * input[i];
 	}
-	*/
 	return ret;
 }
 
diff --git a/synapse/SeqSynHandler.cpp b/synapse/SeqSynHandler.cpp
index dc826cefd49306dda29088158185a4d762f28599..7cdf6bc98d02fb54903294d77509018201d79ff6 100644
--- a/synapse/SeqSynHandler.cpp
+++ b/synapse/SeqSynHandler.cpp
@@ -8,7 +8,6 @@
 **********************************************************************/
 
 #include <queue>
-#include "global.h"
 #include "header.h"
 #include "Synapse.h"
 #include "SynEvent.h"
@@ -43,22 +42,17 @@ const Cinfo* SeqSynHandler::initCinfo()
 		    "kernel with the history[time][synapse#] matrix."
 			"\nThe local response can affect the synapse in three ways: " 
 			"1. It can sum the entire response vector, scale by the "
-			"*sequenceScale* term, and send to the synapse as a steady "
+			"*responseScale* term, and send to the synapse as a steady "
 			"activation. Consider this a cell-wide immediate response to "
 			"a sequence that it likes.\n"
 			"2. It do an instantaneous scaling of the weight of each "
 			"individual synapse by the corresponding entry in the response "
-			"vector. It uses the *plasticityScale* term to do this. "
-			"Consider "
+			"vector. It uses the *weightScale* term to do this. Consider "
 			"this a short-term plasticity effect on specific synapses. \n"
 			"3. It can do long-term plasticity of each individual synapse "
 			"using the matched local entries in the response vector and "
 			"individual synapse history as inputs to the learning rule. "
 			"This is not yet implemented.\n"
-			"In addition to all these, the SeqSynHandler can act just like "
-			"a regular synapse, where it responds to individual synaptic "
-			"input according to the weight of the synapse. The size of "
-			"this component of the output is scaled by *baseScale*\n"
 	};
 
 	static FieldElementFinfo< SynHandlerBase, Synapse > synFinfo( 
@@ -94,51 +88,22 @@ const Cinfo* SeqSynHandler::initCinfo()
 			&SeqSynHandler::setHistoryTime,
 			&SeqSynHandler::getHistoryTime
 	);
-	static ValueFinfo< SeqSynHandler, double > baseScale(
-			"baseScale",
-			"Basal scaling factor for regular synaptic activation.",
-			&SeqSynHandler::setBaseScale,
-			&SeqSynHandler::getBaseScale
-	);
-	static ValueFinfo< SeqSynHandler, double > sequenceScale(
-			"sequenceScale",
+	static ValueFinfo< SeqSynHandler, double > responseScale(
+			"responseScale",
 			"Scaling factor for sustained activation of synapse by seq",
-			&SeqSynHandler::setSequenceScale,
-			&SeqSynHandler::getSequenceScale
-	);
-	static ValueFinfo< SeqSynHandler, vector< unsigned int > > synapseOrder(
-			"synapseOrder",
-			"Mapping of synapse input order to spatial order on syn array."
-			"Entries in this vector are indices which must remain smaller "
-			"than numSynapses. The system will fix up if you mess up. "
-			"It does not insist on unique mappings, but these are "
-			"desirable as outcome is undefined for repeated entries.",
-			&SeqSynHandler::setSynapseOrder,
-			&SeqSynHandler::getSynapseOrder
-	);
-	static ValueFinfo< SeqSynHandler, int > synapseOrderOption(
-			"synapseOrderOption",
-			"How to do the synapse order remapping. This rule stays in "
-			"place and guarantees safe mappings even if the number of "
-			"synapses is altered. Options:\n"
-		    "-2: User ordering.\n"
-		    "-1: Sequential ordering, 0 to numSynapses-1.\n"
-		    "0: Random ordering using existing system seed.\n"
-		    ">0: Random ordering using seed specified by this number\n"
-			"Default is -1, sequential ordering.",
-			&SeqSynHandler::setSynapseOrderOption,
-			&SeqSynHandler::getSynapseOrderOption
+			&SeqSynHandler::setResponseScale,
+			&SeqSynHandler::getResponseScale
 	);
 	static ReadOnlyValueFinfo< SeqSynHandler, double > seqActivation(
 			"seqActivation",
 			"Reports summed activation of synaptic channel by sequence",
 			&SeqSynHandler::getSeqActivation
 	);
-	static ValueFinfo< SeqSynHandler, double > plasticityScale(
-			"plasticityScale",
-			"Scaling factor for doing plasticity by scaling each synapse by response vector",
-			&SeqSynHandler::setPlasticityScale,
-			&SeqSynHandler::getPlasticityScale
+	static ValueFinfo< SeqSynHandler, double > weightScale(
+			"weightScale",
+			"Scaling factor for weight of each synapse by response vector",
+			&SeqSynHandler::setWeightScale,
+			&SeqSynHandler::getWeightScale
 	);
 
 	static ValueFinfo< SeqSynHandler, double > sequencePower(
@@ -219,7 +184,8 @@ SeqSynHandler::SeqSynHandler()
 		seqActivation_( 0.0 ),
 		synapseOrderOption_( -1 ) // sequential ordering
 { 
-	history_.resize( numHistory(), 0 );
+	int numHistory = static_cast< int >( 1.0 + floor( historyTime_ * (1.0 - 1e-6 ) / seqDt_ ) );
+	history_.resize( numHistory, 0 );
 }
 
 SeqSynHandler::~SeqSynHandler()
@@ -247,10 +213,10 @@ void SeqSynHandler::vSetNumSynapses( const unsigned int v )
 	for ( unsigned int i = prevSize; i < v; ++i )
 		synapses_[i].setHandler( this );
 
-	history_.resize( numHistory(), v );
+	int numHistory = static_cast< int >( 1.0 + floor( historyTime_ * (1.0 - 1e-6 ) / seqDt_ ) );
+	history_.resize( numHistory, v );
 	latestSpikes_.resize( v, 0.0 );
 	weightScaleVec_.resize( v, 0.0 );
-	refillSynapseOrder( v );
 	updateKernel();
 }
 
@@ -270,65 +236,6 @@ Synapse* SeqSynHandler::vGetSynapse( unsigned int i )
 }
 
 //////////////////////////////////////////////////////////////////////
-
-// Checks for numbers bigger than the size. Replaces with
-// values within the range that have not yet been used.
-void SeqSynHandler::fixSynapseOrder() 
-{
-	unsigned int sz = synapseOrder_.size();
-	vector< unsigned int > availableEntries( sz );
-	iota( availableEntries.begin(), availableEntries.end(), 0 );
-	for( unsigned int i = 0; i < sz; ++i ) {
-		if ( synapseOrder_[i] < sz )
-			availableEntries[ synapseOrder_[i] ] = sz;
-	}
-	vector< unsigned int > ae;
-	for( unsigned int i = 0; i < sz; ++i )
-		if ( availableEntries[i] < sz )
-			ae.push_back( availableEntries[i] );
-
-	auto jj = ae.begin();
-	for( unsigned int i = 0; i < sz; ++i ) {
-		if ( synapseOrder_[i] >= sz )
-			synapseOrder_[i] = *jj++;
-	}
-}
-
-// Beautiful snippet from Lukasz Wiklendt on StackOverflow. Returns order
-// of entries in a vector.
-template <typename T> vector<size_t> sort_indexes(const vector<T> &v) {
-	// initialize original index locations
-	vector<size_t> idx(v.size());
-	iota(idx.begin(), idx.end(), 0);
-	// sort indexes based on comparing values in v
-	sort(idx.begin(), idx.end(),
-		[&v](size_t i1, size_t i2) {return v[i1] < v[i2];});
-	return idx;
-}
-
-void SeqSynHandler::refillSynapseOrder( unsigned int newSize )
-{
-	if ( synapseOrderOption_ <= -2 ) { // User order
-		synapseOrder_.resize( newSize, newSize );
-		fixSynapseOrder();
-	} else if ( synapseOrderOption_ == -1 ) { // Ordered
-		synapseOrder_.resize( newSize );
-		for ( unsigned int i = 0 ; i < newSize; ++i )
-			synapseOrder_[i] = i;
-	} else {
-		synapseOrder_.resize( newSize );
-		if ( synapseOrderOption_ > 0 ) { // Specify seed explicitly
-                    moose::mtseed( synapseOrderOption_ );
-		}
-		vector< double > x;
-		for ( unsigned int i = 0; i < newSize; ++i )
-			x.push_back( moose::mtrand() );
-		auto idx = sort_indexes< double >( x );
-		for ( unsigned int i = 0; i < newSize; ++i )
-			synapseOrder_[i] = idx[i];
-	}
-}
-
 void SeqSynHandler::updateKernel()
 {
 	if ( kernelEquation_ == "" || seqDt_ < 1e-9 || historyTime_ < 1e-9 )
@@ -342,9 +249,9 @@ void SeqSynHandler::updateKernel()
 	p.DefineConst(_T("e"), (mu::value_type)M_E);
 	p.SetExpr( kernelEquation_ );
 	kernel_.clear();
-	int nh = numHistory();
-	kernel_.resize( nh );
-	for ( int i = 0; i < nh; ++i ) {
+	int numHistory = static_cast< int >( 1.0 + floor( historyTime_ * (1.0 - 1e-6 ) / seqDt_ ) );
+	kernel_.resize( numHistory );
+	for ( int i = 0; i < numHistory; ++i ) {
 		kernel_[i].resize( kernelWidth_ );
 		t = i * seqDt_;
 		for ( unsigned int j = 0; j < kernelWidth_; ++j ) {
@@ -381,7 +288,8 @@ void SeqSynHandler::setSeqDt( double v )
 {
 	seqDt_ = v;
 	updateKernel();
-	history_.resize( numHistory(), vGetNumSynapses() );
+	int numHistory = static_cast< int >( 1.0 + floor( historyTime_ * (1.0 - 1e-6 ) / seqDt_ ) );
+	history_.resize( numHistory, vGetNumSynapses() );
 }
 
 double SeqSynHandler::getSeqDt() const
@@ -392,7 +300,8 @@ double SeqSynHandler::getSeqDt() const
 void SeqSynHandler::setHistoryTime( double v )
 {
 	historyTime_ = v;
-	history_.resize( numHistory(), vGetNumSynapses() );
+	int numHistory = static_cast< int >( 1.0 + floor( historyTime_ * (1.0 - 1e-6 ) / seqDt_ ) );
+	history_.resize( numHistory, vGetNumSynapses() );
 	updateKernel();
 }
 
@@ -401,24 +310,14 @@ double SeqSynHandler::getHistoryTime() const
 	return historyTime_;
 }
 
-void SeqSynHandler::setBaseScale( double v )
+void SeqSynHandler::setResponseScale( double v )
 {
-	baseScale_ = v;
+	responseScale_ = v;
 }
 
-double SeqSynHandler::getBaseScale() const
+double SeqSynHandler::getResponseScale() const
 {
-	return baseScale_;
-}
-
-void SeqSynHandler::setSequenceScale( double v )
-{
-	sequenceScale_ = v;
-}
-
-double SeqSynHandler::getSequenceScale() const
-{
-	return sequenceScale_;
+	return responseScale_;
 }
 
 double SeqSynHandler::getSeqActivation() const
@@ -426,14 +325,14 @@ double SeqSynHandler::getSeqActivation() const
 	return seqActivation_;
 }
 
-double SeqSynHandler::getPlasticityScale() const
+double SeqSynHandler::getWeightScale() const
 {
-	return plasticityScale_;
+	return weightScale_;
 }
 
-void SeqSynHandler::setPlasticityScale( double v )
+vector< double >SeqSynHandler::getWeightScaleVec() const
 {
-	plasticityScale_ = v;
+	return weightScaleVec_;
 }
 
 double SeqSynHandler::getSequencePower() const
@@ -448,14 +347,14 @@ void SeqSynHandler::setSequencePower( double v )
 
 vector< double >SeqSynHandler::getWeightScaleVec() const
 {
-	return weightScaleVec_;
+	weightScale_ = v;
 }
 
 vector< double > SeqSynHandler::getKernel() const
 {
-	int nh = numHistory();
+	int numHistory = static_cast< int >( 1.0 + floor( historyTime_ * (1.0 - 1e-6 ) / seqDt_ ) );
 	vector< double > ret;
-	for ( int i = 0; i < nh; ++i ) {
+	for ( int i = 0; i < numHistory; ++i ) {
 		ret.insert( ret.end(), kernel_[i].begin(), kernel_[i].end() );
 	}
 	return ret;
@@ -463,40 +362,17 @@ vector< double > SeqSynHandler::getKernel() const
 
 vector< double > SeqSynHandler::getHistory() const
 {
-	int nh = numHistory();
+	int numHistory = static_cast< int >( 1.0 + floor( historyTime_ * (1.0 - 1e-6 ) / seqDt_ ) );
 	int numX = vGetNumSynapses();
-	vector< double > ret( numX * nh, 0.0 );
+	vector< double > ret( numX * numHistory, 0.0 );
 	vector< double >::iterator k = ret.begin();
-	for ( int i = 0; i < nh; ++i ) {
+	for ( int i = 0; i < numHistory; ++i ) {
 		for ( int j = 0; j < numX; ++j )
 			*k++ = history_.get( i, j );
 	}
 	return ret;
 }
 
-void SeqSynHandler::setSynapseOrder( vector< unsigned int > v )
-{
-	synapseOrder_ = v;
-	fixSynapseOrder();
-	synapseOrderOption_ = -2; // Set the flag to say it is User defined.
-}
-
-vector< unsigned int > SeqSynHandler::getSynapseOrder() const
-{
-	return synapseOrder_;
-}
-
-void SeqSynHandler::setSynapseOrderOption( int v )
-{
-	synapseOrderOption_ = v;
-	refillSynapseOrder( synapseOrder_.size() );
-}
-
-int SeqSynHandler::getSynapseOrderOption() const
-{
-	return synapseOrderOption_;
-}
-
 /////////////////////////////////////////////////////////////////////
 
 void SeqSynHandler::addSpike(unsigned int index, double time, double weight)
@@ -508,9 +384,7 @@ void SeqSynHandler::addSpike(unsigned int index, double time, double weight)
 	// slice. For now, to get it going for LIF neurons, this will do.
 	// Even in the general case we will probably have a very wide window
 	// for the latestSpikes slice.
-	//
-	// Here we reorder the entries in latestSpikes by the synapse order.
-	latestSpikes_[ synapseOrder_[index] ] += weight;
+	latestSpikes_[index] += weight;
 }
 
 unsigned int SeqSynHandler::addSynapse()
@@ -531,10 +405,10 @@ void SeqSynHandler::dropSynapse( unsigned int msgLookup )
 void SeqSynHandler::vProcess( const Eref& e, ProcPtr p ) 
 {
 	// Here we look at the correlations and do something with them.
-	int nh = numHistory();
+	int numHistory = static_cast< int >( 1.0 + floor( historyTime_ * (1.0 - 1e-6 ) / seqDt_ ) );
 
 	// Check if we need to do correlations at all.
-	if ( nh > 0 && kernel_.size() > 0 ) {
+	if ( numHistory > 0 && kernel_.size() > 0 ) {
 		// Check if timestep rolls over a seqDt boundary
 		if ( static_cast< int >( p->currTime / seqDt_ ) > 
 				static_cast< int >( (p->currTime - p->dt) / seqDt_ ) ) {
@@ -544,22 +418,22 @@ void SeqSynHandler::vProcess( const Eref& e, ProcPtr p )
 	
 			// Build up the sum of correlations over time
 			vector< double > correlVec( vGetNumSynapses(), 0.0 );
-			for ( int i = 0; i < nh; ++i )
+			for ( int i = 0; i < numHistory; ++i )
 				history_.correl( correlVec, kernel_[i], i );
-			if ( sequenceScale_ > 0.0 ) { // Sum all responses, send to chan
+			if ( responseScale_ > 0.0 ) { // Sum all responses, send to chan
 				seqActivation_ = 0.0;
 				for ( vector< double >::iterator y = correlVec.begin(); 
 								y != correlVec.end(); ++y )
 					seqActivation_ += pow( *y, sequencePower_ );
 	
 				// We'll use the seqActivation_ to send a special msg.
-				seqActivation_ *= sequenceScale_;
+				seqActivation_ *= responseScale_;
 			}
-			if ( plasticityScale_ > 0.0 ) { // Short term changes in individual wts
+			if ( weightScale_ > 0.0 ) { // Short term changes in individual wts
 				weightScaleVec_ = correlVec;
 				for ( vector< double >::iterator y=weightScaleVec_.begin(); 
 							y != weightScaleVec_.end(); ++y )
-					*y *= plasticityScale_;
+					*y *= weightScale_;
 			}
 		}
 	}
@@ -568,15 +442,15 @@ void SeqSynHandler::vProcess( const Eref& e, ProcPtr p )
 	// We can't leave it to the base class vProcess, because we need
 	// to scale the weights individually in some cases.
 	double activation = seqActivation_; // Start with seq activation
-	if ( plasticityScale_ > 0.0 ) {
+	if ( weightScale_ > 0.0 ) {
 		while( !events_.empty() && events_.top().time <= p->currTime ) {
-			activation += events_.top().weight * baseScale_ * 
+			activation += events_.top().weight * 
 					weightScaleVec_[ events_.top().synIndex ] / p->dt;
 			events_.pop();
 		}
 	} else {
 		while( !events_.empty() && events_.top().time <= p->currTime ) {
-			activation += baseScale_ * events_.top().weight / p->dt;
+			activation += events_.top().weight / p->dt;
 			events_.pop();
 		}
 	}
@@ -590,8 +464,3 @@ void SeqSynHandler::vReinit( const Eref& e, ProcPtr p )
 	while( !events_.empty() )
 		events_.pop();
 }
-
-int SeqSynHandler::numHistory() const
-{
-	return static_cast< int >( 1.0 + floor( historyTime_ * (1.0 - 1e-6 ) / seqDt_ ) );
-}
diff --git a/synapse/SeqSynHandler.h b/synapse/SeqSynHandler.h
index 7489da865d144ee3929137a35adf57d387c246db..15e1472f5248c8c83876c5dd144faf65eff47172 100644
--- a/synapse/SeqSynHandler.h
+++ b/synapse/SeqSynHandler.h
@@ -55,14 +55,8 @@ class SeqSynHandler: public SynHandlerBase
  		double getSeqDt() const;
 		void setHistoryTime( double v );
  		double getHistoryTime() const;
-		void setBaseScale( double v );
- 		double getBaseScale() const;
-		void setSequenceScale( double v );
- 		double getSequenceScale() const;
-		void setSynapseOrder( vector< unsigned int> v );
- 		vector< unsigned int> getSynapseOrder() const;
-		void setSynapseOrderOption( int v );
- 		int getSynapseOrderOption() const;
+		void setResponseScale( double v );
+ 		double getResponseScale() const;
  		double getSeqActivation() const; // summed activation of syn chan
 		void setPlasticityScale( double v );
  		double getPlasticityScale() const;
@@ -72,11 +66,6 @@ class SeqSynHandler: public SynHandlerBase
  		vector< double > getKernel() const;
  		vector< double > getHistory() const;
 
-		////////////////////////////////////////////////////////////////
-		// Utility func
-		int numHistory() const;
-		void refillSynapseOrder( unsigned int newSize );
-		void fixSynapseOrder();
 		////////////////////////////////////////////////////////////////
 		static const Cinfo* initCinfo();
 	private:
@@ -97,19 +86,13 @@ class SeqSynHandler: public SynHandlerBase
 		string kernelEquation_;
 		unsigned int kernelWidth_; // Width in terms of number of synapses 
 
-		/// Time to store history. KernelDt defines num of rows
+		// Time to store history. KernelDt defines num of rows
 		double historyTime_;	
 		double seqDt_;	// Time step for successive entries in kernel
-		/// Scaling factor for baseline synaptic responses.
-		double baseScale_; 
-		/// Scaling factor for sequence recognition responses.
-		double sequenceScale_; 
-
-		/**
-		 * Scaling factor for short-term plastic weight changes in each 
-		 * synapse arising from sequential input.
-		 */
-		double plasticityScale_;
+		// Scaling factor for sustained activation of synapse from response
+		double responseScale_; 
+		// Scaling factor for weight changes in each synapse from response
+		double weightScale_;
 
 		/**
 		 * Exponent to use for the outcome of the sequential calculations.
@@ -133,23 +116,8 @@ class SeqSynHandler: public SynHandlerBase
 		vector< double > latestSpikes_; 
 
 		///////////////////////////////////////////
-		vector< vector<  double > > kernel_; ///Kernel for seq selectivity
-		RollingMatrix history_;	/// Rows = time; cols = synInputs
-		/**
-		 * Remaps synapse order to avoid correlations based on presynaptic 
-		 * object Id order, or on connection building order. This 
-		 * undesirable ordering occurs even when random synaptic
-		 * projections are used. User can alter as preferred. This is 
-		 * simply a look up table so that the incoming synapse index is
-		 * remapped: index_on_Handler = synapseOrder_[original_syn_index]
-		 * This must only have numbers from zero to numSynapses, and should
-		 * normally have all the numbers.
-		 */
-		vector< unsigned int > synapseOrder_; 
-
-		/// Options: -2: User. -1: ordered. 0: random by system seed. 
-		/// > 0: Random by seed specified by this number
-		int synapseOrderOption_;
+		vector< vector<  double > > kernel_;	//Kernel for seq selectivity
+		RollingMatrix history_;	// Rows = time; cols = synInputs
 
 		vector< Synapse > synapses_;
 		priority_queue< PreSynEvent, vector< PreSynEvent >, CompareSynEvent > events_;
diff --git a/synapse/testSynapse.cpp b/synapse/testSynapse.cpp
index b39b87bd654e47cd3b03dfd7f8af665b31068715..2edd4165c1c5866effe687f2e08e5bc943e792fe 100644
--- a/synapse/testSynapse.cpp
+++ b/synapse/testSynapse.cpp
@@ -20,48 +20,6 @@
 #include "../shell/Shell.h"
 #include "../randnum/randnum.h"
 
-double doCorrel( RollingMatrix& rm, vector< vector< double >> & kernel )
-{
-	int nr = kernel.size();
-	vector< double > correlVec( nr, 0.0 );
-	for ( int i = 0; i < nr; ++i )
-		rm.correl( correlVec, kernel[i], i );
-	double seqActivation = 0.0;
-	for ( int i = 0; i < nr; ++i )
-		seqActivation += correlVec[i];
-	return seqActivation;
-}
-
-void testRollingMatrix2()
-{
-	int nr = 5;
-	RollingMatrix rm;
-	rm.resize( nr, nr );
-	vector< vector< double > > kernel( nr );
-	for ( int i = 0; i < nr; ++i ) {
-		kernel[i].resize( nr, 0.0 );
-		rm.zeroOutRow( i );
-		for ( int j = 0; j < nr; ++j ) {
-			kernel[i][j] = 16 - (i-j)*(i-j); // symmetric, forward
-			rm.sumIntoEntry( (i==j), i, j );
-		}
-	}
-	double ret1 = doCorrel( rm, kernel );
-
-	for ( int i = 0; i < nr; ++i ) {
-		kernel[i].clear();
-		kernel[i].resize( nr, 0.0 );
-		rm.zeroOutRow( i );
-		for ( int j = 0; j < nr; ++j ) {
-			int k = nr-i-1;
-			kernel[i][j] = 16 - (k-j)*(k-j); // symmetric, backwards
-			rm.sumIntoEntry( (k==j), i, j );
-		}
-	}
-	double ret2 = doCorrel( rm, kernel );
-	assert( doubleEq( ret1, ret2 ) );
-}
-
 void testRollingMatrix()
 {
 	int nr = 5;
@@ -99,59 +57,44 @@ void testRollingMatrix()
 	for ( int i = 0; i < nr; ++i )
 			input[i] = i + 1;
 
-	assert( doubleEq( rm.dotProduct( input, 0, 5 ), 0.0 ) );
-	assert( doubleEq( rm.dotProduct( input, 1, 5 ), 1.0 ) );
-	assert( doubleEq( rm.dotProduct( input, 2, 5 ), 4.0 ) );
-	assert( doubleEq( rm.dotProduct( input, 3, 5 ), 9.0 ) );
-	assert( doubleEq( rm.dotProduct( input, 4, 5 ), 16.0 ) );
-	assert( doubleEq( rm.dotProduct( input, 4, 6 ), 12.0 ) );
-	assert( doubleEq( rm.dotProduct( input, 4, 7 ), 8.0 ) );
-	assert( doubleEq( rm.dotProduct( input, 4, 8 ), 4.0 ) );
-	assert( doubleEq( rm.dotProduct( input, 4, 9 ), 0.0 ) );
-
-	// Note that the input and the row are aligned at col=5, the 
-	// middle of the input vector. 
+	assert( doubleEq( rm.dotProduct( input, 0, 0 ), 0.0 ) );
+	assert( doubleEq( rm.dotProduct( input, 1, 0 ), 1.0 ) );
+	assert( doubleEq( rm.dotProduct( input, 2, 0 ), 4.0 ) );
+	assert( doubleEq( rm.dotProduct( input, 3, 0 ), 9.0 ) );
+	assert( doubleEq( rm.dotProduct( input, 4, 0 ), 16.0 ) );
+	assert( doubleEq( rm.dotProduct( input, 4, 1 ), 12.0 ) );
+	assert( doubleEq( rm.dotProduct( input, 4, 2 ), 8.0 ) );
+	assert( doubleEq( rm.dotProduct( input, 4, 3 ), 4.0 ) );
+	assert( doubleEq( rm.dotProduct( input, 4, 4 ), 0.0 ) );
+
 	rm.sumIntoRow( input, 0 );	// input == [1234500000]
 	vector< double > corr;
 	rm.correl( corr, input, 4 );	// rm[4] == [00040000]
-	assert( doubleEq( corr[0], 0.0 ) );
-	assert( doubleEq( corr[1], 0.0 ) );
-	assert( doubleEq( corr[2], 0.0 ) );
-	assert( doubleEq( corr[3], 0.0 ) );
-	assert( doubleEq( corr[4], 20.0 ) );
-	assert( doubleEq( corr[5], 16.0 ) );
-	assert( doubleEq( corr[6], 12.0 ) );
-	assert( doubleEq( corr[7], 8.0 ) );
-	assert( doubleEq( corr[8], 4.0 ) );
-	assert( doubleEq( corr[9], 0.0 ) );
+	assert( doubleEq( corr[0], 16.0 ) );
+	assert( doubleEq( corr[1], 12.0 ) );
+	assert( doubleEq( corr[2], 8.0 ) );
+	assert( doubleEq( corr[3], 4.0 ) );
+	assert( doubleEq( corr[4], 0.0 ) );
 
 	corr.assign( corr.size(), 0 );
 	rm.correl( corr, input, 0 );	// rm[0] == [1234500000]
-	assert( doubleEq( corr[0], 0.0 ) );
-	assert( doubleEq( corr[1], 5.0 ) );
-	assert( doubleEq( corr[2], 14.0 ) );
-	assert( doubleEq( corr[3], 26.0 ) );
-	assert( doubleEq( corr[4], 40.0 ) );
-	assert( doubleEq( corr[5], 55.0 ) );
-	assert( doubleEq( corr[6], 40.0 ) );
-	assert( doubleEq( corr[7], 26.0 ) );
-	assert( doubleEq( corr[8], 14.0 ) );
-	assert( doubleEq( corr[9], 5.0 ) );
+	assert( doubleEq( corr[0], 55.0 ) );
+	assert( doubleEq( corr[1], 40.0 ) );
+	assert( doubleEq( corr[2], 26.0 ) );
+	assert( doubleEq( corr[3], 14.0 ) );
+	assert( doubleEq( corr[4], 5.0 ) );
 
 	cout << "." << flush;
 }
 
-// FIXME: This test is failing on travis.
 void testSeqSynapse()
 {
 	int numSyn = 10;
 	int kernelWidth = 5;
 	SeqSynHandler ssh;
 	ssh.vSetNumSynapses( numSyn );
-
 	// for ( int i = 0; i < numSyn; ++i )
 		// ssh.addSynapse();
-
 	assert( static_cast< int >( ssh.vGetNumSynapses() ) == numSyn );
 	ssh.setSeqDt( 1.0 );
 	ssh.setHistoryTime( 5.0 );
@@ -170,12 +113,11 @@ void testSeqSynapse()
 
 	cout << "." << flush;
 
-	ssh.setBaseScale( 1.0 );
-	ssh.setSequenceScale( 1.0 );
+	ssh.setResponseScale( 1.0 );
 	for ( int i = 0; i < numSyn; ++i ) {
 		ssh.addSpike( i, 0.0, 1.0 );
 	}
-	ssh.setPlasticityScale( 1.0 );
+	ssh.setWeightScale( 1.0 );
 	ProcInfo p;
 
 	Eref sheller( Id().eref() );
@@ -187,13 +129,14 @@ void testSeqSynapse()
 	// Here we correlate the vector [1,1,1,1,1,1,1,1,1,1,1] with
 	// the kernel [4,1,-1,-1,-1]
 	// Other lines are zeros.
-	assert( doubleEq( ssh.getSeqActivation(), 14.0 ) );
+	// Should really make the kernel mapping symmetrical.
+	assert( doubleEq( ssh.getSeqActivation(), 28.0 ) );
 	vector< double > wts = ssh.getWeightScaleVec();
-	for ( int i = 2; i < numSyn-2; ++i )
+	for ( int i = 0; i < numSyn-4; ++i )
 		assert( doubleEq( wts[i], 2.0 ) );
-	assert( doubleEq( wts[0], -3 ) ); // Edge effects.
-	assert( doubleEq( wts[1], -2 ) ); // Edge effects. 
-	assert( doubleEq( wts[8], 3 ) ); // Edge effects.
+	assert( doubleEq( wts[6], 3 ) ); // Edge effects. Last -1 vanishes.
+	assert( doubleEq( wts[7], 4 ) ); // Edge effects. 
+	assert( doubleEq( wts[8], 5 ) ); // Edge effects.
 	assert( doubleEq( wts[9], 4 ) ); // Edge effects.
 		
 	cout << "." << flush;
@@ -207,7 +150,6 @@ void testSynapse()
 {
 #ifdef DO_UNIT_TESTS
 	testRollingMatrix();
-	testRollingMatrix2();
 	testSeqSynapse();
 #endif // DO_UNIT_TESTS
 }
diff --git a/tests/python/test_difshells.py b/tests/python/test_difshells.py
index 367b953a8a55d3bcb8d6563b4fa57f7688a42450..669f46a891717c87cac7892988f86b652af8af05 100644
--- a/tests/python/test_difshells.py
+++ b/tests/python/test_difshells.py
@@ -115,6 +115,7 @@ if __name__ == '__main__':
     dend.initVm = Vm_0
     dend.diameter = dend_diameter
     dend.length = dend_length
+
     pulse.delay[0] = 8.
     pulse.width[0] = 500e-3
     pulse.level[0] = inject