adds distance calc + fixes double calls