Improve a little bit the algorithms