Simplify 2 ifs.