Factor C code into .h file.