Implemented KNN with window