add distance compare and fix case where entry doesn't trigger