The two if can be written in only one.