Fixing issue #291 (WIP)

`event` isn't in scope here, you can't do it this way.  You have to have a closure, such that event is actually available when you need it.  Also, don't use `window.event` as I mentioned on irc.