adding in stop pin while loop