Cleans up ffi code