MAINT: move the calculation of joint endpoint distribution into a more generic module