refactor script evaluation