Added greedy option, fixes #36.