Finally got greedy search to work, but not well