Limit Setting code and macros from 2011 paper