simplify ifs

simplify ifs