helper functions from Doug Friedel from the 2012 proceedings
(needs some edit)