finish conversion to C