Lots of new code for the adapter.

Still doens't work from the REPL, though -- only in a module :-/