Improved the comparison functions that compute the Jacarrd distance