Moved all non-ffi code out of ffi.lisp