try using a boolean variable telling it to run while end = false and after your requirements set end to true