Codeless and spatial data

fixed it
replacing distance with d

edit: also did the sorting as i want!
thanks alot @mark-piller