added variables and nesting