Changed the ifelse
tests