Remove useless cycles