Added improved algo