Cosmetic changes

  - clean up code (remove #if 0 blocks)
  - add documentation.
Extend use of Eigen::Ref to input/output vectors and configurations.