refactored text script