shifting things around
did stuff
Added distance function