changed some buffer token stuff to use stack instead of heap