Half-decent version, doesn't quite generate acceptable formulae yet.