change if-else-if to cond