before algoritm change