Cleanup, use FFI buffers instead of lua strings.
Fixes and cleanup for stdlib.
Add unit tests.