Cleanup code for sending tokens

* This also fixes breakage when using a text/trace profiler

Change-Id: I87f2709ed3703311ff5a30cd64a84d1f05d7997d