Optimized to remove duplicated words.