drafting text buffer code