Added comments; changed output file format to csv; improved output file formatting.