fixing and speeding up crf.