migrate to C implementations