fixing var declarations in for-loops pt.2