implemented open scope
implemented close scope