C code added. Slightly broken at the moment. WIP