cleanup some names and move the environment out to the script scope because it isn't repl based