cond refactor