Supporting code for xApply blog post