properly calculates distances for #index

Also removes NaN distances from display for #show