Variables scoping support and various optimizations.