added some c code