changed procedure of buffering input file
changed procedure of buffering input file