Refactoring, script fix