Remove warnings: 'not used variable' and 'shadowing outer variable'