Merged two if's into one