Changed script to deal with multiple runs of the same class