Cofactor 20141117

Various bug fixes, tests, command line tool improvements, README