Cleanup and big fixes.