pull out the repl so it can be run from a function