added IFn and a bit of work on ffi