now completes variable def in foreac & minimal tweaks