amended C function handling; safety improvements; updated documentation