sweep of nested ifs