Some change in the main algorithm

Rémi Matéo & Nicolas Normand