Improving the algo