improved similarity measure