Fix input file and test_output, cleanup code