Make initial example work

The initial example has some issues:

 * The JS itself is invalid, I believe it's meant to be an IIFE, so I have fixed that.
 * It references an undefined variable (`ctrl`) which I believe should be `scope`.
 * I Moved the `<script>` tags to bottom of the page to defer execution until the page has actually loaded.