starting line C implementation : almost done, to be tested