Implemented and optimized kNN algorithm. Ready for kNCN implementation.

Other minor fixes. Release mode now compiles. Ready to move to one
project instead of different projects.