IFELSE and TO working