Initial sketch of the algorithm