Now supports programmatic writing out to file.