Added quasidensity calculation for the general case.