Added output to file in the right place