Performance improvements + emitting events from Python.