Added black-red algorithm