and take into account shorter path