Reworks some of the QC stuff and adds test