remove comparison not needed as this is check above and we break in that case.
Move computation inside an if to speed it up.