Use System.publish instead of raw dispatchEvent