add c implementation