Rewrote code so that multiple instances can run.