ENH: Code restructuring + KDT distance measurement app.