Finally a working solver!