replace cond with if