more generic calculation of dispersion - work in progress