refactor repl from a bunch of module functions into a real object