Explaining the algorithm