Mostly working solver