GreedyAlghoritm code cleaning