Major cleanup of how results are collected and written out