added ball_proximity function