Added jQuery world ($ scope block) and custom event handling.