<s>[INST] Here's a function:
```
def customer_totals():
    customers = [
        {'id': 1, 'name': 'Alice', 'total': 100},
        {'id': 2, 'name': 'Bob', 'total': 200},
        {'id': 3, 'name': 'Charlie', 'total': 300},
        {'id': 4, 'name': 'Alice', 'total': 400},
        {'id': 5, 'name': 'Bob', 'total': 500},
        {'id': 6, 'name': 'Charlie', 'total': 600}
    ]

    new_customers = []
    for customer in customers:
        if customer['name'] not in [c['name'] for c in new_customers]:
            new_customers.append(customer)

    print(new_customers)
```
The output of this function should be: 
```
[
    {'id': 1, 'name': 'Alice', 'total': 100}, 
    {'id': 2, 'name': 'Bob', 'total': 200}, 
    {'id': 6, 'name': 'Charlie', 'total': 600}
]
```
 However, right now it just returns the first unique name. How do you make it so it returns the last occurrence of a unique name.

 Changing the list to be ordered by descending shouldn't solve it. As in the example above, when there are multiple occurences of a name the id also changes but the name remains the same, and we want to return the last occurence. (the highest 'id' with a same name.) The data is coming from another source which can be unordered.

Would you refactor this function?[/INST]