Several cleanups and tweaks