Modified cfunction to be callable. Unfortunately, leaks