LUT modified to ifs