adding original c code