added some C code