continue cleaning up and simplifying js code for repl