use let to simplify code