Refactor a bit the REPL buffer init