Where you determine the wheel is still spinning, just "retun;" to exit the loop. No need to complicate things.