Cleanup, used old fg code, input file through terminal