Added option for distance method using doubles