Added weighted similarity support.