Replaced random tab-delimitation with proper csv output.
Fixed subtle casing bug.