First version using two different heuristics