Store distance as attribute
test qmed improvements