Yet more assorted fixes and cleanup