add debug info to eval-ed scripts, plus some refactoring