added but have not tested the greedy step