refactor greedy