works (on a few test inputs)