Converted switch to ifs