Fixes #1159.

Relax space requirements and greediness.