Finish BB algorithm