some fixes and addition to greedy