changed outputfile numbering start from 0 to 1