cleaned the algorithm

Signed-off-by: Ladislas de Toldi <ladislas@leka-smarttoys.com>