If you pull these conditions out to before the if-block, I think this will end up being more readable.