Created multivariate dual type, improved API and fixed bugs