Cleanup and some various fixes.