uncommented key point of algorithm from last commit.