implemented Motyka distance and his test