added similarity check function