Move declaration into loop