REPL-related code improvements per @paulp