refactored CRF classifier