refactored to allow repl and executing files