I think there might be an issue here. What if the success variable becomes false but later is changed back to true?