modified to use input filename, not stdin