Moved some stuff around.
Code hygiene improvements in the BK-tree from http://codereview.stackexchange.com/a/72088/56818