Added more functions, fixed typedefs.
Continue conversion to FFI.