Miscellaneous code, mostly Erlang hacks