Fix programs to be more testable.