master: works great now. Also templated general version of the fold method, testing that next.