move distance measures to own file.