Refactored scripts