Refactored old script in prep of new one