start my own understanding of this algorithm