remove double if-statement