Add ability to catch actions within the while loop