WIP: Move to state machine design in REPL server