optimizate the algorithm of biu~