updated script from second run through