implemented distance. but something is not working. the test result should be 8, i only get 4