Change nested ifs to &&