added func to convert if else chain to ifs