rewrote input file generation