cleanup c code