Added the C code