Added similarity implementation.