Completed historyBufferReadPrevious function