Some general C code/functions that we might need every now and then