Refactoring PS scripts.