Changed wait realbutton for a loop