updated greedy