Debugged the decomposed nearest neighbors lookup