Improved efficiency of best set for heuristic
Improved abstraction for training H