added debug & scoping updates