Added new logic to detect beacons