Fix event tracing and improve API a bit