Fix factor rate calculation. Fix writing ABC file as the wrong line was generated. Fix reading ABC file since it always failed. Various other code cleanup issues.