Distributed Cycle Detection and Removal