Consolidated C code into 1 file