Extracted repl code to own file

Moved repl code and vars out of the main file and into own file