Remove commented out lines, refactor commonalities in matrixToCSV into a single function.