Cleanups and tweaks to previous version.