better CRF code