Finished reduce.pl