Added support for nested extend statements