added C-c C-z to switch to repl, refactored the get-repl code