First iteration of the KDE algortihm