fixed the algorithm - now it will always work when the progress bar is flat

I actually have a reason for doing it the way I did. If it's something like this:

```java
boolean errorIsShown = true;

if (errorIsShown) {
}
```

In this case, it makes logical sense and it is very readable. When the boolean isn't named like that though, I'm in the habit of doing what I did above. I can always change the variable name though.