refactored repl calls, improved repl quit/error functionality