Factored out the REPLBuffer