added scope code