added comments, pushed features out of repl() and into their own functions.