BETA algorithm