Fix assorted issues and adapt to use.