Updates to harden the code and output the appropriate csv format