Updated the way greedy works since fails can happen now.