I have no particular problem with this as it is more or less what the old code did, but do you have any ideas for a better heuristic?