added auto distance