Refactor xexecscript