TODO: Write finalArray to file. One line per entry.