Rewrite ifs