Added brackets around ifs