Refactor script source