Change loops to give reason of failure
Currently while-loops use multiple conditions. This should be changed to seperated breaking conditions that give the reason of ending the loop.
Currently while-loops use multiple conditions. This should be changed to seperated breaking conditions that give the reason of ending the loop.