I think inverting the logic would be simpler. Also fix the indentation.