cleanups c code