use let to reduce a little duplication