Work in progress. Encountering issues with inserting tokens into the buffer