move app specific code out of multivariateAB, add some documentation