Improvements to `this` scope
Add debug logging and local test page