Improved debugging logging, and changed results output to be csv