finished crf_ed
changed optimization