Fix build

And miscellaneous cleanups