improvements on var detection

Now it detects vars with assignments also;