added some well commented multithreaded C code