Update beacon_manager.rb

optimise beacon filtering code