merge new code from van, sundry cleanups