imporved code and scrachpad with a draft of aprox distnace