Refactor distance helper onto model