waitforpx functions