recode.  simplify logic