Undereferencing dispatchEvent

Also removing some JSON stuff