rewrite nested ifs /w cond-form