Change main REPL loop to maintain state