Example scripts refactored