*Slightly* cleaned up the monstrous completion calculation code