I copied this code from @jburr to HbbCommon and updated FTAG5 accordingly. I haven't done any validation yet. Tagging also @dguest and @jveatch.