new better solution for the example