Modified script to properly switch