Buffered greedy algorithm added