Refactored while loop and set confirm message to my boolean variable