added prior to joints dist calcualtion