generalize script