Added support for nested loops