better wire erasing algorithm