working on faster c code