updating master script with latest iteration