added 'cond' and tests