delete by distance and better resource accounting