Mostly cleanup and bug fixes.