It looks like these two if statements can be merged together.