Optimisation, work on input file of 50 000 lines