added selecting beacon logic