Fixed a scope bug.
Improved example.