improve pattern matching for names