Added more complete C code.