Making example more efficient