refactor to allow for multiple text buffers and stub in history function