Started work on writing output.
Program can now write output file.