Improved patrolling logic