initial version of distance measure