Tweak variable scope and events for whitespace matching