refactoring and updates to third party scripts