KDE algorithm

This is the first iteration of the KDE algorithm.