Distance changed logic