Refactored code to another script