Some bug fixes and tightening in gnereal, almost ready to be run.