Refactor BeaconManager handling code into a separate class.