Reworked greedy reference algorithm to be smarter about ordering of
blocks added