First version of greedy heuristic