Optimize the `last` selector