added greedy search working for h1, h2 assumed but untested