Cleaning up QC functions (PEP8) and working on performance issues