check for frame equality in a more robust fashion
clean some code + add minimize_object_distance option