pulling out the last of project specific code from bagging, adding bagging tests