changing to ifelse function