Changes output to C and adds tests.