refactoring: two if's merged