Ncf 177

Address NCF-177, plus other code cleanups, simplifications and optimizations.

Tested on Mac OSX 10.9.0 with gcc 4.8.2 and also with OpenMPI (using clang)