code cleanup for new C code