Clean up C code a bit